diff options
author | 2010-09-20 20:02:27 +0000 | |
---|---|---|
committer | 2010-09-20 20:02:27 +0000 | |
commit | bf782e4226933c26eeede0de773a17814b3e81d7 (patch) | |
tree | 778f4a377429b233eaa8e97200a3c41e84ca4b11 /usr.bin/mandoc/mdoc_html.c | |
parent | Make .Pp .Lp .br not FATAL when having arguments; (diff) | |
download | wireguard-openbsd-bf782e4226933c26eeede0de773a17814b3e81d7.tar.xz wireguard-openbsd-bf782e4226933c26eeede0de773a17814b3e81d7.zip |
Format multiple authors (.%A) in the same way as groff:
Two authors with "and", but without a comma.
Three or more with commata, and an "and" before the last one.
From kristaps@.
Diffstat (limited to 'usr.bin/mandoc/mdoc_html.c')
-rw-r--r-- | usr.bin/mandoc/mdoc_html.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index 0bb410d2cc2..64d69ec1f26 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.29 2010/08/20 00:53:35 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.30 2010/09/20 20:02:27 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -2190,6 +2190,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"); @@ -2242,6 +2245,7 @@ mdoc__x_pre(MDOC_ARGS) PAIR_HREF_INIT(&tag[1], n->child->string); print_otag(h, TAG_A, 2, tag); + return(1); } @@ -2251,6 +2255,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; |