summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_html.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2014-08-08 16:17:09 +0000
committerschwarze <schwarze@openbsd.org>2014-08-08 16:17:09 +0000
commit3fdead0c15a9b57a9c5d379eb3eaf79e0a44599f (patch)
treecdf7ee71b5f7684ce94ade0d0537e56e9efecdf3 /usr.bin/mandoc/mdoc_html.c
parentSimplify by allowing only one post-handler. (diff)
downloadwireguard-openbsd-3fdead0c15a9b57a9c5d379eb3eaf79e0a44599f.tar.xz
wireguard-openbsd-3fdead0c15a9b57a9c5d379eb3eaf79e0a44599f.zip
Bring the handling of defective prologues even closer to groff,
in particular relaxing the distinction between prologue and body and further improving messages. * The last .Dd wins and the last .Os wins, even in the body. * The last .Dt before the first body macro wins. * Missing title in .Dt defaults to UNTITLED. Warn about it. * Missing section in .Dt does not default to 1. But warn about it. * Do not warn multiple times about the same mdoc(7) prologue macro. * Warn about missing .Os. * Incomplete .TH defaults to empty strings. Warn about it.
Diffstat (limited to 'usr.bin/mandoc/mdoc_html.c')
-rw-r--r--usr.bin/mandoc/mdoc_html.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index df8797adaf7..2f5bb1e8400 100644
--- a/usr.bin/mandoc/mdoc_html.c
+++ b/usr.bin/mandoc/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.77 2014/08/08 16:00:23 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.78 2014/08/08 16:17:09 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -376,8 +376,9 @@ print_mdoc_head(MDOC_ARGS)
print_gen_head(h);
bufinit(h);
- bufcat_fmt(h, "%s(%s)", meta->title, meta->msec);
-
+ bufcat(h, meta->title);
+ if (meta->msec)
+ bufcat_fmt(h, "(%s)", meta->msec);
if (meta->arch)
bufcat_fmt(h, " (%s)", meta->arch);
@@ -521,7 +522,11 @@ mdoc_root_pre(MDOC_ARGS)
mandoc_asprintf(&volume, "%s (%s)",
meta->vol, meta->arch);
- mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec);
+ if (NULL == meta->msec)
+ title = mandoc_strdup(meta->title);
+ else
+ mandoc_asprintf(&title, "%s(%s)",
+ meta->title, meta->msec);
PAIR_SUMMARY_INIT(&tag[0], "Document Header");
PAIR_CLASS_INIT(&tag[1], "head");