aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-08-06 15:09:05 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-08-06 15:09:05 +0000
commitd1c93a587dfb54f669ffb05890dab4d523cc57dc (patch)
treee8862f17d03e32664ba10cc8d9aa4b682bbeff64 /mdoc_html.c
parent5f1748e981fcd266c4bc34941a57e258388e7c69 (diff)
downloadmandoc-d1c93a587dfb54f669ffb05890dab4d523cc57dc.tar.gz
mandoc-d1c93a587dfb54f669ffb05890dab4d523cc57dc.tar.zst
mandoc-d1c93a587dfb54f669ffb05890dab4d523cc57dc.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 'mdoc_html.c')
-rw-r--r--mdoc_html.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index e863e281..9fe241e7 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.194 2014/08/01 19:25:52 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.195 2014/08/06 15:09:05 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -380,8 +380,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);
@@ -525,7 +526,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");