=================================================================== RCS file: /cvs/docbook2mdoc/macro.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -p -r1.17 -r1.18 --- docbook2mdoc/macro.c 2019/05/01 15:05:39 1.17 +++ docbook2mdoc/macro.c 2019/05/01 17:20:47 1.18 @@ -1,4 +1,4 @@ -/* $Id: macro.c,v 1.17 2019/05/01 15:05:39 schwarze Exp $ */ +/* $Id: macro.c,v 1.18 2019/05/01 17:20:47 schwarze Exp $ */ /* * Copyright (c) 2019 Ingo Schwarze * @@ -28,15 +28,22 @@ */ void -macro_open(struct format *f, const char *name) +para_check(struct format *f) { - if (f->parastate == PARA_WANT) { - if (f->linestate != LINE_NEW) { - putchar('\n'); - f->linestate = LINE_NEW; - } - puts(".Pp"); + if (f->parastate != PARA_WANT) + return; + if (f->linestate != LINE_NEW) { + putchar('\n'); + f->linestate = LINE_NEW; } + puts(".Pp"); + f->parastate = PARA_HAVE; +} + +void +macro_open(struct format *f, const char *name) +{ + para_check(f); switch (f->linestate) { case LINE_MACRO: if (f->flags & FMT_NOSPC) { @@ -49,7 +56,7 @@ macro_open(struct format *f, const char *name) } /* FALLTHROUGH */ case LINE_TEXT: - if (f->nofill) + if (f->nofill && f->linestate == LINE_TEXT) fputs(" \\c", stdout); putchar('\n'); /* FALLTHROUGH */ @@ -241,13 +248,7 @@ macro_nodeline(struct format *f, const char *name, str void print_text(struct format *f, const char *word, int flags) { - if (f->parastate == PARA_WANT) { - if (f->linestate != LINE_NEW) { - putchar('\n'); - f->linestate = LINE_NEW; - } - puts(".Pp"); - } + para_check(f); switch (f->linestate) { case LINE_NEW: break;