aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--mdoc_html.c23
-rw-r--r--mdoc_man.c13
-rw-r--r--mdoc_term.c14
-rw-r--r--mdoc_validate.c9
4 files changed, 30 insertions, 29 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 07a2e3ec..71333302 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.191 2014/07/02 03:48:07 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.192 2014/07/02 19:55:10 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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);
}
diff --git a/mdoc_man.c b/mdoc_man.c
index 8dcfae74..b6362f46 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.64 2014/07/02 03:48:07 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.65 2014/07/02 19:55:10 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -1565,11 +1565,16 @@ static int
pre_sm(DECL_ARGS)
{
- assert(n->child && MDOC_TEXT == n->child->type);
- if (0 == strcmp("on", n->child->string))
- outflags |= MMAN_Sm | MMAN_spc;
+ if (NULL == n->child)
+ outflags ^= MMAN_Sm;
+ else if (0 == strcmp("on", n->child->string))
+ outflags |= MMAN_Sm;
else
outflags &= ~MMAN_Sm;
+
+ if (MMAN_Sm & outflags)
+ outflags |= MMAN_spc;
+
return(0);
}
diff --git a/mdoc_term.c b/mdoc_term.c
index 0039525a..7a007e84 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.268 2014/07/02 03:48:07 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.269 2014/07/02 19:55:10 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -2056,14 +2056,16 @@ static int
termp_sm_pre(DECL_ARGS)
{
- assert(n->child && MDOC_TEXT == n->child->type);
- if (0 == strcmp("on", n->child->string)) {
- if (p->col)
- p->flags &= ~TERMP_NOSPACE;
+ if (NULL == n->child)
+ p->flags ^= TERMP_NONOSPACE;
+ else if (0 == strcmp("on", n->child->string))
p->flags &= ~TERMP_NONOSPACE;
- } else
+ else
p->flags |= TERMP_NONOSPACE;
+ if (p->col && ! (TERMP_NONOSPACE & p->flags))
+ p->flags &= ~TERMP_NOSPACE;
+
return(0);
}
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 52bd51b2..e43e00df 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.221 2014/07/02 13:10:45 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.222 2014/07/02 19:55:10 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -1668,11 +1668,12 @@ ebool(struct mdoc *mdoc)
{
if (NULL == mdoc->last->child) {
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_MACROEMPTY);
- mdoc_node_delete(mdoc, mdoc->last);
+ if (MDOC_Sm == mdoc->last->tok)
+ mdoc->flags ^= MDOC_SMOFF;
return(1);
}
- check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_EQ, 1);
+
+ check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_LT, 2);
assert(MDOC_TEXT == mdoc->last->child->type);