aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-07-30 00:19:16 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-07-30 00:19:16 +0000
commit8f97288fed1c527774fb2fb7c78ed9a63895411f (patch)
tree23d342333b19759e3c780b84380fa23f464f635e /mdoc_html.c
parentab50b28853e096fd795141008a0a389b41d30ec8 (diff)
downloadmandoc-8f97288fed1c527774fb2fb7c78ed9a63895411f.tar.gz
mandoc-8f97288fed1c527774fb2fb7c78ed9a63895411f.tar.zst
mandoc-8f97288fed1c527774fb2fb7c78ed9a63895411f.zip
Various improvements related to .Ex and .Rv:
* let .Nm fall back to the empty string, not to UNKNOWN * never let .Rv copy an argument from .Nm * avoid spurious \fR after empty .Nm in -Tman * correct handling of .Ex and .Rv in -Tman * correct the wording of the output for .Rv without arguments * use non-breaking spaces in .Ex and .Rv output where required * split MANDOCERR_NONAME into a warning for .Ex and an error for .Nm
Diffstat (limited to 'mdoc_html.c')
-rw-r--r--mdoc_html.c56
1 files changed, 31 insertions, 25 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 71333302..fcde3658 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.192 2014/07/02 19:55:10 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.193 2014/07/30 00:19:16 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -1069,11 +1069,11 @@ mdoc_ex_pre(MDOC_ARGS)
}
if (nchild > 1)
- print_text(h, "utilities exit");
+ print_text(h, "utilities exit\\~0");
else
- print_text(h, "utility exits");
+ print_text(h, "utility exits\\~0");
- print_text(h, "0 on success, and >0 if an error occurs.");
+ print_text(h, "on success, and\\~>0 if an error occurs.");
return(0);
}
@@ -1744,35 +1744,41 @@ mdoc_rv_pre(MDOC_ARGS)
PAIR_CLASS_INIT(&tag, "fname");
- print_text(h, "The");
-
nchild = n->nchild;
- for (n = n->child; n; n = n->next) {
- assert(MDOC_TEXT == n->type);
+ if (nchild > 0) {
+ print_text(h, "The");
- t = print_otag(h, TAG_B, 1, &tag);
- print_text(h, n->string);
- print_tagq(h, t);
-
- h->flags |= HTML_NOSPACE;
- print_text(h, "()");
+ for (n = n->child; n; n = n->next) {
+ t = print_otag(h, TAG_B, 1, &tag);
+ print_text(h, n->string);
+ print_tagq(h, t);
- if (nchild > 2 && n->next) {
h->flags |= HTML_NOSPACE;
- print_text(h, ",");
+ print_text(h, "()");
+
+ if (n->next == NULL)
+ continue;
+
+ if (nchild > 2) {
+ h->flags |= HTML_NOSPACE;
+ print_text(h, ",");
+ }
+ if (n->next->next == NULL)
+ print_text(h, "and");
}
- if (n->next && NULL == n->next->next)
- print_text(h, "and");
- }
+ if (nchild > 1)
+ print_text(h, "functions return");
+ else
+ print_text(h, "function returns");
- if (nchild > 1)
- print_text(h, "functions return");
- else
- print_text(h, "function returns");
+ print_text(h, "the value\\~0 if successful;");
+ } else
+ print_text(h, "Upon successful completion,"
+ " the value\\~0 is returned;");
- print_text(h, "the value 0 if successful; otherwise the "
- "value -1 is returned and the global variable");
+ print_text(h, "otherwise the value\\~\\-1 is returned"
+ " and the global variable");
PAIR_CLASS_INIT(&tag, "var");
t = print_otag(h, TAG_B, 1, &tag);