From a167785523d1ecb246be0ea24d008629b2791b19 Mon Sep 17 00:00:00 2001 From: simon Date: Sun, 21 Nov 2004 13:54:09 +0000 Subject: [PATCH] It turns out that the man format requires the \& sequence (to neutralise a dot at the start of a line) even if there's been an \fB-type sequence on the line before the dot. git-svn-id: svn://svn.tartarus.org/sgt/halibut@4867 cda61777-01e9-0310-a592-d414129be87e --- bk_man.c | 37 +++++++++++++++++++++---------------- inputs/test.but | 6 +++++- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/bk_man.c b/bk_man.c index 21e33f3..bf78905 100644 --- a/bk_man.c +++ b/bk_man.c @@ -409,9 +409,9 @@ static int man_convert(wchar_t const *s, int maxlen, return !err; } -static void man_rdaddwc(rdstringc *rs, word *text, word *end, - int quote_props, manconfig *conf, - charset_state *state) { +static int man_rdaddwc(rdstringc *rs, word *text, word *end, + int quote_props, manconfig *conf, + charset_state *state) { char *c; for (; text && text != end; text = text->next) switch (text->type) { @@ -441,10 +441,10 @@ static void man_rdaddwc(rdstringc *rs, word *text, word *end, if (towordstyle(text->type) == word_Emph && (attraux(text->aux) == attr_First || attraux(text->aux) == attr_Only)) { - if (rs->pos > 0) - quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ man_convert(NULL, 0, &c, quote_props, conf->charset, state); rdaddsc(rs, c); + if (*c) + quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ sfree(c); *state = charset_init_state; rdaddsc(rs, "\\fI"); @@ -452,10 +452,10 @@ static void man_rdaddwc(rdstringc *rs, word *text, word *end, towordstyle(text->type) == word_WeakCode) && (attraux(text->aux) == attr_First || attraux(text->aux) == attr_Only)) { - if (rs->pos > 0) - quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ man_convert(NULL, 0, &c, quote_props, conf->charset, state); rdaddsc(rs, c); + if (*c) + quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ sfree(c); *state = charset_init_state; rdaddsc(rs, "\\fB"); @@ -464,38 +464,39 @@ static void man_rdaddwc(rdstringc *rs, word *text, word *end, if (removeattr(text->type) == word_Normal) { charset_state s2 = *state; - if (rs->pos > 0) - quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ if (man_convert(text->text, 0, &c, quote_props, conf->charset, &s2) || !text->alt) { rdaddsc(rs, c); + if (*c) + quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ *state = s2; } else { - man_rdaddwc(rs, text->alt, NULL, quote_props, conf, state); + quote_props = man_rdaddwc(rs, text->alt, NULL, + quote_props, conf, state); } sfree(c); } else if (removeattr(text->type) == word_WhiteSpace) { - if (rs->pos > 0) - quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ man_convert(L" ", 1, &c, quote_props, conf->charset, state); rdaddsc(rs, c); + if (*c) + quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ sfree(c); } else if (removeattr(text->type) == word_Quote) { - if (rs->pos > 0) - quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ man_convert(quoteaux(text->aux) == quote_Open ? conf->lquote : conf->rquote, 0, &c, quote_props, conf->charset, state); rdaddsc(rs, c); + if (*c) + quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ sfree(c); } if (towordstyle(text->type) != word_Normal && (attraux(text->aux) == attr_Last || attraux(text->aux) == attr_Only)) { - if (rs->pos > 0) - quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ man_convert(NULL, 0, &c, quote_props, conf->charset, state); rdaddsc(rs, c); + if (*c) + quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ sfree(c); *state = charset_init_state; rdaddsc(rs, "\\fP"); @@ -504,7 +505,11 @@ static void man_rdaddwc(rdstringc *rs, word *text, word *end, } man_convert(NULL, 0, &c, quote_props, conf->charset, state); rdaddsc(rs, c); + if (*c) + quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ sfree(c); + + return quote_props; } static void man_text(FILE *fp, word *text, int newline, diff --git a/inputs/test.but b/inputs/test.but index 87bcaf7..4682d5f 100644 --- a/inputs/test.but +++ b/inputs/test.but @@ -32,7 +32,7 @@ a bit] \define{eur} \u20AC{EUR } -\versionid $Id: test.but,v 1.35 2004/08/06 12:17:56 simon Exp $ +\versionid $Id$ \C{ch\\ap} First chapter title; for similar wrapping reasons this chapter title will be ludicrously long. I wonder how much more @@ -52,6 +52,10 @@ To test the man page back end: 'Directive +\cw{.Directive} + +\cw{'Directive} + \\Sping\\Spong\\Spoing \H{head} First section title (very long again, no prizes for -- 2.11.0