diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-11-19 21:59:21 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-11-19 21:59:21 +0000 |
commit | ef2cdd2d2fb60c0467aceaa6aed093e67345f1ac (patch) | |
tree | 12511d7d4ad56570f5fd6525fb64504a31e6f9b3 /usr.bin | |
parent | 6afac889da35eacd71ad566914207d3af13371dd (diff) |
Let .Ao and .Aq render as "<>" after .An and as "\(la\(ra" elsewhere,
just like groff; minibug noticed by bentley@.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mandoc/mdoc_html.c | 8 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_man.c | 27 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 8 |
3 files changed, 34 insertions, 9 deletions
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index 2d22fa747cd..7146784f71a 100644 --- a/usr.bin/mandoc/mdoc_html.c +++ b/usr.bin/mandoc/mdoc_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_html.c,v 1.85 2014/11/17 06:44:35 schwarze Exp $ */ +/* $OpenBSD: mdoc_html.c,v 1.86 2014/11/19 21:59:19 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -2073,7 +2073,8 @@ mdoc_quote_pre(MDOC_ARGS) case MDOC_Ao: /* FALLTHROUGH */ case MDOC_Aq: - print_text(h, "\\(la"); + print_text(h, n->parent->prev != NULL && + n->parent->prev->tok == MDOC_An ? "<" : "\\(la"); break; case MDOC_Bro: /* FALLTHROUGH */ @@ -2149,7 +2150,8 @@ mdoc_quote_post(MDOC_ARGS) case MDOC_Ao: /* FALLTHROUGH */ case MDOC_Aq: - print_text(h, "\\(ra"); + print_text(h, n->parent->prev != NULL && + n->parent->prev->tok == MDOC_An ? ">" : "\\(ra"); break; case MDOC_Bro: /* FALLTHROUGH */ diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c index 3e5e5e2eca2..226fb720b3d 100644 --- a/usr.bin/mandoc/mdoc_man.c +++ b/usr.bin/mandoc/mdoc_man.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_man.c,v 1.71 2014/11/17 06:44:35 schwarze Exp $ */ +/* $OpenBSD: mdoc_man.c,v 1.72 2014/11/19 21:59:19 schwarze Exp $ */ /* * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> * @@ -44,6 +44,7 @@ static void font_push(char); static void font_pop(void); static void mid_it(void); static void post__t(DECL_ARGS); +static void post_aq(DECL_ARGS); static void post_bd(DECL_ARGS); static void post_bf(DECL_ARGS); static void post_bk(DECL_ARGS); @@ -70,6 +71,7 @@ static void post_vt(DECL_ARGS); static int pre__t(DECL_ARGS); static int pre_an(DECL_ARGS); static int pre_ap(DECL_ARGS); +static int pre_aq(DECL_ARGS); static int pre_bd(DECL_ARGS); static int pre_bf(DECL_ARGS); static int pre_bk(DECL_ARGS); @@ -170,8 +172,8 @@ static const struct manact manacts[MDOC_MAX + 1] = { { NULL, pre__t, post__t, NULL, NULL }, /* %T */ { NULL, NULL, post_percent, NULL, NULL }, /* %V */ { NULL, NULL, NULL, NULL, NULL }, /* Ac */ - { cond_body, pre_enc, post_enc, "<", ">" }, /* Ao */ - { cond_body, pre_enc, post_enc, "<", ">" }, /* Aq */ + { cond_body, pre_aq, post_aq, NULL, NULL }, /* Ao */ + { cond_body, pre_aq, post_aq, NULL, NULL }, /* Aq */ { NULL, NULL, NULL, NULL, NULL }, /* At */ { NULL, NULL, NULL, NULL, NULL }, /* Bc */ { NULL, pre_bf, post_bf, NULL, NULL }, /* Bf */ @@ -868,6 +870,25 @@ pre_ap(DECL_ARGS) } static int +pre_aq(DECL_ARGS) +{ + + print_word(n->parent->prev != NULL && + n->parent->prev->tok == MDOC_An ? "<" : "\\(la"); + outflags &= ~MMAN_spc; + return(1); +} + +static void +post_aq(DECL_ARGS) +{ + + outflags &= ~(MMAN_spc | MMAN_nl); + print_word(n->parent->prev != NULL && + n->parent->prev->tok == MDOC_An ? ">" : "\\(ra"); +} + +static int pre_bd(DECL_ARGS) { diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 83c89aed33b..e74a951f336 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_term.c,v 1.189 2014/11/17 06:44:35 schwarze Exp $ */ +/* $OpenBSD: mdoc_term.c,v 1.190 2014/11/19 21:59:19 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -1852,7 +1852,8 @@ termp_quote_pre(DECL_ARGS) case MDOC_Ao: /* FALLTHROUGH */ case MDOC_Aq: - term_word(p, "<"); + term_word(p, n->parent->prev != NULL && + n->parent->prev->tok == MDOC_An ? "<" : "\\(la"); break; case MDOC_Bro: /* FALLTHROUGH */ @@ -1923,7 +1924,8 @@ termp_quote_post(DECL_ARGS) case MDOC_Ao: /* FALLTHROUGH */ case MDOC_Aq: - term_word(p, ">"); + term_word(p, n->parent->prev != NULL && + n->parent->prev->tok == MDOC_An ? ">" : "\\(ra"); break; case MDOC_Bro: /* FALLTHROUGH */ |