diff options
author | 2017-05-04 22:07:44 +0000 | |
---|---|---|
committer | 2017-05-04 22:07:44 +0000 | |
commit | 96a5de472ceddce830e148f3c839441f7b9343b2 (patch) | |
tree | fcc212399dcdae50546a59c41f02be08c9f1a3c5 /usr.bin/mandoc/man_html.c | |
parent | enable brgphy, which appears in the edgerouter pro (diff) | |
download | wireguard-openbsd-96a5de472ceddce830e148f3c839441f7b9343b2.tar.xz wireguard-openbsd-96a5de472ceddce830e148f3c839441f7b9343b2.zip |
Start roff formatter modules for HTML and termininal output,
used by both the mdoc and man formatters, with the ultimate
goal of reducing code duplication between the two macro formatters.
Made possible by the parser unification.
Add the first formatting function (for the .br request).
Diffstat (limited to 'usr.bin/mandoc/man_html.c')
-rw-r--r-- | usr.bin/mandoc/man_html.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c index 30f90693618..0aa05cb62d3 100644 --- a/usr.bin/mandoc/man_html.c +++ b/usr.bin/mandoc/man_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_html.c,v 1.90 2017/05/04 17:48:24 schwarze Exp $ */ +/* $OpenBSD: man_html.c,v 1.91 2017/05/04 22:07:44 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -63,11 +63,11 @@ static int man_SM_pre(MAN_ARGS); static int man_SS_pre(MAN_ARGS); static int man_UR_pre(MAN_ARGS); static int man_alt_pre(MAN_ARGS); -static int man_br_pre(MAN_ARGS); static int man_ign_pre(MAN_ARGS); static int man_in_pre(MAN_ARGS); static void man_root_post(MAN_ARGS); static void man_root_pre(MAN_ARGS); +static int man_sp_pre(MAN_ARGS); static const struct htmlman __mans[MAN_MAX - MAN_TH] = { { NULL, NULL }, /* TH */ @@ -90,7 +90,7 @@ static const struct htmlman __mans[MAN_MAX - MAN_TH] = { { man_I_pre, NULL }, /* I */ { man_alt_pre, NULL }, /* IR */ { man_alt_pre, NULL }, /* RI */ - { man_br_pre, NULL }, /* sp */ + { man_sp_pre, NULL }, /* sp */ { NULL, NULL }, /* nf */ { NULL, NULL }, /* fi */ { NULL, NULL }, /* RE */ @@ -303,13 +303,7 @@ print_man_node(MAN_ARGS) t = h->tag; if (n->tok < ROFF_MAX) { - switch(n->tok) { - case ROFF_br: - man_br_pre(man, n, h); - break; - default: - abort(); - } + roff_html_pre(h, n); break; } @@ -421,18 +415,14 @@ man_root_post(MAN_ARGS) static int -man_br_pre(MAN_ARGS) +man_sp_pre(MAN_ARGS) { struct roffsu su; SCALE_VS_INIT(&su, 1); - - if (MAN_sp == n->tok) { - if (NULL != (n = n->child)) - if ( ! a2roffsu(n->string, &su, SCALE_VS)) - su.scale = 1.0; - } else - su.scale = 0.0; + if (NULL != (n = n->child)) + if ( ! a2roffsu(n->string, &su, SCALE_VS)) + su.scale = 1.0; print_otag(h, TAG_DIV, "suh", &su); |