diff options
-rw-r--r-- | mdoc_html.c | 4 | ||||
-rw-r--r-- | mdoc_macro.c | 5 | ||||
-rw-r--r-- | mdoc_man.c | 37 | ||||
-rw-r--r-- | mdoc_term.c | 27 |
4 files changed, 31 insertions, 42 deletions
diff --git a/mdoc_html.c b/mdoc_html.c index 151657fb..a7aa722d 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.185 2013/12/24 19:11:46 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.186 2013/12/24 20:45:27 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -459,7 +459,7 @@ print_mdoc_node(MDOC_ARGS) break; } - if (HTML_KEEP & h->flags || MDOC_SYNPRETTY & n->flags) { + if (HTML_KEEP & h->flags) { if (n->prev ? (n->prev->lastline != n->line) : (n->parent && n->parent->line != n->line)) { h->flags &= ~HTML_KEEP; diff --git a/mdoc_macro.c b/mdoc_macro.c index cbf90d2c..2a63ca92 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.124 2013/12/24 19:11:46 schwarze Exp $ */ +/* $Id: mdoc_macro.c,v 1.125 2013/12/24 20:45:27 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> @@ -713,8 +713,7 @@ blk_exp_close(MACRO_PROT_ARGS) maxargs = 1; break; case (MDOC_Ek): - if ( ! (MDOC_SYNOPSIS & mdoc->flags)) - mdoc->flags &= ~MDOC_KEEP; + mdoc->flags &= ~MDOC_KEEP; default: maxargs = 0; break; @@ -1,4 +1,4 @@ -/* $Id: mdoc_man.c,v 1.53 2013/10/07 22:22:10 schwarze Exp $ */ +/* $Id: mdoc_man.c,v 1.54 2013/12/24 20:45:27 schwarze Exp $ */ /* * Copyright (c) 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> * @@ -705,24 +705,12 @@ static int pre_sect(DECL_ARGS) { - switch (n->type) { - case (MDOC_HEAD): + if (MDOC_HEAD == n->type) { outflags |= MMAN_sp; print_block(manacts[n->tok].prefix, 0); print_word(""); putchar('\"'); outflags &= ~MMAN_spc; - break; - case (MDOC_BODY): - if (MDOC_Sh == n->tok) { - if (MDOC_SYNPRETTY & n->flags) - outflags |= MMAN_Bk; - else - outflags &= ~MMAN_Bk; - } - break; - default: - break; } return(1); } @@ -900,7 +888,7 @@ static void post_bk(DECL_ARGS) { - if (MDOC_BODY == n->type && ! (MDOC_SYNPRETTY & n->flags)) + if (MDOC_BODY == n->type) outflags &= ~MMAN_Bk; } @@ -1408,8 +1396,10 @@ pre_nm(DECL_ARGS) { char *name; - if (MDOC_BLOCK == n->type) + if (MDOC_BLOCK == n->type) { + outflags |= MMAN_Bk; pre_syn(n); + } if (MDOC_ELEM != n->type && MDOC_HEAD != n->type) return(1); name = n->child ? n->child->string : meta->name; @@ -1432,9 +1422,18 @@ static void post_nm(DECL_ARGS) { - if (MDOC_ELEM != n->type && MDOC_HEAD != n->type) - return; - font_pop(); + switch (n->type) { + case (MDOC_BLOCK): + outflags &= ~MMAN_Bk; + break; + case (MDOC_HEAD): + /* FALLTHROUGH */ + case (MDOC_ELEM): + font_pop(); + break; + default: + break; + } } static int diff --git a/mdoc_term.c b/mdoc_term.c index 08bf9fe4..45b3c855 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.252 2013/12/24 19:11:46 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.253 2013/12/24 20:45:27 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> @@ -307,12 +307,9 @@ print_mdoc_node(DECL_ARGS) /* * Keeps only work until the end of a line. If a keep was * invoked in a prior line, revert it to PREKEEP. - * - * Also let SYNPRETTY sections behave as if they were wrapped - * in a `Bk' block. */ - if (TERMP_KEEP & p->flags || MDOC_SYNPRETTY & n->flags) { + if (TERMP_KEEP & p->flags) { if (n->prev ? (n->prev->lastline != n->line) : (n->parent && n->parent->line != n->line)) { p->flags &= ~TERMP_KEEP; @@ -321,16 +318,6 @@ print_mdoc_node(DECL_ARGS) } /* - * Since SYNPRETTY sections aren't "turned off" with `Ek', - * we have to intuit whether we should disable formatting. - */ - - if ( ! (MDOC_SYNPRETTY & n->flags) && - ((n->prev && MDOC_SYNPRETTY & n->prev->flags) || - (n->parent && MDOC_SYNPRETTY & n->parent->flags))) - p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP); - - /* * After the keep flags have been set up, we may now * produce output. Note that some pre-handlers do so. */ @@ -1010,8 +997,10 @@ static int termp_nm_pre(DECL_ARGS) { - if (MDOC_BLOCK == n->type) + if (MDOC_BLOCK == n->type) { + p->flags |= TERMP_PREKEEP; return(1); + } if (MDOC_BODY == n->type) { if (NULL == n->child) @@ -1060,7 +1049,9 @@ static void termp_nm_post(DECL_ARGS) { - if (MDOC_HEAD == n->type && n->next->child) { + if (MDOC_BLOCK == n->type) { + p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP); + } else if (MDOC_HEAD == n->type && n->next->child) { term_flushln(p); p->flags &= ~(TERMP_NOBREAK | TERMP_HANG); p->trailspace = 0; @@ -2240,7 +2231,7 @@ static void termp_bk_post(DECL_ARGS) { - if (MDOC_BODY == n->type && ! (MDOC_SYNPRETTY & n->flags)) + if (MDOC_BODY == n->type) p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP); } |