X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/halibut/blobdiff_plain/4118fc81d41680b91459e46f0e2aef47ecaadcef..ee90d1f0229c97e51b96cb92714de6f6d5b2b450:/bk_man.c diff --git a/bk_man.c b/bk_man.c index 21e33f3..553b2dd 100644 --- a/bk_man.c +++ b/bk_man.c @@ -164,8 +164,6 @@ void man_backend(paragraph *sourceform, keywordlist *keywords, } fputc('\n', fp); - fprintf(fp, ".UC\n"); - had_described_thing = FALSE; #define cleanup_described_thing do { \ if (had_described_thing) \ @@ -199,7 +197,7 @@ void man_backend(paragraph *sourceform, keywordlist *keywords, { int depth; if (p->type == para_Subsect) - depth = p->aux + 2; + depth = p->aux + 1; else if (p->type == para_Heading) depth = 1; else @@ -409,9 +407,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 +439,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 +450,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 +462,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 +503,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,