diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2006-05-07 12:55:32 +0000 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2006-05-07 12:55:32 +0000 |
| commit | f91db5e8ccfc6f602cf3c38fa5e0e4cb3a7eb9c3 (patch) | |
| tree | 36a499b89737a37b5e78ac4c426451a7ba49d466 | |
| parent | cd09fc44746b1e74a972ea9274c49e4a5e1d43cd (diff) | |
| download | halibut-f91db5e8ccfc6f602cf3c38fa5e0e4cb3a7eb9c3.zip halibut-f91db5e8ccfc6f602cf3c38fa5e0e4cb3a7eb9c3.tar.gz halibut-f91db5e8ccfc6f602cf3c38fa5e0e4cb3a7eb9c3.tar.bz2 halibut-f91db5e8ccfc6f602cf3c38fa5e0e4cb3a7eb9c3.tar.xz | |
Factor out another routine from man_rdaddwc(), this one to add a control
string to the output. This incidentally fixes a bug whereby font changes
at the start of a line weren't resetting QUOTE_INITCTRL.
[originally from svn r6660]
| -rw-r--r-- | bk_man.c | 29 |
1 files changed, 15 insertions, 14 deletions
@@ -537,6 +537,15 @@ static int man_rdaddwc_reset(rdstringc *rs, int quote_props, manconfig *conf, return quote_props; } +static int man_rdaddctrl(rdstringc *rs, char *c, int quote_props, + manconfig *conf, charset_state *state) { + quote_props = man_rdaddwc_reset(rs, quote_props, conf, state); + rdaddsc(rs, c); + if (*c) + quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ + return quote_props; +} + static int man_rdaddwc(rdstringc *rs, word *text, word *end, int quote_props, manconfig *conf, charset_state *state) { @@ -569,14 +578,12 @@ static int man_rdaddwc(rdstringc *rs, word *text, word *end, if (towordstyle(text->type) == word_Emph && (attraux(text->aux) == attr_First || attraux(text->aux) == attr_Only)) { - quote_props = man_rdaddwc_reset(rs, quote_props, conf, state); - rdaddsc(rs, "\\fI"); + quote_props = man_rdaddctrl(rs, "\\fI", quote_props, conf, state); } else if ((towordstyle(text->type) == word_Code || towordstyle(text->type) == word_WeakCode) && (attraux(text->aux) == attr_First || attraux(text->aux) == attr_Only)) { - quote_props = man_rdaddwc_reset(rs, quote_props, conf, state); - rdaddsc(rs, "\\fB"); + quote_props = man_rdaddctrl(rs, "\\fB", quote_props, conf, state); } if (removeattr(text->type) == word_Normal) { @@ -597,12 +604,9 @@ static int man_rdaddwc(rdstringc *rs, word *text, word *end, quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ *state = s2; } - if (hyphen) { + if (hyphen) quote_props = - man_rdaddwc_reset(rs, quote_props, conf, state); - rdaddc(rs, '-'); - quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ - } + man_rdaddctrl(rs, "-", quote_props, conf, state); } else { quote_props = man_rdaddwc(rs, text->alt, NULL, quote_props, conf, state); @@ -610,9 +614,7 @@ static int man_rdaddwc(rdstringc *rs, word *text, word *end, if (len != 0) sfree(c); } else if (removeattr(text->type) == word_WhiteSpace) { - quote_props = man_rdaddwc_reset(rs, quote_props, conf, state); - rdaddc(rs, ' '); - quote_props &= ~QUOTE_INITCTRL; /* not at start any more */ + quote_props = man_rdaddctrl(rs, " ", quote_props, conf, state); } else if (removeattr(text->type) == word_Quote) { man_convert(quoteaux(text->aux) == quote_Open ? conf->lquote : conf->rquote, 0, @@ -625,8 +627,7 @@ static int man_rdaddwc(rdstringc *rs, word *text, word *end, if (towordstyle(text->type) != word_Normal && (attraux(text->aux) == attr_Last || attraux(text->aux) == attr_Only)) { - quote_props = man_rdaddwc_reset(rs, quote_props, conf, state); - rdaddsc(rs, "\\fP"); + quote_props = man_rdaddctrl(rs, "\\fP", quote_props, conf, state); } break; } |