=================================================================== RCS file: /cvs/mandoc/mdoc_macro.c,v retrieving revision 1.138 retrieving revision 1.142 diff -u -p -r1.138 -r1.142 --- mandoc/mdoc_macro.c 2014/07/30 17:06:26 1.138 +++ mandoc/mdoc_macro.c 2014/08/21 12:57:17 1.142 @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.138 2014/07/30 17:06:26 schwarze Exp $ */ +/* $Id: mdoc_macro.c,v 1.142 2014/08/21 12:57:17 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010, 2012, 2013 Ingo Schwarze @@ -15,10 +15,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif +#include + #include #include #include @@ -843,7 +843,7 @@ blk_exp_close(MACRO_PROT_ARGS) static int in_line(MACRO_PROT_ARGS) { - int la, scope, cnt, nc, nl; + int la, scope, cnt, mayopen, nc, nl; enum margverr av; enum mdoct ntok; enum margserr ac; @@ -894,6 +894,7 @@ in_line(MACRO_PROT_ARGS) return(0); } + mayopen = 1; for (cnt = scope = 0;; ) { la = *pos; ac = mdoc_args(mdoc, line, pos, buf, tok, &p); @@ -950,19 +951,19 @@ in_line(MACRO_PROT_ARGS) * If we encounter closing punctuation, no word * has been omitted, no scope is open, and we're * allowed to have an empty element, then start - * a new scope. `Ar', `Fl', and `Li', only do - * this once per invocation. There may be more - * of these (all of them?). + * a new scope. */ - if (0 == cnt && (nc || MDOC_Li == tok) && - DELIM_CLOSE == d && ! scope) { + if ((d == DELIM_CLOSE || + (d == DELIM_MIDDLE && tok == MDOC_Fl)) && + (nc || tok == MDOC_Li) && + !scope && !cnt && mayopen) { if ( ! mdoc_elem_alloc(mdoc, line, ppos, tok, arg)) return(0); - if (MDOC_Ar == tok || MDOC_Li == tok || - MDOC_Fl == tok) - cnt++; scope = 1; + cnt++; + if (MDOC_Li == tok || MDOC_Nm == tok) + mayopen = 0; } /* * Close out our scope, if one is open, before @@ -971,15 +972,13 @@ in_line(MACRO_PROT_ARGS) if (scope && ! rew_elem(mdoc, tok)) return(0); scope = 0; - } else if ( ! scope) { + } else if (mayopen && !scope) { if ( ! mdoc_elem_alloc(mdoc, line, ppos, tok, arg)) return(0); scope = 1; + cnt++; } - if (DELIM_NONE == d) - cnt++; - if ( ! dword(mdoc, line, la, p, d, MDOC_JOIN & mdoc_macros[tok].flags)) return(0); @@ -1041,7 +1040,8 @@ blk_full(MACRO_PROT_ARGS) if (tok == MDOC_It) { for (n = mdoc->last; n; n = n->parent) - if (n->tok == MDOC_Bl) + if (n->tok == MDOC_Bl && + ! (n->flags & MDOC_VALID)) break; if (n == NULL) { mandoc_vmsg(MANDOCERR_IT_STRAY, mdoc->parse, @@ -1785,7 +1785,7 @@ phrase_ta(MACRO_PROT_ARGS) n = n->parent; if (NULL == n || LIST_column != n->norm->Bl.type) { mandoc_msg(MANDOCERR_TA_STRAY, mdoc->parse, - line, ppos, NULL); + line, ppos, "Ta"); return(1); }