summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bk_html.c13
-rw-r--r--bk_info.c43
-rw-r--r--bk_man.c7
-rw-r--r--bk_paper.c41
-rw-r--r--bk_text.c44
-rw-r--r--bk_whlp.c14
-rw-r--r--doc/input.but15
-rw-r--r--doc/output.but13
-rw-r--r--halibut.h14
-rw-r--r--index.c6
-rw-r--r--input.c19
-rw-r--r--inputs/test.but12
-rw-r--r--misc.c6
-rw-r--r--paper.h1
14 files changed, 209 insertions, 39 deletions
diff --git a/bk_html.c b/bk_html.c
index 3a49bdc..0c624e4 100644
--- a/bk_html.c
+++ b/bk_html.c
@@ -2231,14 +2231,17 @@ static void html_words(htmloutput *ho, word *words, int flags,
break;
case word_Normal:
case word_Emph:
+ case word_Strong:
case word_Code:
case word_WeakCode:
case word_WhiteSpace:
case word_EmphSpace:
+ case word_StrongSpace:
case word_CodeSpace:
case word_WkCodeSpace:
case word_Quote:
case word_EmphQuote:
+ case word_StrongQuote:
case word_CodeQuote:
case word_WkCodeQuote:
style = towordstyle(w->type);
@@ -2248,6 +2251,11 @@ static void html_words(htmloutput *ho, word *words, int flags,
attraux(w->aux) == attr_Only) &&
(flags & MARKUP))
element_open(ho, "em");
+ else if (style == word_Strong &&
+ (attraux(w->aux) == attr_First ||
+ attraux(w->aux) == attr_Only) &&
+ (flags & MARKUP))
+ element_open(ho, "strong");
else if ((style == word_Code || style == word_WeakCode) &&
(attraux(w->aux) == attr_First ||
attraux(w->aux) == attr_Only) &&
@@ -2273,6 +2281,11 @@ static void html_words(htmloutput *ho, word *words, int flags,
attraux(w->aux) == attr_Only) &&
(flags & MARKUP))
element_close(ho, "em");
+ else if (style == word_Strong &&
+ (attraux(w->aux) == attr_Last ||
+ attraux(w->aux) == attr_Only) &&
+ (flags & MARKUP))
+ element_close(ho, "strong");
else if ((style == word_Code || style == word_WeakCode) &&
(attraux(w->aux) == attr_Last ||
attraux(w->aux) == attr_Only) &&
diff --git a/bk_info.c b/bk_info.c
index 69cd1e2..1c6e033 100644
--- a/bk_info.c
+++ b/bk_info.c
@@ -69,6 +69,7 @@ typedef struct {
int nasect;
wchar_t *bullet, *listsuffix;
wchar_t *startemph, *endemph;
+ wchar_t *startstrong, *endstrong;
wchar_t *lquote, *rquote;
wchar_t *sectsuffix;
wchar_t *rule;
@@ -143,6 +144,8 @@ static infoconfig info_configure(paragraph *source) {
ret.rule = L"\x2500\0-\0\0";
ret.startemph = L"_\0_\0\0";
ret.endemph = uadv(ret.startemph);
+ ret.startstrong = L"*\0*\0\0";
+ ret.endstrong = uadv(ret.startstrong);
ret.lquote = L"\x2018\0\x2019\0`\0'\0\0";
ret.rquote = uadv(ret.lquote);
ret.sectsuffix = L": ";
@@ -233,6 +236,11 @@ static infoconfig info_configure(paragraph *source) {
ret.startemph = uadv(p->keyword);
ret.endemph = uadv(ret.startemph);
}
+ } else if (!ustricmp(p->keyword, L"info-strong")) {
+ if (*uadv(p->keyword) && *uadv(uadv(p->keyword))) {
+ ret.startstrong = uadv(p->keyword);
+ ret.endstrong = uadv(ret.startstrong);
+ }
} else if (!ustricmp(p->keyword, L"info-quotes")) {
if (*uadv(p->keyword) && *uadv(uadv(p->keyword))) {
ret.lquote = uadv(p->keyword);
@@ -260,6 +268,13 @@ static infoconfig info_configure(paragraph *source) {
ret.endemph = uadv(ret.startemph);
}
+ while (*uadv(ret.endstrong) && *uadv(uadv(ret.endstrong)) &&
+ (!cvt_ok(ret.charset, ret.startstrong) ||
+ !cvt_ok(ret.charset, ret.endstrong))) {
+ ret.startstrong = uadv(ret.endstrong);
+ ret.endstrong = uadv(ret.startstrong);
+ }
+
while (*ret.atitle.underline && *uadv(ret.atitle.underline) &&
!cvt_ok(ret.charset, ret.atitle.underline))
ret.atitle.underline = uadv(ret.atitle.underline);
@@ -861,14 +876,17 @@ static int info_rdaddwc(info_data *id, word *words, word *end, int xrefs,
case word_Normal:
case word_Emph:
+ case word_Strong:
case word_Code:
case word_WeakCode:
case word_WhiteSpace:
case word_EmphSpace:
+ case word_StrongSpace:
case word_CodeSpace:
case word_WkCodeSpace:
case word_Quote:
case word_EmphQuote:
+ case word_StrongQuote:
case word_CodeQuote:
case word_WkCodeQuote:
assert(words->type != word_CodeQuote &&
@@ -877,6 +895,10 @@ static int info_rdaddwc(info_data *id, word *words, word *end, int xrefs,
(attraux(words->aux) == attr_First ||
attraux(words->aux) == attr_Only))
ret += info_rdadds(id, cfg->startemph);
+ else if (towordstyle(words->type) == word_Strong &&
+ (attraux(words->aux) == attr_First ||
+ attraux(words->aux) == attr_Only))
+ ret += info_rdadds(id, cfg->startstrong);
else if (towordstyle(words->type) == word_Code &&
(attraux(words->aux) == attr_First ||
attraux(words->aux) == attr_Only))
@@ -896,6 +918,10 @@ static int info_rdaddwc(info_data *id, word *words, word *end, int xrefs,
(attraux(words->aux) == attr_Last ||
attraux(words->aux) == attr_Only))
ret += info_rdadds(id, cfg->endemph);
+ else if (towordstyle(words->type) == word_Strong &&
+ (attraux(words->aux) == attr_Last ||
+ attraux(words->aux) == attr_Only))
+ ret += info_rdadds(id, cfg->endstrong);
else if (towordstyle(words->type) == word_Code &&
(attraux(words->aux) == attr_Last ||
attraux(words->aux) == attr_Only))
@@ -956,22 +982,25 @@ static int info_width_internal(word *words, int xrefs, infoconfig *cfg) {
wid = 0;
attr = towordstyle(words->type);
- if (attr == word_Emph || attr == word_Code) {
+ if (attr == word_Emph || attr == word_Strong || attr == word_Code) {
if (attraux(words->aux) == attr_Only ||
attraux(words->aux) == attr_First)
- wid += ustrwid(attr == word_Emph ? cfg->startemph : cfg->lquote,
- cfg->charset);
+ wid += ustrwid(attr == word_Emph ? cfg->startemph :
+ attr == word_Strong ? cfg->startstrong :
+ cfg->lquote, cfg->charset);
}
- if (attr == word_Emph || attr == word_Code) {
+ if (attr == word_Emph || attr == word_Strong || attr == word_Code) {
if (attraux(words->aux) == attr_Only ||
attraux(words->aux) == attr_Last)
- wid += ustrwid(attr == word_Emph ? cfg->startemph : cfg->lquote,
- cfg->charset);
+ wid += ustrwid(attr == word_Emph ? cfg->startemph :
+ attr == word_Strong ? cfg->startstrong :
+ cfg->lquote, cfg->charset);
}
switch (words->type) {
case word_Normal:
case word_Emph:
+ case word_Strong:
case word_Code:
case word_WeakCode:
if (cvt_ok(cfg->charset, words->text) || !words->alt)
@@ -982,10 +1011,12 @@ static int info_width_internal(word *words, int xrefs, infoconfig *cfg) {
case word_WhiteSpace:
case word_EmphSpace:
+ case word_StrongSpace:
case word_CodeSpace:
case word_WkCodeSpace:
case word_Quote:
case word_EmphQuote:
+ case word_StrongQuote:
case word_CodeQuote:
case word_WkCodeQuote:
assert(words->type != word_CodeQuote &&
diff --git a/bk_man.c b/bk_man.c
index 44f159f..45eb511 100644
--- a/bk_man.c
+++ b/bk_man.c
@@ -590,14 +590,17 @@ static int man_rdaddwc(rdstringc *rs, word *text, word *end,
case word_Normal:
case word_Emph:
+ case word_Strong:
case word_Code:
case word_WeakCode:
case word_WhiteSpace:
case word_EmphSpace:
+ case word_StrongSpace:
case word_CodeSpace:
case word_WkCodeSpace:
case word_Quote:
case word_EmphQuote:
+ case word_StrongQuote:
case word_CodeQuote:
case word_WkCodeQuote:
assert(text->type != word_CodeQuote &&
@@ -607,6 +610,10 @@ static int man_rdaddwc(rdstringc *rs, word *text, word *end,
(attraux(text->aux) == attr_First ||
attraux(text->aux) == attr_Only)) {
quote_props = man_rdaddctrl(rs, "\\fI", quote_props, conf, state);
+ } else if (towordstyle(text->type) == word_Strong &&
+ (attraux(text->aux) == attr_First ||
+ attraux(text->aux) == attr_Only)) {
+ quote_props = man_rdaddctrl(rs, "\\fB", quote_props, conf, state);
} else if ((towordstyle(text->type) == word_Code ||
towordstyle(text->type) == word_WeakCode) &&
(attraux(text->aux) == attr_First ||
diff --git a/bk_paper.c b/bk_paper.c
index 844962e..1ec6bc8 100644
--- a/bk_paper.c
+++ b/bk_paper.c
@@ -237,20 +237,26 @@ static paper_conf paper_configure(paragraph *source, font_list *fontlist) {
ret.fbase.font_size = 12;
ret.fbase.fonts[FONT_NORMAL] = make_std_font(fontlist, "Times-Roman");
ret.fbase.fonts[FONT_EMPH] = make_std_font(fontlist, "Times-Italic");
+ ret.fbase.fonts[FONT_STRONG] = make_std_font(fontlist, "Times-Bold");
ret.fbase.fonts[FONT_CODE] = make_std_font(fontlist, "Courier");
ret.fcode.font_size = 12;
ret.fcode.fonts[FONT_NORMAL] = make_std_font(fontlist, "Courier-Bold");
ret.fcode.fonts[FONT_EMPH] = make_std_font(fontlist, "Courier-Oblique");
+ ret.fcode.fonts[FONT_STRONG] = make_std_font(fontlist, "Courier-Bold");
ret.fcode.fonts[FONT_CODE] = make_std_font(fontlist, "Courier");
ret.ftitle.font_size = 24;
ret.ftitle.fonts[FONT_NORMAL] = make_std_font(fontlist, "Helvetica-Bold");
ret.ftitle.fonts[FONT_EMPH] =
make_std_font(fontlist, "Helvetica-BoldOblique");
+ ret.ftitle.fonts[FONT_STRONG] =
+ make_std_font(fontlist, "Helvetica-Bold");
ret.ftitle.fonts[FONT_CODE] = make_std_font(fontlist, "Courier-Bold");
ret.fchapter.font_size = 20;
ret.fchapter.fonts[FONT_NORMAL]= make_std_font(fontlist, "Helvetica-Bold");
ret.fchapter.fonts[FONT_EMPH] =
make_std_font(fontlist, "Helvetica-BoldOblique");
+ ret.fchapter.fonts[FONT_STRONG] =
+ make_std_font(fontlist, "Helvetica-Bold");
ret.fchapter.fonts[FONT_CODE] = make_std_font(fontlist, "Courier-Bold");
ret.nfsect = 3;
ret.fsect = snewn(ret.nfsect, font_cfg);
@@ -258,16 +264,22 @@ static paper_conf paper_configure(paragraph *source, font_list *fontlist) {
ret.fsect[0].fonts[FONT_NORMAL]= make_std_font(fontlist, "Helvetica-Bold");
ret.fsect[0].fonts[FONT_EMPH] =
make_std_font(fontlist, "Helvetica-BoldOblique");
+ ret.fsect[0].fonts[FONT_STRONG] =
+ make_std_font(fontlist, "Helvetica-Bold");
ret.fsect[0].fonts[FONT_CODE] = make_std_font(fontlist, "Courier-Bold");
ret.fsect[1].font_size = 14;
ret.fsect[1].fonts[FONT_NORMAL]= make_std_font(fontlist, "Helvetica-Bold");
ret.fsect[1].fonts[FONT_EMPH] =
make_std_font(fontlist, "Helvetica-BoldOblique");
+ ret.fsect[1].fonts[FONT_STRONG] =
+ make_std_font(fontlist, "Helvetica-Bold");
ret.fsect[1].fonts[FONT_CODE] = make_std_font(fontlist, "Courier-Bold");
ret.fsect[2].font_size = 13;
ret.fsect[2].fonts[FONT_NORMAL]= make_std_font(fontlist, "Helvetica-Bold");
ret.fsect[2].fonts[FONT_EMPH] =
make_std_font(fontlist, "Helvetica-BoldOblique");
+ ret.fsect[2].fonts[FONT_STRONG] =
+ make_std_font(fontlist, "Helvetica-Bold");
ret.fsect[2].fonts[FONT_CODE] = make_std_font(fontlist, "Courier-Bold");
ret.contents_indent_step = 24 * UNITS_PER_PT;
ret.contents_margin = 84 * UNITS_PER_PT;
@@ -465,24 +477,32 @@ static paper_conf paper_configure(paragraph *source, font_list *fontlist) {
if (fonts_ok(ret.lquote,
ret.fbase.fonts[FONT_NORMAL],
ret.fbase.fonts[FONT_EMPH],
+ ret.fbase.fonts[FONT_STRONG],
ret.ftitle.fonts[FONT_NORMAL],
ret.ftitle.fonts[FONT_EMPH],
+ ret.ftitle.fonts[FONT_STRONG],
ret.fchapter.fonts[FONT_NORMAL],
- ret.fchapter.fonts[FONT_EMPH], NULL) &&
+ ret.fchapter.fonts[FONT_EMPH],
+ ret.fchapter.fonts[FONT_STRONG], NULL) &&
fonts_ok(ret.rquote,
ret.fbase.fonts[FONT_NORMAL],
ret.fbase.fonts[FONT_EMPH],
+ ret.fbase.fonts[FONT_STRONG],
ret.ftitle.fonts[FONT_NORMAL],
ret.ftitle.fonts[FONT_EMPH],
+ ret.ftitle.fonts[FONT_STRONG],
ret.fchapter.fonts[FONT_NORMAL],
- ret.fchapter.fonts[FONT_EMPH], NULL)) {
+ ret.fchapter.fonts[FONT_EMPH],
+ ret.fchapter.fonts[FONT_STRONG], NULL)) {
for (n = 0; n < ret.nfsect; n++)
if (!fonts_ok(ret.lquote,
ret.fsect[n].fonts[FONT_NORMAL],
- ret.fsect[n].fonts[FONT_EMPH], NULL) ||
+ ret.fsect[n].fonts[FONT_EMPH],
+ ret.fsect[n].fonts[FONT_STRONG], NULL) ||
!fonts_ok(ret.rquote,
ret.fsect[n].fonts[FONT_NORMAL],
- ret.fsect[n].fonts[FONT_EMPH], NULL))
+ ret.fsect[n].fonts[FONT_EMPH],
+ ret.fsect[n].fonts[FONT_STRONG], NULL))
break;
if (n == ret.nfsect)
break;
@@ -1619,6 +1639,7 @@ static int paper_width_internal(void *vctx, word *word, int *nspaces)
findex = (style == word_Normal ? FONT_NORMAL :
style == word_Emph ? FONT_EMPH :
+ style == word_Strong ? FONT_STRONG :
FONT_CODE);
if (style == word_Code || style == word_WeakCode) flags |= RS_NOLIG;
@@ -2210,6 +2231,7 @@ static int render_text(page_data *page, para_data *pdata, line_data *ldata,
findex = (style == word_Normal ? FONT_NORMAL :
style == word_Emph ? FONT_EMPH :
+ style == word_Strong ? FONT_STRONG :
FONT_CODE);
if (style == word_Code || style == word_WeakCode) flags |= RS_NOLIG;
@@ -2640,14 +2662,17 @@ static void paper_rdaddw(rdstring *rs, word *text) {
case word_Normal:
case word_Emph:
+ case word_Strong:
case word_Code:
case word_WeakCode:
case word_WhiteSpace:
case word_EmphSpace:
+ case word_StrongSpace:
case word_CodeSpace:
case word_WkCodeSpace:
case word_Quote:
case word_EmphQuote:
+ case word_StrongQuote:
case word_CodeQuote:
case word_WkCodeQuote:
assert(text->type != word_CodeQuote &&
@@ -2656,6 +2681,10 @@ static void paper_rdaddw(rdstring *rs, word *text) {
(attraux(text->aux) == attr_First ||
attraux(text->aux) == attr_Only))
rdadd(rs, L'_'); /* FIXME: configurability */
+ else if (towordstyle(text->type) == word_Strong &&
+ (attraux(text->aux) == attr_First ||
+ attraux(text->aux) == attr_Only))
+ rdadd(rs, L'*'); /* FIXME: configurability */
else if (towordstyle(text->type) == word_Code &&
(attraux(text->aux) == attr_First ||
attraux(text->aux) == attr_Only))
@@ -2671,6 +2700,10 @@ static void paper_rdaddw(rdstring *rs, word *text) {
(attraux(text->aux) == attr_Last ||
attraux(text->aux) == attr_Only))
rdadd(rs, L'_'); /* FIXME: configurability */
+ else if (towordstyle(text->type) == word_Strong &&
+ (attraux(text->aux) == attr_Last ||
+ attraux(text->aux) == attr_Only))
+ rdadd(rs, L'*'); /* FIXME: configurability */
else if (towordstyle(text->type) == word_Code &&
(attraux(text->aux) == attr_Last ||
attraux(text->aux) == attr_Only))
diff --git a/bk_text.c b/bk_text.c
index 315317f..2a121e7 100644
--- a/bk_text.c
+++ b/bk_text.c
@@ -27,7 +27,7 @@ typedef struct {
word bullet;
wchar_t *lquote, *rquote, *rule;
char *filename;
- wchar_t *listsuffix, *startemph, *endemph;
+ wchar_t *listsuffix, *startemph, *endemph, *startstrong, *endstrong;
} textconfig;
typedef struct {
@@ -98,6 +98,8 @@ static textconfig text_configure(paragraph *source) {
ret.filename = dupstr("output.txt");
ret.startemph = L"_\0_\0\0";
ret.endemph = uadv(ret.startemph);
+ ret.startstrong = L"*\0*\0\0";
+ ret.endstrong = uadv(ret.startstrong);
ret.listsuffix = L".";
ret.charset = CS_ASCII;
/*
@@ -246,6 +248,11 @@ static textconfig text_configure(paragraph *source) {
ret.startemph = uadv(p->keyword);
ret.endemph = uadv(ret.startemph);
}
+ } else if (!ustricmp(p->keyword, L"text-strong")) {
+ if (*uadv(p->keyword) && *uadv(uadv(p->keyword))) {
+ ret.startstrong = uadv(p->keyword);
+ ret.endstrong = uadv(ret.startstrong);
+ }
} else if (!ustricmp(p->keyword, L"text-quotes")) {
if (*uadv(p->keyword) && *uadv(uadv(p->keyword))) {
ret.lquote = uadv(p->keyword);
@@ -273,6 +280,13 @@ static textconfig text_configure(paragraph *source) {
ret.endemph = uadv(ret.startemph);
}
+ while (*uadv(ret.endstrong) && *uadv(uadv(ret.endstrong)) &&
+ (!cvt_ok(ret.charset, ret.startstrong) ||
+ !cvt_ok(ret.charset, ret.endstrong))) {
+ ret.startstrong = uadv(ret.endstrong);
+ ret.endstrong = uadv(ret.startstrong);
+ }
+
while (*ret.atitle.underline && *uadv(ret.atitle.underline) &&
!cvt_ok(ret.charset, ret.atitle.underline))
ret.atitle.underline = uadv(ret.atitle.underline);
@@ -513,14 +527,17 @@ static void text_rdaddw(rdstring *rs, word *text, word *end, textconfig *cfg) {
case word_Normal:
case word_Emph:
+ case word_Strong:
case word_Code:
case word_WeakCode:
case word_WhiteSpace:
case word_EmphSpace:
+ case word_StrongSpace:
case word_CodeSpace:
case word_WkCodeSpace:
case word_Quote:
case word_EmphQuote:
+ case word_StrongQuote:
case word_CodeQuote:
case word_WkCodeQuote:
assert(text->type != word_CodeQuote &&
@@ -529,6 +546,10 @@ static void text_rdaddw(rdstring *rs, word *text, word *end, textconfig *cfg) {
(attraux(text->aux) == attr_First ||
attraux(text->aux) == attr_Only))
rdadds(rs, cfg->startemph);
+ else if (towordstyle(text->type) == word_Strong &&
+ (attraux(text->aux) == attr_First ||
+ attraux(text->aux) == attr_Only))
+ rdadds(rs, cfg->startstrong);
else if (towordstyle(text->type) == word_Code &&
(attraux(text->aux) == attr_First ||
attraux(text->aux) == attr_Only))
@@ -548,6 +569,10 @@ static void text_rdaddw(rdstring *rs, word *text, word *end, textconfig *cfg) {
(attraux(text->aux) == attr_Last ||
attraux(text->aux) == attr_Only))
rdadds(rs, cfg->endemph);
+ else if (towordstyle(text->type) == word_Strong &&
+ (attraux(text->aux) == attr_Last ||
+ attraux(text->aux) == attr_Only))
+ rdadds(rs, cfg->endstrong);
else if (towordstyle(text->type) == word_Code &&
(attraux(text->aux) == attr_Last ||
attraux(text->aux) == attr_Only))
@@ -586,22 +611,25 @@ static int text_width(void *ctx, word *text) {
wid = 0;
attr = towordstyle(text->type);
- if (attr == word_Emph || attr == word_Code) {
+ if (attr == word_Emph || attr == word_Strong || attr == word_Code) {
if (attraux(text->aux) == attr_Only ||
attraux(text->aux) == attr_First)
- wid += ustrwid(attr == word_Emph ? cfg->startemph : cfg->lquote,
- cfg->charset);
+ wid += ustrwid(attr == word_Emph ? cfg->startemph :
+ attr == word_Strong ? cfg->startstrong :
+ cfg->lquote, cfg->charset);
}
- if (attr == word_Emph || attr == word_Code) {
+ if (attr == word_Emph || attr == word_Strong || attr == word_Code) {
if (attraux(text->aux) == attr_Only ||
attraux(text->aux) == attr_Last)
- wid += ustrwid(attr == word_Emph ? cfg->startemph : cfg->lquote,
- cfg->charset);
+ wid += ustrwid(attr == word_Emph ? cfg->startemph :
+ attr == word_Strong ? cfg->startstrong :
+ cfg->lquote, cfg->charset);
}
switch (text->type) {
case word_Normal:
case word_Emph:
+ case word_Strong:
case word_Code:
case word_WeakCode:
if (cvt_ok(cfg->charset, text->text) || !text->alt)
@@ -612,10 +640,12 @@ static int text_width(void *ctx, word *text) {
case word_WhiteSpace:
case word_EmphSpace:
+ case word_StrongSpace:
case word_CodeSpace:
case word_WkCodeSpace:
case word_Quote:
case word_EmphQuote:
+ case word_StrongQuote:
case word_CodeQuote:
case word_WkCodeQuote:
assert(text->type != word_CodeQuote &&
diff --git a/bk_whlp.c b/bk_whlp.c
index 6fb1312..43d20b2 100644
--- a/bk_whlp.c
+++ b/bk_whlp.c
@@ -34,11 +34,13 @@ typedef struct {
enum {
FONT_NORMAL,
FONT_EMPH,
+ FONT_STRONG,
FONT_CODE,
FONT_ITAL_CODE,
FONT_BOLD_CODE,
FONT_TITLE,
FONT_TITLE_EMPH,
+ FONT_TITLE_STRONG,
FONT_TITLE_CODE,
FONT_RULE
};
@@ -174,6 +176,8 @@ void whlp_backend(paragraph *sourceform, keywordlist *keywords,
0, 0, 0, 0);
whlp_create_font(h, "Times New Roman", WHLP_FONTFAM_SERIF, 24,
WHLP_FONT_ITALIC, 0, 0, 0);
+ whlp_create_font(h, "Times New Roman", WHLP_FONTFAM_SERIF, 24,
+ WHLP_FONT_BOLD, 0, 0, 0);
whlp_create_font(h, "Courier New", WHLP_FONTFAM_FIXED, 24,
0, 0, 0, 0);
whlp_create_font(h, "Courier New", WHLP_FONTFAM_FIXED, 24,
@@ -184,6 +188,8 @@ void whlp_backend(paragraph *sourceform, keywordlist *keywords,
WHLP_FONT_BOLD, 0, 0, 0);
whlp_create_font(h, "Arial", WHLP_FONTFAM_SERIF, 30,
WHLP_FONT_BOLD|WHLP_FONT_ITALIC, 0, 0, 0);
+ whlp_create_font(h, "Arial", WHLP_FONTFAM_SERIF, 30,
+ WHLP_FONT_BOLD, 0, 0, 0);
whlp_create_font(h, "Courier New", WHLP_FONTFAM_FIXED, 30,
WHLP_FONT_BOLD, 0, 0, 0);
whlp_create_font(h, "Courier New", WHLP_FONTFAM_SANS, 18,
@@ -753,18 +759,23 @@ static void whlp_mkparagraph(struct bk_whlp_state *state,
case word_Normal:
case word_Emph:
+ case word_Strong:
case word_Code:
case word_WeakCode:
case word_WhiteSpace:
case word_EmphSpace:
+ case word_StrongSpace:
case word_CodeSpace:
case word_WkCodeSpace:
case word_Quote:
case word_EmphQuote:
+ case word_StrongQuote:
case word_CodeQuote:
case word_WkCodeQuote:
if (towordstyle(text->type) == word_Emph)
newfont = deffont + FONT_EMPH;
+ else if (towordstyle(text->type) == word_Strong)
+ newfont = deffont + FONT_STRONG;
else if (towordstyle(text->type) == word_Code ||
towordstyle(text->type) == word_WeakCode)
newfont = deffont + FONT_CODE;
@@ -808,14 +819,17 @@ static void whlp_rdaddwc(rdstringc *rs, word *text, whlpconf *conf,
case word_Normal:
case word_Emph:
+ case word_Strong:
case word_Code:
case word_WeakCode:
case word_WhiteSpace:
case word_EmphSpace:
+ case word_StrongSpace:
case word_CodeSpace:
case word_WkCodeSpace:
case word_Quote:
case word_EmphQuote:
+ case word_StrongQuote:
case word_CodeQuote:
case word_WkCodeQuote:
assert(text->type != word_CodeQuote &&
diff --git a/doc/input.but b/doc/input.but
index 8cf4b8a..137f399 100644
--- a/doc/input.but
+++ b/doc/input.but
@@ -94,6 +94,10 @@ sentence in this paragraph was generated using the Halibut input
\c Possibly the most obvious piece of formatting you might want
\c to use in a document is \e{emphasis}.
+A second form of emphasis is supported, called \i\s{strong} text. You
+can use the \i\c{\\s} command for this type of emphasis. Typically, in
+output formats, \c{\\e} will give italics, and \c{\\s} will give bold.
+
\S{input-code} \c{\\c} and \c{\\cw}: Displaying \i{computer code} inline
Halibut was primarily designed to produce software manuals. It can
@@ -111,8 +115,9 @@ the text accurately and conveniently).
Halibut provides \e{two} commands for this, which are subtly
different. The names of those commands are \i\c{\\c} (\q{code}) and
-\i\c{\\cw} (\q{\i{weak code}}). You use them just like \c{\\e}, by
-following them with some text in braces. For example, this...
+\i\c{\\cw} (\q{\i{weak code}}). You use them just like \c{\\e} and
+\c{\\s}, by following them with some text in braces. For example,
+this...
\c This sentence contains some \c{code} and some \cw{weak code}.
@@ -497,8 +502,8 @@ characters to escape.
Since a backslash inside a code paragraph generates a literal
backslash, this means you cannot use any other Halibut formatting
commands inside a code paragraph. In particular, if you want to
-emphasise a particular word in the paragraph, you can't do that
-using \c{\\e} (\k{input-emph}) in the normal way.
+emphasise or strengthen a particular word in the paragraph, you can't
+do that using \c{\\e} or \c{\\s} (\k{input-emph}) in the normal way.
Therefore, Halibut provides an alternative means of \i{emphasis in
code paragraphs}. Each line beginning with \c{\\c} can optionally be
@@ -1125,7 +1130,7 @@ This will cause the word \q{grep} to appear in code style, as if the
the word will also appear in code style in the actual index.
If you want to simultaneously index and emphasise a word, there's
-another special case \i\c{\\i\\e}:
+another special case \i\c{\\i\\e} (and similarly \i\c{\\i\\s}):
\c This is what we call a \i\e{paper jam}.
diff --git a/doc/output.but b/doc/output.but
index 49a6b05..47be785 100644
--- a/doc/output.but
+++ b/doc/output.but
@@ -263,6 +263,11 @@ in the \c{\\c} command (see \k{input-code}).
emphasised text (written using the \c{\\e} command; see
\k{input-emph}).
+\dt \I{\cw{\\cfg\{text-strong\}}}\cw{\\cfg\{text-strong\}\{}\e{start-strong}\cw{\}\{}\e{end-strong}\cw{\}}[\cw{\{}\e{start-strong}\cw{\}\{}\e{end-strong}...\cw{\}}]
+
+\dd This specifies the characters which should be used to surround
+strong text (written using the \c{\\s} command; see \k{input-emph}).
+
\lcont{
You should separately specify the start-emphasis and end-emphasis
@@ -1457,6 +1462,13 @@ multiple fallback options. Works exactly like the
\cw{\\cfg\{text-emphasis\}} directive (see
\k{output-text-characters}).
+\dt \I{\cw{\\cfg\{info-strong\}}}\cw{\\cfg\{info-strong\}\{}\e{start-strong}\cw{\}\{}\e{end-strong}\cw{\}}[\cw{\{}\e{start-strong}\cw{\}\{}\e{end-strong}...\cw{\}}]
+
+\dd Specifies how to display strong text. You can specify
+multiple fallback options. Works exactly like the
+\cw{\\cfg\{text-emphasis\}} directive (see
+\k{output-text-characters}).
+
\S{output-info-misc} Miscellaneous configuration options
\dt \I{\cw{\\cfg\{info-list-suffix\}}}\cw{\\cfg\{info-list-suffix\}\{}\e{text}\cw{\}}
@@ -1545,6 +1557,7 @@ The \i{default settings} for the Info output format are:
\c \cfg{info-rule}{\u2500}{-}
\c \cfg{info-quotes}{\u2018}{\u2019}{`}{'}
\c \cfg{info-emphasis}{_}{_}
+\c \cfg{info-strong}{*}{*}
\c
\c \cfg{info-list-suffix}{.}
diff --git a/halibut.h b/halibut.h
index c196c13..ec0ce34 100644
--- a/halibut.h
+++ b/halibut.h
@@ -146,16 +146,19 @@ enum {
/* ORDERING CONSTRAINT: these normal-word types ... */
word_Normal,
word_Emph,
+ word_Strong,
word_Code, /* monospaced; `quoted' in text */
word_WeakCode, /* monospaced, normal in text */
/* ... must be in the same order as these space types ... */
word_WhiteSpace, /* text is NULL or ignorable */
word_EmphSpace, /* WhiteSpace when emphasised */
+ word_StrongSpace, /* WhiteSpace when strong */
word_CodeSpace, /* WhiteSpace when code */
word_WkCodeSpace, /* WhiteSpace when weak code */
/* ... and must be in the same order as these quote types ... */
word_Quote, /* text is NULL or ignorable */
word_EmphQuote, /* Quote when emphasised */
+ word_StrongQuote, /* Quote when strong */
word_CodeQuote, /* (can't happen) */
word_WkCodeQuote, /* (can't happen) */
/* END ORDERING CONSTRAINT */
@@ -189,11 +192,12 @@ enum {
#define isvis(x) ( ( (x) >= word_Normal && (x) <= word_LowerXref ) )
#define isattr(x) ( ( (x) > word_Normal && (x) < word_WhiteSpace ) || \
( (x) > word_WhiteSpace && (x) < word_internal_endattrs ) )
-#define sameattr(x,y) ( (((x)-(y)) & 3) == 0 )
-#define towordstyle(x) ( word_Normal + ((x) & 3) )
-#define tospacestyle(x) ( word_WhiteSpace + ((x) & 3) )
-#define toquotestyle(x) ( word_Quote + ((x) & 3) )
-#define removeattr(x) ( word_Normal + ((x) &~ 3) )
+#define NATTRS (word_WhiteSpace - word_Normal)
+#define sameattr(x,y) ( (((x)-(y)) % NATTRS) == 0 )
+#define towordstyle(x) ( word_Normal + ((x) % NATTRS) )
+#define tospacestyle(x) ( word_WhiteSpace + ((x) % NATTRS) )
+#define toquotestyle(x) ( word_Quote + ((x) % NATTRS) )
+#define removeattr(x) ( word_Normal + ((x)/NATTRS * NATTRS) )
#define attraux(x) ( (x) & attr_mask )
#define quoteaux(x) ( (x) & quote_mask )
diff --git a/index.c b/index.c
index 1b03645..bdb8ba1 100644
--- a/index.c
+++ b/index.c
@@ -71,11 +71,11 @@ void index_merge(indexdata *idx, int is_explicit, wchar_t *tags, word *text,
word *w;
for (w = text; w; w = w->next) {
- if (w->type == word_Emph)
+ if (w->type == word_Emph || w->type == word_Strong)
w->type = word_Normal;
- else if (w->type == word_EmphSpace)
+ else if (w->type == word_EmphSpace || w->type == word_StrongSpace)
w->type = word_WhiteSpace;
- else if (w->type == word_EmphQuote)
+ else if (w->type == word_EmphQuote || w->type == word_StrongQuote)
w->type = word_Quote;
}
}
diff --git a/input.c b/input.c
index 1ec733c..61439b3 100644
--- a/input.c
+++ b/input.c
@@ -239,6 +239,7 @@ enum {
c_q, /* quote marks */
c_quote, /* block-quoted paragraphs */
c_rule, /* horizontal rule */
+ c_s, /* strong */
c_title, /* document title */
c_u, /* aux field is char code */
c_versionid /* document RCS id */
@@ -310,6 +311,7 @@ static void match_kw(token *tok) {
{"q", c_q}, /* quote marks */
{"quote", c_quote}, /* block-quoted paragraphs */
{"rule", c_rule}, /* horizontal rule */
+ {"s", c_s}, /* strong */
{"title", c_title}, /* document title */
{"versionid", c_versionid}, /* document RCS id */
{"{", c__escaped}, /* escaped lbrace (\{) */
@@ -692,6 +694,9 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx,
} else if (t.type == tok_cmd && t.cmd == c_e &&
wtype == word_WeakCode) {
wtype = word_Emph;
+ } else if (t.type == tok_cmd && t.cmd == c_s &&
+ wtype == word_WeakCode) {
+ wtype = word_Strong;
} else {
err_brokencodepara(&t.pos);
prev_para_type = par.type;
@@ -1380,15 +1385,17 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx,
dtor(t), t = get_token(in);
}
/*
- * Special cases: \W{}\c, \W{}\e, \W{}\cw
+ * Special cases: \W{}\c, \W{}\e, \W{}\s, \W{}\cw
*/
if (t.type == tok_cmd &&
- (t.cmd == c_e || t.cmd == c_c || t.cmd == c_cw)) {
+ (t.cmd == c_e || t.cmd == c_s ||
+ t.cmd == c_c || t.cmd == c_cw)) {
if (style != word_Normal)
err_nestedstyles(&t.pos);
else {
style = (t.cmd == c_c ? word_Code :
t.cmd == c_cw ? word_WeakCode :
+ t.cmd == c_s ? word_Strong :
word_Emph);
spcstyle = tospacestyle(style);
sitem->type |= stack_style;
@@ -1406,6 +1413,7 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx,
case c_c:
case c_cw:
case c_e:
+ case c_s:
type = t.cmd;
if (style != word_Normal) {
err_nestedstyles(&t.pos);
@@ -1422,6 +1430,7 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx,
} else {
style = (type == c_c ? word_Code :
type == c_cw ? word_WeakCode :
+ type == c_s ? word_Strong :
word_Emph);
spcstyle = tospacestyle(style);
sitem = snew(struct stack_item);
@@ -1448,16 +1457,18 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx,
sitem->type = stack_idx;
dtor(t), t = get_token(in);
/*
- * Special cases: \i\c, \i\e, \i\cw
+ * Special cases: \i\c, \i\e, \i\s, \i\cw
*/
wd.fpos = t.pos;
if (t.type == tok_cmd &&
- (t.cmd == c_e || t.cmd == c_c || t.cmd == c_cw)) {
+ (t.cmd == c_e || t.cmd == c_s ||
+ t.cmd == c_c || t.cmd == c_cw)) {
if (style != word_Normal)
err_nestedstyles(&t.pos);
else {
style = (t.cmd == c_c ? word_Code :
t.cmd == c_cw ? word_WeakCode :
+ t.cmd == c_s ? word_Strong :
word_Emph);
spcstyle = tospacestyle(style);
sitem->type |= stack_style;
diff --git a/inputs/test.but b/inputs/test.but
index dddc2dd..751ec1b 100644
--- a/inputs/test.but
+++ b/inputs/test.but
@@ -48,7 +48,7 @@ chapter title I can write before feeling silly.
This is a para\#{another{} comment}graph of text. It
has line\#{yet another one} breaks in between words, multiple
- spaces (ignored), and \e{emphasised text} as well as \c{code
+ spaces (ignored), \e{emphasised text} and \s{strong text} as well as \c{code
fragments}.
\#{This is an inline comment alone in a paragraph.}
@@ -248,8 +248,9 @@ u ú û ü ù _ v w x y ý ÿ ¥ z \u017e 0
\cfg{input-charset}{ASCII}
-Testing ligatures in normal (fi), empasised (\e{fi}), code (\c{fi}) and
-weak code (\cw{fi}). The latter two should not be ligated.
+Testing ligatures in normal (fi), emphasised (\e{fi}), strong
+(\s{fi}), code (\c{fi}) and weak code (\cw{fi}). The latter two should
+not be ligated.
\c Also in a code paragraph (fi) with bold (fi) and italic (fi).
\e bb ii
@@ -278,6 +279,11 @@ Similarly, we should support things like hyperlinks
and \e{in the \W{http://www.tartarus.org/}{middle} of them}, and also
\e{at the \W{http://home.att.net/~cecw/lastpage.htm}{end}}.
+Try that all over against with \c{\\s}: hyperlinks
+\s{\W{http://www.tartarus.org/}{at the beginning} of strong sections},
+and \s{in the \W{http://www.tartarus.org/}{middle} of them}, and also
+\s{at the \W{http://home.att.net/~cecw/lastpage.htm}{end}}.
+
Here's a hyperlink containing some special characters:
\W{http://a<b&c>d/}{here}. (Not that it'll \e{work}, but you can at
least determine that it's been correctly escaped by inspection of
diff --git a/misc.c b/misc.c
index 3f2483c..8a426f2 100644
--- a/misc.c
+++ b/misc.c
@@ -113,7 +113,7 @@ static int compare_wordlists_literally(word *a, word *b) {
return (a->type < b->type ? -1 : +1); /* FIXME? */
t = a->type;
if ((t != word_Normal && t != word_Code &&
- t != word_WeakCode && t != word_Emph) ||
+ t != word_WeakCode && t != word_Emph && t != word_Strong) ||
a->alt || b->alt) {
int c;
if (a->text && b->text) {
@@ -326,12 +326,14 @@ wrappedline *wrap_para(word *text, int width, int subsequentwidth,
wrapwords[nwords].end = text->next;
if (text->next && (text->next->type == word_WhiteSpace ||
text->next->type == word_EmphSpace ||
+ text->next->type == word_StrongSpace ||
text->breaks))
break;
text = text->next;
}
if (text && text->next && (text->next->type == word_WhiteSpace ||
- text->next->type == word_EmphSpace)) {
+ text->next->type == word_EmphSpace ||
+ text->next->type == word_StrongSpace)) {
wrapwords[nwords].spacewidth = widthfn(ctx, text->next);
text = text->next;
} else {
diff --git a/paper.h b/paper.h
index 652fa7e..5a27277 100644
--- a/paper.h
+++ b/paper.h
@@ -176,6 +176,7 @@ struct font_list_Tag {
enum {
FONT_NORMAL,
FONT_EMPH,
+ FONT_STRONG,
FONT_CODE,
NFONTS
};