summaryrefslogtreecommitdiffstats
path: root/man_html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-05-04 22:16:09 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-05-04 22:16:09 +0000
commit9ec7fd0e6d519550b4d3ae0ae9dd5c53d10e6cab (patch)
treeafaaee54c2f56b82235088f352b9382a1117f9d6 /man_html.c
parent5fbabdf032b370e99e8685958b6e15eb3b2ff0f7 (diff)
downloadmandoc-9ec7fd0e6d519550b4d3ae0ae9dd5c53d10e6cab.tar.gz
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 'man_html.c')
-rw-r--r--man_html.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/man_html.c b/man_html.c
index 5f5d65ff..dccd15af 100644
--- a/man_html.c
+++ b/man_html.c
@@ -65,11 +65,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 */
@@ -92,7 +92,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 */
@@ -305,13 +305,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;
}
@@ -423,18 +417,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);