summaryrefslogtreecommitdiffstats
path: root/mdoc_macro.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-07-30 17:06:26 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-07-30 17:06:26 +0000
commit8cad25c2bd23b7a8d1c081a886ca26c2ff2d1e10 (patch)
tree69a65683cbfaf670639bea17ed5d29aebd6121e5 /mdoc_macro.c
parent16567ee6b0b51e693f21d13f133f9fa14e59d992 (diff)
downloadmandoc-8cad25c2bd23b7a8d1c081a886ca26c2ff2d1e10.tar.gz
Get rid of the useless FATAL error "child violates parent syntax".
When finding items outside lists, simply skip them and throw an ERROR. Handle subsections before the first section instead of bailing out.
Diffstat (limited to 'mdoc_macro.c')
-rw-r--r--mdoc_macro.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index 33dc1e8a..4baebd65 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -424,6 +424,8 @@ rew_dohalt(enum mdoct tok, enum mdoc_type type,
return(REWIND_NONE);
/* FALLTHROUGH */
case MDOC_Sh:
+ if (MDOC_ROOT == p->parent->type)
+ return(REWIND_THIS);
if (MDOC_Nd == p->tok || MDOC_Ss == p->tok ||
MDOC_Sh == p->tok)
return(REWIND_MORE);
@@ -1035,6 +1037,22 @@ blk_full(MACRO_PROT_ARGS)
nl = MDOC_NEWLINE & mdoc->flags;
+ /* Skip items outside lists. */
+
+ if (tok == MDOC_It) {
+ for (n = mdoc->last; n; n = n->parent)
+ if (n->tok == MDOC_Bl)
+ break;
+ if (n == NULL) {
+ mandoc_vmsg(MANDOCERR_IT_STRAY, mdoc->parse,
+ line, ppos, "It %s", buf + *pos);
+ if ( ! mdoc_elem_alloc(mdoc, line, ppos,
+ MDOC_br, NULL))
+ return(0);
+ return(rew_elem(mdoc, MDOC_br));
+ }
+ }
+
/* Close out prior implicit scope. */
if ( ! (MDOC_EXPLICIT & mdoc_macros[tok].flags)) {