diff options
-rw-r--r-- | index.sgml | 12 | ||||
-rw-r--r-- | libman.h | 1 | ||||
-rw-r--r-- | man.c | 21 | ||||
-rw-r--r-- | man_macro.c | 28 | ||||
-rw-r--r-- | man_validate.c | 2 | ||||
-rw-r--r-- | mandoc.1 | 3 |
6 files changed, 37 insertions, 30 deletions
@@ -4,7 +4,7 @@ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME="resource-type" CONTENT="document"> <LINK REL="stylesheet" HREF="index.css" TYPE="text/css" MEDIA="all"> - <TITLE>mdocml.bsd.lv</TITLE> + <TITLE>mdocml | mdoc macro compiler</TITLE> </HEAD> <BODY> <TABLE CLASS="frame" SUMMARY="[frame]"> @@ -219,6 +219,16 @@ <COL CLASS="date"> <TBODY> <TR> + <TD VALIGN="top"><SPAN CLASS="date">29-03-2010</SPAN></TD> + <TD VALIGN="top"> + Version <SPAN CLASS="rev">1.9.20</SPAN>: more efforts to get roff instructions + in -man documents under control. This seems to be working for all manuals I can + find. Please let me know if you find ill-formatted -man manuals. Note that + roff instructions embedded in line-scoped, next-line macros (e.g. <Q>B</Q>) are + not supported. + </TD> + </TR> + <TR> <TD VALIGN="top"><SPAN CLASS="date">27-03-2010</SPAN></TD> <TD VALIGN="top"> Version <SPAN CLASS="rev">1.9.18</SPAN>: many fixes (largely pertaining to @@ -37,6 +37,7 @@ struct man { #define MAN_LITERAL (1 << 4) /* Literal input. */ #define MAN_BPLINE (1 << 5) enum man_next next; + enum man_next svnext; struct man_node *last; struct man_node *first; struct man_meta meta; @@ -485,9 +485,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 +552,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 +586,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; - assert(man_macros[tok].fp); + /* Call to handler... */ + assert(man_macros[tok].fp); if ( ! (*man_macros[tok].fp)(m, tok, ln, ppos, &i, buf)) goto err; @@ -597,9 +605,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)) { diff --git a/man_macro.c b/man_macro.c index 3c85f44c..550d162f 100644 --- a/man_macro.c +++ b/man_macro.c @@ -314,28 +314,14 @@ blk_dotted(MACRO_PROT_ARGS) if ( ! rew_scope(MAN_BLOCK, m, ntok)) return(0); - /* - * XXX: manually adjust our next-line status. roff macros are, - * for the moment, ignored, so we don't want to close out bodies - * and so on. - */ - - switch (m->last->type) { - case (MAN_BODY): - m->next = MAN_NEXT_CHILD; - break; - default: - break; - } - /* * Restore flags set when we got here and also stipulate that we * don't post-process the line when exiting the macro op - * function in man_pmacro(). + * function in man_pmacro(). See blk_exp(). */ - m->flags = m->svflags; - m->flags |= MAN_ILINE; + m->flags = m->svflags | MAN_ILINE; + m->next = m->svnext; return(1); } @@ -395,10 +381,14 @@ blk_exp(MACRO_PROT_ARGS) return(0); } else { /* - * Save our state; we restore it when exiting from the - * roff instruction block. + * Save our state and next-scope indicator; we restore + * it when exiting from the roff instruction block. See + * blk_dotted(). */ m->svflags = m->flags; + m->svnext = m->next; + + /* Make sure we drop any line modes. */ m->flags = 0; } diff --git a/man_validate.c b/man_validate.c index b69f9e68..5778a3c6 100644 --- a/man_validate.c +++ b/man_validate.c @@ -59,7 +59,7 @@ static v_check posts_part[] = { check_part, NULL }; static v_check posts_sec[] = { check_sec, NULL }; static v_check posts_le1[] = { check_le1, NULL }; static v_check pres_bline[] = { check_bline, NULL }; -static v_check pres_roff[] = { check_bline, check_roff, NULL }; +static v_check pres_roff[] = { check_roff, NULL }; static const struct man_valid man_valids[MAN_MAX] = { { NULL, posts_eq0 }, /* br */ @@ -220,7 +220,8 @@ and .Fl f Ns Ar no-ign-chars . . .It Fl f Ns Ar ign-errors -Don't halt when encountering parse errors. Useful with +When parsing multiple files, don't halt when one errors out. Useful +with .Fl T Ns Ar lint over a large set of manuals passed on the command line. .El |