=================================================================== RCS file: /cvs/texi2mdoc/main.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -p -r1.3 -r1.4 --- texi2mdoc/main.c 2015/02/17 17:02:03 1.3 +++ texi2mdoc/main.c 2015/02/17 20:27:44 1.4 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.3 2015/02/17 17:02:03 kristaps Exp $ */ +/* $Id: main.c,v 1.4 2015/02/17 20:27:44 kristaps Exp $ */ /* * Copyright (c) 2015 Kristaps Dzonsons * @@ -467,6 +467,11 @@ static void teximacro(struct texi *p, const char *s) { + if (p->outmacro) + texierr(p, "\"%s\" in open line scope!?", s); + else if (p->literal) + texierr(p, "\"%s\" in a literal scope!?", s); + if (p->ign) return; if (p->outcol) @@ -895,12 +900,9 @@ dodeftypevar(struct texi *p, enum texicmd cmd, parsebracket(p, buf, sz, pos); texiputchars(p, ":\n"); } - p->literal++; teximacroopen(p, ".Vt "); - while (*pos < sz && '\n' != buf[*pos]) - parsesingle(p, buf, sz, pos); + parseeoln(p, buf, sz, pos); teximacroclose(p); - p->literal--; teximacro(p, ".Pp"); parseto(p, buf, sz, pos, blk); } @@ -952,8 +954,7 @@ dodeftypefun(struct texi *p, enum texicmd cmd, parsesingle(p, buf, sz, pos); teximacroclose(p); teximacroopen(p, ".Li "); - while (*pos < sz && '\n' != buf[*pos]) - parsesingle(p, buf, sz, pos); + parseeoln(p, buf, sz, pos); teximacroclose(p); teximacro(p, ".Pp"); if (NULL != blk) @@ -1171,11 +1172,6 @@ dodisplay(struct texi *p, enum texicmd cmd, const char *buf, size_t sz, size_t *pos) { - if (p->outmacro) - texierr(p, "display in open line scope!?"); - else if (p->literal) - texierr(p, "display in a literal scope!?"); - teximacro(p, ".Bd -display"); advanceeoln(p, buf, sz, pos, 1); parseto(p, buf, sz, pos, "display"); @@ -1188,11 +1184,6 @@ doexample(struct texi *p, enum texicmd cmd, { const char *blk; - if (p->outmacro) - texierr(p, "example in open line scope!?"); - else if (p->literal) - texierr(p, "example in a literal scope!?"); - blk = TEXICMD_EXAMPLE == cmd ? "example" : "smallexample"; teximacro(p, ".Bd -literal"); @@ -1366,11 +1357,6 @@ dosubsection(struct texi *p, enum texicmd cmd, const char *buf, size_t sz, size_t *pos) { - if (p->outmacro) - texierr(p, "subsubsection in open line scope!?"); - else if (p->literal) - texierr(p, "subsubsection in a literal scope!?"); - teximacro(p, ".Pp"); parseeoln(p, buf, sz, pos); teximacro(p, ".Pp"); @@ -1396,11 +1382,6 @@ dosp(struct texi *p, enum texicmd cmd, const char *buf, size_t sz, size_t *pos) { - if (p->outmacro) - texierr(p, "spacing in open line scope!?"); - else if (p->literal) - texierr(p, "spacing in a literal scope!?"); - teximacro(p, ".Pp"); advanceeoln(p, buf, sz, pos, 1); } @@ -1471,11 +1452,6 @@ dotable(struct texi *p, enum texicmd cmd, { enum texilist sv = p->list; - if (p->outmacro) - texierr(p, "table in open line scope!?"); - else if (p->literal) - texierr(p, "table in a literal scope!?"); - p->list = TEXILIST_ITEM; teximacro(p, ".Bl -tag -width Ds"); parseto(p, buf, sz, pos, "table"); @@ -1489,11 +1465,6 @@ doenumerate(struct texi *p, enum texicmd cmd, { enum texilist sv = p->list; - if (p->outmacro) - texierr(p, "enumerate in open line scope!?"); - else if (p->literal) - texierr(p, "enumerate in a literal scope!?"); - p->list = TEXILIST_NOITEM; teximacro(p, ".Bl -enum"); parseto(p, buf, sz, pos, "enumerate"); @@ -1506,11 +1477,6 @@ doitemize(struct texi *p, enum texicmd cmd, const char *buf, size_t sz, size_t *pos) { enum texilist sv = p->list; - - if (p->outmacro) - texierr(p, "itemize in open line scope!?"); - else if (p->literal) - texierr(p, "itemize in a literal scope!?"); p->list = TEXILIST_ITEM; teximacro(p, ".Bl -bullet");