summaryrefslogtreecommitdiffstats
path: root/mdoc_html.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-09-04 19:01:52 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-09-04 19:01:52 +0000
commit8602ef022ba97685524bab84712ad686cd05b20e (patch)
tree68f879dc053e8cd622fba425bf024d152f20a12f /mdoc_html.c
parentf6865c5cc81f43ad947eb8f69efe22d17360f0d7 (diff)
downloadmandoc-8602ef022ba97685524bab84712ad686cd05b20e.tar.gz
Properly handle -mdoc %A in all outputs. This has two-author entires
separated by only "and" while two or more are with ", and" for the last author. Also remove relevant TODO and add regression tests.
Diffstat (limited to 'mdoc_html.c')
-rw-r--r--mdoc_html.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 53889135..93807dd5 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -2194,6 +2194,9 @@ mdoc__x_pre(MDOC_ARGS)
switch (n->tok) {
case(MDOC__A):
PAIR_CLASS_INIT(&tag[0], "ref-auth");
+ if (n->prev && MDOC__A == n->prev->tok)
+ if (NULL == n->next || MDOC__A != n->next->tok)
+ print_text(h, "and");
break;
case(MDOC__B):
PAIR_CLASS_INIT(&tag[0], "ref-book");
@@ -2246,6 +2249,7 @@ mdoc__x_pre(MDOC_ARGS)
PAIR_HREF_INIT(&tag[1], n->child->string);
print_otag(h, TAG_A, 2, tag);
+
return(1);
}
@@ -2255,6 +2259,11 @@ static void
mdoc__x_post(MDOC_ARGS)
{
+ if (MDOC__A == n->tok && n->next && MDOC__A == n->next->tok)
+ if (NULL == n->next->next || MDOC__A != n->next->next->tok)
+ if (NULL == n->prev || MDOC__A != n->prev->tok)
+ return;
+
/* TODO: %U */
h->flags |= HTML_NOSPACE;