]> git.cameronkatri.com Git - mandoc.git/blobdiff - man.c
forgot to commit one request bu espie@
[mandoc.git] / man.c
diff --git a/man.c b/man.c
index 17e002b48ba8d7da7feedd0f9974f06d2f3877a3..ece4868f356f73d81514fa368d02db4caae049de 100644 (file)
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/*     $Id: man.c,v 1.112 2011/10/06 22:29:12 kristaps Exp $ */
+/*     $Id: man.c,v 1.116 2012/06/02 20:16:23 schwarze Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  *
@@ -40,7 +40,7 @@ const char *const __man_macronames[MAN_MAX] = {
        "RI",           "na",           "sp",           "nf",
        "fi",           "RE",           "RS",           "DT",
        "UC",           "PD",           "AT",           "in",
-       "ft"
+       "ft",           "OP",           "EX",           "EE"
        };
 
 const  char * const *man_macronames = __man_macronames;
@@ -543,12 +543,44 @@ man_pmacro(struct man *m, int ln, char *buf, int offs)
                        n = n->parent;
 
                mandoc_vmsg(MANDOCERR_LINESCOPE, m->parse, n->line, 
-                               n->pos, "%s", man_macronames[n->tok]);
+                   n->pos, "%s breaks %s", man_macronames[tok],
+                   man_macronames[n->tok]);
 
                man_node_delete(m, n);
                m->flags &= ~MAN_ELINE;
        }
 
+       /*
+        * Remove prior BLINE macro that is being clobbered.
+        */
+       if ((m->flags & MAN_BLINE) &&
+           (MAN_BSCOPE & man_macros[tok].flags)) {
+               n = m->last;
+
+               /* Might be a text node like 8 in
+                * .TP 8
+                * .SH foo
+                */
+               if (MAN_TEXT == n->type)
+                       n = n->parent;
+
+               /* Remove element that didn't end BLINE, if any. */
+               if ( ! (MAN_BSCOPE & man_macros[n->tok].flags))
+                       n = n->parent;
+
+               assert(MAN_HEAD == n->type);
+               n = n->parent;
+               assert(MAN_BLOCK == n->type);
+               assert(MAN_SCOPED & man_macros[n->tok].flags);
+
+               mandoc_vmsg(MANDOCERR_LINESCOPE, m->parse, n->line, 
+                   n->pos, "%s breaks %s", man_macronames[tok],
+                   man_macronames[n->tok]);
+
+               man_node_delete(m, n);
+               m->flags &= ~MAN_BLINE;
+       }
+
        /*
         * Save the fact that we're in the next-line for a block.  In
         * this way, embedded roff instructions can "remember" state