(p)->type == para_Title ? -1 : 0 )
typedef struct {
- int just_numbers;
+ int number_at_all, just_numbers;
wchar_t *number_suffix;
} sectlevel;
*/
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;
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")) {
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;
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;
typedef enum { LEFT, LEFTPLUS, CENTRE } alignment;
typedef struct {
alignment align;
- int just_numbers;
+ int number_at_all, just_numbers;
wchar_t *underline;
wchar_t *number_suffix;
} alignstruct;
ret.bullet.alt = NULL;
ret.bullet.type = word_Normal;
ret.atitle.just_numbers = FALSE; /* ignored */
+ ret.atitle.number_at_all = TRUE; /* ignored */
/*
* Defaults.
ret.atitle.underline = L"\x2550\0=\0\0";
ret.achapter.align = LEFT;
ret.achapter.just_numbers = FALSE;
+ ret.achapter.number_at_all = TRUE;
ret.achapter.number_suffix = L": ";
ret.achapter.underline = L"\x203E\0-\0\0";
ret.nasect = 1;
ret.asect = snewn(ret.nasect, alignstruct);
ret.asect[0].align = LEFTPLUS;
ret.asect[0].just_numbers = TRUE;
+ ret.asect[0].number_at_all = TRUE;
ret.asect[0].number_suffix = L" ";
ret.asect[0].underline = L"\0";
ret.include_version_id = TRUE;
ret.achapter.underline = uadv(p->keyword);
} else if (!ustricmp(p->keyword, L"text-chapter-numeric")) {
ret.achapter.just_numbers = utob(uadv(p->keyword));
+ } else if (!ustricmp(p->keyword, L"text-chapter-shownumber")) {
+ ret.achapter.number_at_all = utob(uadv(p->keyword));
} else if (!ustricmp(p->keyword, L"text-chapter-suffix")) {
ret.achapter.number_suffix = uadv(p->keyword);
} else if (!ustricmp(p->keyword, L"text-section-align")) {
ret.nasect = n+1;
}
ret.asect[n].just_numbers = utob(q);
+ } else if (!ustricmp(p->keyword, L"text-section-shownumber")) {
+ wchar_t *q = uadv(p->keyword);
+ 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, alignstruct);
+ 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(p->keyword, L"text-section-suffix")) {
wchar_t *q = uadv(p->keyword);
int n = 0;
int firstlinewidth, wrapwidth;
wrappedline *wrapping, *p;
- if (align.just_numbers && nprefix) {
- text_rdaddw(&t, nprefix, NULL, cfg);
- rdadds(&t, align.number_suffix);
- } else if (!align.just_numbers && tprefix) {
- text_rdaddw(&t, tprefix, NULL, cfg);
- rdadds(&t, align.number_suffix);
+ if (align.number_at_all) {
+ if (align.just_numbers && nprefix) {
+ text_rdaddw(&t, nprefix, NULL, cfg);
+ rdadds(&t, align.number_suffix);
+ } else if (!align.just_numbers && tprefix) {
+ text_rdaddw(&t, tprefix, NULL, cfg);
+ rdadds(&t, align.number_suffix);
+ }
}
margin = length = ustrwid(t.text ? t.text : L"", cfg->charset);
chapter title. If you set this to \c{false}, chapter headings will
be prefixed by \q{Chapter} or equivalent.
+\dt \I{\cw{\\cfg\{text-chapter-shownumber\}}}\cw{\\cfg\{text-chapter-shownumber\}\{}\e{boolean}\cw{\}}
+
+\dd If this is set to \c{false}, then chapter headings will \e{only}
+contain the chapter title: they will not contain the word
+\q{Chapter} (or whatever other word you have defined in its place),
+and neither will they contain the chapter number. If set to
+\c{false}, this overrides \cw{\\cfg\{text-chapter-numeric\}}.
+
\dt \I{\cw{\\cfg\{text-chapter-suffix\}}}\cw{\\cfg\{text-chapter-suffix\}\{}\e{text}\cw{\}}
\dd This specifies the suffix text to be appended to the chapter
contain the word \q{Section} or equivalent (if \c{false}), or should
be numeric only (if \c{true}).
+\dt \I{\cw{\\cfg\{text-section-shownumber\}}}\cw{\\cfg\{text-section-shownumber\}\{}\e{level}\cw{\}\{}\e{boolean}\cw{\}}
+
+\dd If this is set to \c{false}, then section headings at the
+specified level will \e{only} contain the section title: they will
+not contain the word \q{Section} (or whatever other word you have
+defined in its place), and neither will they contain the section
+number. If set to \c{false}, this overrides
+\cw{\\cfg\{text-section-numeric\}}.
+
\dt \I{\cw{\\cfg\{text-section-suffix\}}}\cw{\\cfg\{text-section-suffix\}\{}\e{level}\cw{\}\{}\e{text}\cw{\}}
\dd Specifies the \I{suffix text, in section titles}suffix text to
\c \cfg{text-chapter-align}{left}
\c \cfg{text-chapter-underline}{\u203e}{-}
\c \cfg{text-chapter-numeric}{false}
+\c \cfg{text-chapter-shownumber}{true}
\c \cfg{text-chapter-suffix}{: }
\c
\c \cfg{text-section-align}{0}{leftplus}
\c \cfg{text-section-underline}{0}{}
\c \cfg{text-section-numeric}{0}{true}
+\c \cfg{text-section-shownumber}{0}{true}
\c \cfg{text-section-suffix}{0}{ }
\c
\c \cfg{text-section-align}{1}{leftplus}
\c \cfg{text-section-underline}{1}{}
\c \cfg{text-section-numeric}{1}{true}
+\c \cfg{text-section-shownumber}{1}{true}
\c \cfg{text-section-suffix}{1}{ }
\c
\c ... and so on for all section levels below this ...
chapter title. If you set this to \c{false}, chapter headings will
be prefixed by \q{Chapter} or equivalent.
+\dt \I{\cw{\\cfg\{html-chapter-shownumber\}}}\cw{\\cfg\{html-chapter-shownumber\}\{}\e{boolean}\cw{\}}
+
+\dd If this is set to \c{false}, then chapter headings will \e{only}
+contain the chapter title: they will not contain the word
+\q{Chapter} (or whatever other word you have defined in its place),
+and neither will they contain the chapter number. If set to
+\c{false}, this overrides \cw{\\cfg\{html-chapter-numeric\}}.
+
\dt \I{\cw{\\cfg\{html-chapter-suffix\}}}\cw{\\cfg\{html-chapter-suffix\}\{}\e{text}\cw{\}}
\dd This specifies the suffix text to be appended to the chapter
first-level headings (\c{\\H}), 1 means second-level headings
(\c{\\S}), 2 means the level below that (\c{\\S2}), and so on.
+\dt \I{\cw{\\cfg\{html-section-shownumber\}}}\cw{\\cfg\{html-section-shownumber\}\{}\e{level}\cw{\}\{}\e{boolean}\cw{\}}
+
+\dd If this is set to \c{false}, then section headings at the
+specified level will \e{only} contain the section title: they will
+not contain the word \q{Section} (or whatever other word you have
+defined in its place), and neither will they contain the section
+number. If set to \c{false}, this overrides
+\cw{\\cfg\{html-section-numeric\}}.
+
\dt \I{\cw{\\cfg\{html-section-suffix\}}}\cw{\\cfg\{html-section-suffix\}\{}\e{level}\cw{\}\{}\e{text}\cw{\}}
\# {level} can be omitted (defaults to 0). Is this intentional?
\c \cfg{html-navigation-attributes}{}
\c
\c \cfg{html-chapter-numeric}{false}
+\c \cfg{html-chapter-shownumber}{true}
\c \cfg{html-chapter-suffix}{: }
\c
\c \cfg{html-section-numeric}{0}{true}
+\c \cfg{html-section-shownumber}{0}{true}
\c \cfg{html-section-suffix}{0}{ }
\c
\c \cfg{html-section-numeric}{1}{true}
+\c \cfg{html-section-shownumber}{1}{true}
\c \cfg{html-section-suffix}{1}{ }
\c
\c ... and so on for all section levels below this ...