aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roff_html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2019-01-05 09:14:44 +0000
committerIngo Schwarze <schwarze@openbsd.org>2019-01-05 09:14:44 +0000
commit6b3ce9c2f4fab0e6c861db946aec61ff56ce922a (patch)
tree68632c7cc5068403dacb8c0a3db0fdd877765668 /roff_html.c
parentd7c95824f7db0871524969e5fb3f9a938bebc2d7 (diff)
downloadmandoc-6b3ce9c2f4fab0e6c861db946aec61ff56ce922a.tar.gz
mandoc-6b3ce9c2f4fab0e6c861db946aec61ff56ce922a.tar.zst
mandoc-6b3ce9c2f4fab0e6c861db946aec61ff56ce922a.zip
Now that the NODE_NOFILL flag in the syntax tree is accurate,
use it in the man(7) HTML formatter rather than keeping fill mode state locally, resulting in massive simplification (minus 40 LOC). Move the html_fillmode() state handler function to the html.c module such that both the man(7) and the roff(7) formatter (and in the future, also the mdoc(7) formatter) can use it. Give it a query mode, to be invoked with TOKEN_NONE.
Diffstat (limited to 'roff_html.c')
-rw-r--r--roff_html.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/roff_html.c b/roff_html.c
index a4d4468d..0593e252 100644
--- a/roff_html.c
+++ b/roff_html.c
@@ -1,7 +1,7 @@
-/* $Id: roff_html.c,v 1.16 2018/12/31 07:08:12 schwarze Exp $ */
+/* $Id: roff_html.c,v 1.17 2019/01/05 09:14:44 schwarze Exp $ */
/*
* Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2014, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2014, 2017, 2018, 2019 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
@@ -32,17 +32,19 @@ typedef void (*roff_html_pre_fp)(ROFF_HTML_ARGS);
static void roff_html_pre_br(ROFF_HTML_ARGS);
static void roff_html_pre_ce(ROFF_HTML_ARGS);
+static void roff_html_pre_fi(ROFF_HTML_ARGS);
static void roff_html_pre_ft(ROFF_HTML_ARGS);
+static void roff_html_pre_nf(ROFF_HTML_ARGS);
static void roff_html_pre_sp(ROFF_HTML_ARGS);
static const roff_html_pre_fp roff_html_pre_acts[ROFF_MAX] = {
roff_html_pre_br, /* br */
roff_html_pre_ce, /* ce */
- roff_html_pre_br, /* fi */
+ roff_html_pre_fi, /* fi */
roff_html_pre_ft, /* ft */
NULL, /* ll */
NULL, /* mc */
- roff_html_pre_br, /* nf */
+ roff_html_pre_nf, /* nf */
NULL, /* po */
roff_html_pre_ce, /* rj */
roff_html_pre_sp, /* sp */
@@ -80,6 +82,13 @@ roff_html_pre_ce(ROFF_HTML_ARGS)
}
static void
+roff_html_pre_fi(ROFF_HTML_ARGS)
+{
+ if (html_fillmode(h, TOKEN_NONE) == ROFF_fi)
+ print_otag(h, TAG_BR, "");
+}
+
+static void
roff_html_pre_ft(ROFF_HTML_ARGS)
{
const char *cp;
@@ -89,6 +98,13 @@ roff_html_pre_ft(ROFF_HTML_ARGS)
}
static void
+roff_html_pre_nf(ROFF_HTML_ARGS)
+{
+ if (html_fillmode(h, TOKEN_NONE) == ROFF_nf)
+ print_otag(h, TAG_BR, "");
+}
+
+static void
roff_html_pre_sp(ROFF_HTML_ARGS)
{
print_paragraph(h);