diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-03-25 23:23:02 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-03-25 23:23:02 +0000 |
commit | 3eb08fb47bcf0e1ec01c27c5277f79a45dc710c0 (patch) | |
tree | 555275197591833137f80018ab4c61b77f1f1273 /usr.bin/mandoc/man_term.c | |
parent | 470d717c25312457deedde392732c5a1cb1ee2af (diff) |
merge 1.9.16, keeping local patches
This is mostly cleanup by kristaps@ after my rather hackish patch
to tolerate the non-text macros .na, .sp, .br in next-line scope;
plus some nesting issues fixed by him, all in man(7).
This survived a full cd /usr/src; make man.
Diffstat (limited to 'usr.bin/mandoc/man_term.c')
-rw-r--r-- | usr.bin/mandoc/man_term.c | 80 |
1 files changed, 42 insertions, 38 deletions
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index 20c6d65d522..dcb24a50516 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.25 2010/03/02 01:24:04 schwarze Exp $ */ +/* $Id: man_term.c,v 1.26 2010/03/25 23:23:01 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -61,6 +61,8 @@ struct mtermp { struct termact { int (*pre)(DECL_ARGS); void (*post)(DECL_ARGS); + int flags; +#define MAN_NOTEXT (1 << 0) /* Never has text children. */ }; static int a2width(const struct man_node *); @@ -101,41 +103,41 @@ static void post_SS(DECL_ARGS); static void post_TP(DECL_ARGS); static const struct termact termacts[MAN_MAX] = { - { pre_br, NULL }, /* br */ - { NULL, NULL }, /* TH */ - { pre_SH, post_SH }, /* SH */ - { pre_SS, post_SS }, /* SS */ - { pre_TP, post_TP }, /* TP */ - { pre_PP, NULL }, /* LP */ - { pre_PP, NULL }, /* PP */ - { pre_PP, NULL }, /* P */ - { pre_IP, post_IP }, /* IP */ - { pre_HP, post_HP }, /* HP */ - { NULL, NULL }, /* SM */ - { pre_B, NULL }, /* SB */ - { pre_BI, NULL }, /* BI */ - { pre_BI, NULL }, /* IB */ - { pre_RB, NULL }, /* BR */ - { pre_RB, NULL }, /* RB */ - { NULL, NULL }, /* R */ - { pre_B, NULL }, /* B */ - { pre_I, NULL }, /* I */ - { pre_RI, NULL }, /* IR */ - { pre_RI, NULL }, /* RI */ - { NULL, NULL }, /* na */ - { pre_I, NULL }, /* i */ - { pre_sp, NULL }, /* sp */ - { pre_nf, NULL }, /* nf */ - { pre_fi, NULL }, /* fi */ - { NULL, NULL }, /* r */ - { NULL, NULL }, /* RE */ - { pre_RS, post_RS }, /* RS */ - { pre_ign, NULL }, /* DT */ - { pre_ign, NULL }, /* UC */ - { pre_ign, NULL }, /* PD */ - { pre_sp, NULL }, /* Sp */ - { pre_nf, NULL }, /* Vb */ - { pre_fi, NULL }, /* Ve */ + { pre_br, NULL, MAN_NOTEXT }, /* br */ + { NULL, NULL, 0 }, /* TH */ + { pre_SH, post_SH, 0 }, /* SH */ + { pre_SS, post_SS, 0 }, /* SS */ + { pre_TP, post_TP, 0 }, /* TP */ + { pre_PP, NULL, 0 }, /* LP */ + { pre_PP, NULL, 0 }, /* PP */ + { pre_PP, NULL, 0 }, /* P */ + { pre_IP, post_IP, 0 }, /* IP */ + { pre_HP, post_HP, 0 }, /* HP */ + { NULL, NULL, 0 }, /* SM */ + { pre_B, NULL, 0 }, /* SB */ + { pre_BI, NULL, 0 }, /* BI */ + { pre_BI, NULL, 0 }, /* IB */ + { pre_RB, NULL, 0 }, /* BR */ + { pre_RB, NULL, 0 }, /* RB */ + { NULL, NULL, 0 }, /* R */ + { pre_B, NULL, 0 }, /* B */ + { pre_I, NULL, 0 }, /* I */ + { pre_RI, NULL, 0 }, /* IR */ + { pre_RI, NULL, 0 }, /* RI */ + { NULL, NULL, MAN_NOTEXT }, /* na */ + { pre_I, NULL, 0 }, /* i */ + { pre_sp, NULL, MAN_NOTEXT }, /* sp */ + { pre_nf, NULL, 0 }, /* nf */ + { pre_fi, NULL, 0 }, /* fi */ + { NULL, NULL, 0 }, /* r */ + { NULL, NULL, 0 }, /* RE */ + { pre_RS, post_RS, 0 }, /* RS */ + { pre_ign, NULL, 0 }, /* DT */ + { pre_ign, NULL, 0 }, /* UC */ + { pre_ign, NULL, 0 }, /* PD */ + { pre_sp, NULL, MAN_NOTEXT }, /* Sp */ + { pre_nf, NULL, 0 }, /* Vb */ + { pre_fi, NULL, 0 }, /* Ve */ }; @@ -808,7 +810,8 @@ print_man_node(DECL_ARGS) } break; default: - term_fontrepl(p, TERMFONT_NONE); + if ( ! (MAN_NOTEXT & termacts[n->tok].flags)) + term_fontrepl(p, TERMFONT_NONE); if (termacts[n->tok].pre) c = (*termacts[n->tok].pre)(p, mt, n, m); break; @@ -820,7 +823,8 @@ print_man_node(DECL_ARGS) if (MAN_TEXT != n->type) { if (termacts[n->tok].post) (*termacts[n->tok].post)(p, mt, n, m); - term_fontrepl(p, TERMFONT_NONE); + if ( ! (MAN_NOTEXT & termacts[n->tok].flags)) + term_fontrepl(p, TERMFONT_NONE); } } |