summaryrefslogtreecommitdiffstats
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-01-21 02:16:52 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-01-21 02:16:52 +0000
commitd3c02f9a901012b0686fa3799e7d3000e682db20 (patch)
tree403e73c36199aa2d4e687efa0b06dcec9b211b64 /roff.c
parent131c1facdcd489bdadc435c8b52a339b53475bc3 (diff)
downloadmandoc-d3c02f9a901012b0686fa3799e7d3000e682db20.tar.gz
pass empty request lines through to tbl(7); sometimes, they end a layout
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/roff.c b/roff.c
index 54ed1c81..3948711e 100644
--- a/roff.c
+++ b/roff.c
@@ -1166,13 +1166,13 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs)
/*
* First, if a scope is open and we're not a macro, pass the
- * text through the macro's filter. If a scope isn't open and
- * we're not a macro, just let it through.
- * Finally, if there's an equation scope open, divert it into it
- * no matter our state.
+ * text through the macro's filter.
+ * Equations process all content themselves.
+ * Tables process almost all content themselves, but we want
+ * to warn about macros before passing it there.
*/
- if (r->last && ! ctl) {
+ if (r->last != NULL && ! ctl) {
t = r->last->tok;
assert(roffs[t].text);
e = (*roffs[t].text)(r, t, buf, ln, pos, pos, offs);
@@ -1180,13 +1180,12 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs)
if (e != ROFF_CONT)
return(e);
}
- if (r->eqn)
+ if (r->eqn != NULL)
return(eqn_read(&r->eqn, ln, buf->buf, ppos, offs));
- if ( ! ctl) {
- if (r->tbl)
- return(tbl_read(r->tbl, ln, buf->buf, pos));
+ if (r->tbl != NULL && ( ! ctl || buf->buf[pos] == '\0'))
+ return(tbl_read(r->tbl, ln, buf->buf, pos));
+ if ( ! ctl)
return(roff_parsetext(buf, pos, offs));
- }
/* Skip empty request lines. */