summaryrefslogtreecommitdiff
path: root/bk_man.c
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2006-05-07 12:55:32 +0000
committerBen Harris <bjh21@bjh21.me.uk>2006-05-07 12:55:32 +0000
commitf91db5e8ccfc6f602cf3c38fa5e0e4cb3a7eb9c3 (patch)
tree36a499b89737a37b5e78ac4c426451a7ba49d466 /bk_man.c
parentcd09fc44746b1e74a972ea9274c49e4a5e1d43cd (diff)
downloadhalibut-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]
Diffstat (limited to 'bk_man.c')
-rw-r--r--bk_man.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/bk_man.c b/bk_man.c
index 343bf06..2f44818 100644
--- a/bk_man.c
+++ b/bk_man.c
@@ -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;
}