=================================================================== RCS file: /cvs/mandoc/roff.c,v retrieving revision 1.85 retrieving revision 1.87 diff -u -p -r1.85 -r1.87 --- mandoc/roff.c 2010/05/29 19:41:47 1.85 +++ mandoc/roff.c 2010/06/09 20:00:38 1.87 @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.85 2010/05/29 19:41:47 kristaps Exp $ */ +/* $Id: roff.c,v 1.87 2010/06/09 20:00:38 kristaps Exp $ */ /* * Copyright (c) 2010 Kristaps Dzonsons * @@ -621,12 +621,22 @@ roff_cond_sub(ROFF_ARGS) { enum rofft t; enum roffrule rr; + struct roffnode *l; ppos = pos; rr = r->last->rule; - roff_cond_text(r, tok, bufp, szp, ln, ppos, pos, offs); + /* + * Clean out scope. If we've closed ourselves, then don't + * continue. + */ + l = r->last; + roffnode_cleanscope(r); + + if (l != r->last) + return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); + if (ROFF_MAX == (t = roff_parse(*bufp, &pos))) return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); @@ -666,10 +676,8 @@ roff_cond_text(ROFF_ARGS) return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); } - if (ep > st && '\\' != *(ep - 1)) { - ep = '\0'; + if (ep == st || (ep > st && '\\' != *(ep - 1))) roffnode_pop(r); - } roffnode_cleanscope(r); return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT);