summaryrefslogtreecommitdiff
path: root/bk_html.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2008-02-25 19:36:12 +0000
committerSimon Tatham <anakin@pobox.com>2008-02-25 19:36:12 +0000
commit0d791fb645abb77b339d90c95882ef315d1f912c (patch)
tree044b4b867dd171935db1c0a14981de1a9d714221 /bk_html.c
parent5527360cf7e5b68a1954874c82128690ed7df488 (diff)
downloadhalibut-0d791fb645abb77b339d90c95882ef315d1f912c.zip
halibut-0d791fb645abb77b339d90c95882ef315d1f912c.tar.gz
halibut-0d791fb645abb77b339d90c95882ef315d1f912c.tar.bz2
halibut-0d791fb645abb77b339d90c95882ef315d1f912c.tar.xz
New option *-section-shownumber, alongside *-section-numeric and in
both the back ends which currently support that, to leave out chapter and section numbers totally in section headings. Can be useful for publishing man pages (which don't normally want section numbers) on the web. [originally from svn r7892]
Diffstat (limited to 'bk_html.c')
-rw-r--r--bk_html.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/bk_html.c b/bk_html.c
index 0c66eb7..96f3083 100644
--- a/bk_html.c
+++ b/bk_html.c
@@ -37,7 +37,7 @@
(p)->type == para_Title ? -1 : 0 )
typedef struct {
- int just_numbers;
+ int number_at_all, just_numbers;
wchar_t *number_suffix;
} sectlevel;
@@ -248,10 +248,12 @@ static htmlconfig html_configure(paragraph *source) {
*/
ret.leaf_level = 2;
ret.achapter.just_numbers = FALSE;
+ ret.achapter.number_at_all = TRUE;
ret.achapter.number_suffix = L": ";
ret.nasect = 1;
ret.asect = snewn(ret.nasect, sectlevel);
ret.asect[0].just_numbers = TRUE;
+ ret.achapter.number_at_all = TRUE;
ret.asect[0].number_suffix = L" ";
ret.ncdepths = 0;
ret.contents_depths = 0;
@@ -382,6 +384,8 @@ static htmlconfig html_configure(paragraph *source) {
error(err_cfginsufarg, &p->fpos, p->origkeyword, 1);
} else if (!ustricmp(k, L"html-chapter-numeric")) {
ret.achapter.just_numbers = utob(uadv(k));
+ } else if (!ustricmp(k, L"html-chapter-shownumber")) {
+ ret.achapter.number_at_all = utob(uadv(k));
} else if (!ustricmp(k, L"html-suppress-navlinks")) {
ret.navlinks = !utob(uadv(k));
} else if (!ustricmp(k, L"html-rellinks")) {
@@ -411,6 +415,21 @@ static htmlconfig html_configure(paragraph *source) {
ret.nasect = n+1;
}
ret.asect[n].just_numbers = utob(q);
+ } else if (!ustricmp(k, L"html-section-shownumber")) {
+ wchar_t *q = uadv(k);
+ int n = 0;
+ if (uisdigit(*q)) {
+ n = utoi(q);
+ q = uadv(q);
+ }
+ if (n >= ret.nasect) {
+ int i;
+ ret.asect = sresize(ret.asect, n+1, sectlevel);
+ for (i = ret.nasect; i <= n; i++)
+ ret.asect[i] = ret.asect[ret.nasect-1];
+ ret.nasect = n+1;
+ }
+ ret.asect[n].number_at_all = utob(q);
} else if (!ustricmp(k, L"html-section-suffix")) {
wchar_t *q = uadv(k);
int n = 0;
@@ -2766,7 +2785,7 @@ static void html_section_title(htmloutput *ho, htmlsect *s, htmlfile *thisfile,
else
sl = &cfg->asect[cfg->nasect-1];
- if (!sl)
+ if (!sl || !sl->number_at_all)
number = NULL;
else if (sl->just_numbers)
number = s->title->kwtext2;