]> git.cameronkatri.com Git - mandoc.git/blobdiff - man.c
Wrangle mdoc_args() and mdoc_zargs() to use enum return type.
[mandoc.git] / man.c
diff --git a/man.c b/man.c
index 1d258836eaee191b1f9d81afe1fcdd9bfa582132..44cc06b17ca6bf89a2d0f3e897721b779c1da2c1 100644 (file)
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/*     $Id: man.c,v 1.58 2010/03/29 04:52:14 kristaps Exp $ */
+/*     $Id: man.c,v 1.60 2010/04/08 07:53:01 kristaps Exp $ */
 /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
  *
@@ -53,6 +53,7 @@ const char *const __man_merrnames[WERRMAX] = {
        "invalid nesting of roff declarations", /* WROFFNEST */
        "scope in roff instructions broken", /* WROFFSCOPE */
        "document title should be uppercase", /* WTITLECASE */
+       "deprecated comment style", /* WBADCOMMENT */
 };
 
 const  char *const __man_macronames[MAN_MAX] = {                
@@ -378,6 +379,11 @@ man_ptext(struct man *m, int line, char *buf)
        int              i, j;
        char             sv;
 
+       /* Ignore bogus comments. */
+
+       if ('\\' == buf[0] && '.' == buf[1] && '\"' == buf[2])
+               return(man_pwarn(m, line, 0, WBADCOMMENT));
+
        /* Literal free-form text whitespace is preserved. */
 
        if (MAN_LITERAL & m->flags) {
@@ -485,9 +491,6 @@ man_pmacro(struct man *m, int ln, char *buf)
 
        /* Comments and empties are quickly ignored. */
 
-       if (MAN_BLINE & m->flags)
-               m->flags |= MAN_BPLINE;
-
        if ('\0' == buf[1])
                return(1);
 
@@ -555,6 +558,9 @@ man_pmacro(struct man *m, int ln, char *buf)
         * Remove prior ELINE macro, as it's being clobbering by a new
         * macro.  Note that NSCOPED macros do not close out ELINE
         * macros---they don't print text---so we let those slip by.
+        * NOTE: we don't allow roff blocks (NOCLOSE) to be embedded
+        * here because that would stipulate blocks as children of
+        * elements!
         */
 
        if ( ! (MAN_NSCOPED & man_macros[tok].flags) &&
@@ -586,10 +592,18 @@ man_pmacro(struct man *m, int ln, char *buf)
                m->flags &= ~MAN_ELINE;
        }
 
-       /* Begin recursive parse sequence. */
+       /*
+        * Save the fact that we're in the next-line for a block.  In
+        * this way, embedded roff instructions can "remember" state
+        * when they exit.
+        */
+
+       if (MAN_BLINE & m->flags)
+               m->flags |= MAN_BPLINE;
+
+       /* Call to handler... */
 
        assert(man_macros[tok].fp);
-
        if ( ! (*man_macros[tok].fp)(m, tok, ln, ppos, &i, buf))
                goto err;
 
@@ -597,9 +611,6 @@ out:
        /* 
         * We weren't in a block-line scope when entering the
         * above-parsed macro, so return.
-        *
-        * FIXME: this prohibits the nesting of blocks (e.g., `de' and
-        * family) within BLINE or ELINE systems.  This is annoying.
         */
 
        if ( ! (MAN_BPLINE & m->flags)) {