summaryrefslogtreecommitdiffstats
path: root/mdoc_html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-07-02 19:55:10 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-07-02 19:55:10 +0000
commitfdc95e0f088e210664eb7459003c922102fc748e (patch)
tree2941a73b51965c3192f9e63b7579762c3e8c0ad5 /mdoc_html.c
parente98d951b402f5f61bf0fafc86ae5ad5a03f1c85e (diff)
downloadmandoc-fdc95e0f088e210664eb7459003c922102fc748e.tar.gz
When .Sm is called without an argument, groff toggles the spacing mode,
so let us do the same for compatibility. Using this feature is of course not recommended except in manual page obfuscation contests.
Diffstat (limited to 'mdoc_html.c')
-rw-r--r--mdoc_html.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 30c0132d..5c69b689 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1524,23 +1524,16 @@ static int
mdoc_sm_pre(MDOC_ARGS)
{
- assert(n->child && MDOC_TEXT == n->child->type);
- if (0 == strcmp("on", n->child->string)) {
- /*
- * FIXME: no p->col to check. Thus, if we have
- * .Bd -literal
- * .Sm off
- * 1 2
- * .Sm on
- * 3
- * .Ed
- * the "3" is preceded by a space.
- */
- h->flags &= ~HTML_NOSPACE;
+ if (NULL == n->child)
+ h->flags ^= HTML_NONOSPACE;
+ else if (0 == strcmp("on", n->child->string))
h->flags &= ~HTML_NONOSPACE;
- } else
+ else
h->flags |= HTML_NONOSPACE;
+ if ( ! (HTML_NONOSPACE & h->flags))
+ h->flags &= ~HTML_NOSPACE;
+
return(0);
}