diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-01-23 14:19:53 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-01-23 14:19:53 +0000 |
commit | 2e7be903019ddd626eb6deb64f7bd9bf253f4334 (patch) | |
tree | 1896216b21552817a6797ca9a7e81132bd0a6706 | |
parent | 3a9a3d21d3abe156d56b8b639bc3a59ff02d9210 (diff) |
Let .Aq/.Ao/.Ac print "<>" instead of the normal "\(la\(ra"
when the only child is .Mt, not when the preceding node is .An,
to improve robustness. Triggered by a question from Svyatoslav
Mishyn <juef at openmailbox dot org> (Crux Linux).
-rw-r--r-- | usr.bin/mandoc/mdoc_html.c | 12 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_man.c | 12 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 12 |
3 files changed, 18 insertions, 18 deletions
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index 4647aa41443..5c72b8d6844 100644 --- a/usr.bin/mandoc/mdoc_html.c +++ b/usr.bin/mandoc/mdoc_html.c @@ -1,7 +1,7 @@ -/* $OpenBSD: mdoc_html.c,v 1.93 2014/12/23 13:48:15 schwarze Exp $ */ +/* $OpenBSD: mdoc_html.c,v 1.94 2015/01/23 14:19:52 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -2082,8 +2082,8 @@ mdoc_quote_pre(MDOC_ARGS) case MDOC_Ao: /* FALLTHROUGH */ case MDOC_Aq: - print_text(h, n->parent->prev != NULL && - n->parent->prev->tok == MDOC_An ? "<" : "\\(la"); + print_text(h, n->nchild == 1 && + n->child->tok == MDOC_Mt ? "<" : "\\(la"); break; case MDOC_Bro: /* FALLTHROUGH */ @@ -2160,8 +2160,8 @@ mdoc_quote_post(MDOC_ARGS) case MDOC_Ao: /* FALLTHROUGH */ case MDOC_Aq: - print_text(h, n->parent->prev != NULL && - n->parent->prev->tok == MDOC_An ? ">" : "\\(ra"); + print_text(h, n->nchild == 1 && + n->child->tok == MDOC_Mt ? ">" : "\\(ra"); break; case MDOC_Bro: /* FALLTHROUGH */ diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c index 5f420e580b1..2c6c966efe0 100644 --- a/usr.bin/mandoc/mdoc_man.c +++ b/usr.bin/mandoc/mdoc_man.c @@ -1,6 +1,6 @@ -/* $OpenBSD: mdoc_man.c,v 1.79 2014/12/24 23:31:59 schwarze Exp $ */ +/* $OpenBSD: mdoc_man.c,v 1.80 2015/01/23 14:19:52 schwarze Exp $ */ /* - * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -877,8 +877,8 @@ static int pre_aq(DECL_ARGS) { - print_word(n->parent->prev != NULL && - n->parent->prev->tok == MDOC_An ? "<" : "\\(la"); + print_word(n->nchild == 1 && + n->child->tok == MDOC_Mt ? "<" : "\\(la"); outflags &= ~MMAN_spc; return(1); } @@ -888,8 +888,8 @@ post_aq(DECL_ARGS) { outflags &= ~(MMAN_spc | MMAN_nl); - print_word(n->parent->prev != NULL && - n->parent->prev->tok == MDOC_An ? ">" : "\\(ra"); + print_word(n->nchild == 1 && + n->child->tok == MDOC_Mt ? ">" : "\\(ra"); } static int diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 0933dba0478..7778ccd9a3f 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,7 +1,7 @@ -/* $OpenBSD: mdoc_term.c,v 1.201 2014/12/24 23:31:59 schwarze Exp $ */ +/* $OpenBSD: mdoc_term.c,v 1.202 2015/01/23 14:19:52 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de> * * Permission to use, copy, modify, and distribute this software for any @@ -1853,8 +1853,8 @@ termp_quote_pre(DECL_ARGS) case MDOC_Ao: /* FALLTHROUGH */ case MDOC_Aq: - term_word(p, n->parent->prev != NULL && - n->parent->prev->tok == MDOC_An ? "<" : "\\(la"); + term_word(p, n->nchild == 1 && + n->child->tok == MDOC_Mt ? "<" : "\\(la"); break; case MDOC_Bro: /* FALLTHROUGH */ @@ -1926,8 +1926,8 @@ termp_quote_post(DECL_ARGS) case MDOC_Ao: /* FALLTHROUGH */ case MDOC_Aq: - term_word(p, n->parent->prev != NULL && - n->parent->prev->tok == MDOC_An ? ">" : "\\(ra"); + term_word(p, n->nchild == 1 && + n->child->tok == MDOC_Mt ? ">" : "\\(ra"); break; case MDOC_Bro: /* FALLTHROUGH */ |