ret.lquote = uadv(p->keyword);
ret.rquote = uadv(ret.lquote);
}
+ } else if (!ustricmp(p->keyword, L"index")) {
+ ret.index_text = uadv(p->keyword);
+ } else if (!ustricmp(p->keyword, L"contents")) {
+ ret.contents_text = uadv(p->keyword);
}
}
}
wchar_t *lquote, *rquote;
wchar_t *sectsuffix, *underline;
wchar_t *rule;
+ wchar_t *index_text;
} infoconfig;
typedef struct {
static int info_rdaddwc(info_data *, word *, word *, int, infoconfig *);
static node *info_node_new(char *name, int charset);
-static char *info_node_name(paragraph *p, infoconfig *);
+static char *info_node_name_for_para(paragraph *p, infoconfig *);
+static char *info_node_name_for_text(wchar_t *text, infoconfig *);
static infoconfig info_configure(paragraph *source) {
infoconfig ret;
ret.rquote = uadv(ret.lquote);
ret.sectsuffix = L": ";
ret.underline = L"\x203E\0-\0\0";
+ ret.index_text = L"Index";
/*
* Two-pass configuration so that we can pick up global config
ret.lquote = uadv(p->keyword);
ret.rquote = uadv(ret.lquote);
}
+ } else if (!ustricmp(p->keyword, L"index")) {
+ ret.index_text = uadv(p->keyword);
}
}
}
node *newnode, *upnode;
char *nodename;
- nodename = info_node_name(p, &conf);
+ nodename = info_node_name_for_para(p, &conf);
newnode = info_node_new(nodename, conf.charset);
sfree(nodename);
node *newnode;
int i, j, k;
indexentry *entry;
+ char *nodename;
+
+ nodename = info_node_name_for_text(conf.index_text, &conf);
+ newnode = info_node_new(nodename, conf.charset);
+ sfree(nodename);
- newnode = info_node_new("Index", conf.charset);
newnode->up = topnode;
currnode->next = newnode;
newnode->prev = currnode;
currnode->listnext = newnode;
- info_rdaddsc(&newnode->text, "Index\n-----\n\n");
+ k = info_rdadds(&newnode->text, conf.index_text);
+ info_rdaddsc(&newnode->text, "\n");
+ while (k > 0) {
+ info_rdadds(&newnode->text, conf.underline);
+ k -= ustrwid(conf.underline, conf.charset);
+ }
+ info_rdaddsc(&newnode->text, "\n\n");
info_menu_item(&topnode->text, newnode, NULL, &conf);
return n;
}
-static char *info_node_name(paragraph *par, infoconfig *cfg)
+static char *info_node_name_core(info_data *id, filepos *fpos)
{
- info_data id = EMPTY_INFO_DATA;
char *p, *q;
- id.charset = cfg->charset;
- info_rdaddwc(&id, par->kwtext ? par->kwtext : par->words,
- NULL, FALSE, cfg);
- info_rdaddsc(&id, NULL);
-
/*
- * We cannot have commas or colons in a node name. Remove any
- * that we find, with a warning.
+ * We cannot have commas, colons or parentheses in a node name.
+ * Remove any that we find, with a warning.
*/
- p = q = id.output.text;
+ p = q = id->output.text;
while (*p) {
- if (*p == ':' || *p == ',') {
- error(err_infonodechar, &par->fpos, *p);
+ if (*p == ':' || *p == ',' || *p == '(' || *p == ')') {
+ error(err_infonodechar, fpos, *p);
} else {
*q++ = *p;
}
p++;
}
- *p = '\0';
+ *q = '\0';
+
+ return id->output.text;
+}
+
+static char *info_node_name_for_para(paragraph *par, infoconfig *cfg)
+{
+ info_data id = EMPTY_INFO_DATA;
+
+ id.charset = cfg->charset;
+ info_rdaddwc(&id, par->kwtext ? par->kwtext : par->words,
+ NULL, FALSE, cfg);
+ info_rdaddsc(&id, NULL);
+
+ return info_node_name_core(&id, &par->fpos);
+}
+
+static char *info_node_name_for_text(wchar_t *text, infoconfig *cfg)
+{
+ info_data id = EMPTY_INFO_DATA;
+
+ id.charset = cfg->charset;
+ info_rdadds(&id, text);
+ info_rdaddsc(&id, NULL);
- return id.output.text;
+ return info_node_name_core(&id, NULL);
}
static void info_menu_item(info_data *text, node *n, paragraph *p,
int pagenum_fontsize;
int footer_distance;
wchar_t *lquote, *rquote, *bullet;
+ wchar_t *contents_text, *index_text;
/* These are derived from the above */
int base_width;
int page_height;
ret.lquote = L"\x2018\0\x2019\0'\0'\0\0";
ret.rquote = uadv(ret.lquote);
ret.bullet = L"\x2022\0-\0\0";
+ ret.contents_text = L"Contents";
+ ret.index_text = L"Index";
/*
* Two-pass configuration so that we can pick up global config
ret.lquote = uadv(p->keyword);
ret.rquote = uadv(ret.lquote);
}
+ } else if (!ustricmp(p->keyword, L"contents")) {
+ ret.contents_text = uadv(p->keyword);
+ } else if (!ustricmp(p->keyword, L"index")) {
+ ret.index_text = uadv(p->keyword);
} else if (!ustricmp(p->keyword, L"paper-bullet")) {
ret.bullet = uadv(p->keyword);
} else if (!ustricmp(p->keyword, L"paper-page-width")) {
*/
{
word *contents_title;
- contents_title = fake_word(L"Contents");
+ contents_title = fake_word(conf->contents_text);
firstcont = make_para_data(para_UnnumberedChapter, 0, 0, 0,
NULL, NULL, contents_title, conf);
if (has_index) {
pdata = make_para_data(para_Normal, 0, 0,
conf->contents_margin,
- NULL, NULL, fake_word(L"Index"), conf);
+ NULL, NULL,
+ fake_word(conf->index_text), conf);
pdata->next = NULL;
pdata->contents_entry = &index_placeholder_para;
lastcont->next = pdata;
/*
* Create a set of paragraphs for the index.
*/
- index_title = fake_word(L"Index");
+ index_title = fake_word(conf->index_text);
firstidx = make_para_data(para_UnnumberedChapter, 0, 0, 0,
NULL, NULL, index_title, conf);
typedef struct {
int charset;
wchar_t *bullet, *lquote, *rquote, *titlepage, *sectsuffix, *listsuffix;
+ wchar_t *contents_text;
char *filename;
} whlpconf;
ret.rquote = uadv(ret.lquote);
ret.filename = dupstr("output.hlp");
ret.titlepage = L"Title page";
+ ret.contents_text = L"Contents";
ret.sectsuffix = L": ";
ret.listsuffix = L".";
ret.lquote = uadv(p->keyword);
ret.rquote = uadv(ret.lquote);
}
+ } else if (!ustricmp(p->keyword, L"contents")) {
+ ret.contents_text = uadv(p->keyword);
}
}
}
/* ------------------------------------------------------------------
* Begin the contents page.
*/
-
- whlp_begin_topic(h, contents_topic, "Contents", "DB(\"btn_up\")", NULL);
- state.curr_topic = contents_topic;
+ {
+ rdstringc rs = {0, 0, NULL};
+ whlp_rdadds(&rs, conf.contents_text, &conf, NULL);
+ whlp_begin_topic(h, contents_topic, rs.text, "DB(\"btn_up\")", NULL);
+ state.curr_topic = contents_topic;
+ sfree(rs.text);
+ }
/*
* The manual title goes in the non-scroll region, and also
\dd Exactly like \c{chapter}, but changes the name given to
appendices.
+\dt \I\cw{\\cfg\{contents\}}\cw{\\cfg\{contents\}\{}\e{new contents name}\cw{\}}
+
+\dd This changes the name given to the contents section (by default
+\q{Contents}) in back ends which generate one.
+
+\dt \I\cw{\\cfg\{index\}}\cw{\\cfg\{index\}\{}\e{new index name}\cw{\}}
+
+\dd This changes the name given to the index section (by default
+\q{Index}) in back ends which generate one.
+
\dt \I\cw{\\cfg\{input-charset\}}\cw{\\cfg\{input-charset\}\{}\e{character set name}\cw{\}}
\dd This tells Halibut what \i{character set} you are writing your
\c \cfg{chapter}{Chapter}
\c \cfg{section}{Section}
\c \cfg{appendix}{Appendix}
+\c \cfg{contents}{Contents}
+\c \cfg{index}{Index}
\c \cfg{input-charset}{ASCII}
The default for \cw{\\cfg\{input-charset\}} can be changed with the
the first chapter heading), contents, and index respectively, in the
navigation bar, contents, and index.
+\lcont{
+
+(\c{html-contents-text} and \c{html-index-text} override the
+cross-format configuration keywords \c{contents} and \c{index} (see
+\k{input-config}, if both appear. They are legacy keywords preserved
+for backwards compatibility; you should generally use \c{contents}
+and \c{index}.)
+
+}
+
\dt \I{\cw{\\cfg\{html-title-separator\}}}\cw{\\cfg\{html-title-separator\}\{}\e{text}\cw{\}}
\dd If multiple headings are used in a file's \cw{<TITLE>} tag, this
int i, j;
char *sp, *sp2;
wchar_t *wsp, *wsp2;
- filepos fpos, fpos2;
+ filepos fpos, fpos2, *fposp;
int flags;
switch(code) {
flags = FILEPOS;
break;
case err_infonodechar:
- fpos = *va_arg(ap, filepos *);
+ fposp = va_arg(ap, filepos *);
c = (char)va_arg(ap, int);
sprintf(error, "info output format does not support '%c' in"
" node names; removing", c);
- flags = FILEPOS;
+ if (fposp) {
+ flags = FILEPOS;
+ fpos = *fposp;
+ }
break;
case err_text_codeline:
fpos = *va_arg(ap, filepos *);
document}{sub-sub}
\cfg{man-headnumbers}{true}
+\cfg{contents}{Contents(edited)}
+\cfg{index}{Index(alsoedited)}
+
This paragraph is not labelled \q{preamble}, but should still appear
as it.