summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-03-29 10:10:35 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-03-29 10:10:35 +0000
commite34909a15faed90ad1d9efd5e6d44270ab386b5c (patch)
tree5bc2959eed1e9d8a08a9ec591c11ba2ac015c601
parent40d86894cf83a9f39b0d85e391c7c16574971889 (diff)
downloadmandoc-e34909a15faed90ad1d9efd5e6d44270ab386b5c.tar.gz
Final (?) fix to issue pointed out by Sascha Wildner: roff instructions clobbering prior scope rules and line modes.
-rw-r--r--index.sgml12
-rw-r--r--libman.h1
-rw-r--r--man.c21
-rw-r--r--man_macro.c28
-rw-r--r--man_validate.c2
-rw-r--r--mandoc.13
6 files changed, 37 insertions, 30 deletions
diff --git a/index.sgml b/index.sgml
index 87c5e1df..f319a4e3 100644
--- a/index.sgml
+++ b/index.sgml
@@ -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
diff --git a/libman.h b/libman.h
index af4574cb..d4b3eb06 100644
--- a/libman.h
+++ b/libman.h
@@ -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;
diff --git a/man.c b/man.c
index dff5adc9..c74ac21e 100644
--- a/man.c
+++ b/man.c
@@ -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 */
diff --git a/mandoc.1 b/mandoc.1
index 358ca919..e4fdf2b5 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -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