diff options
| author | Simon Tatham <anakin@pobox.com> | 2004-04-09 18:43:02 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2004-04-09 18:43:02 +0000 |
| commit | 25f36b82c96a65175ace06ded180130ff60fa4d3 (patch) | |
| tree | 10128baa2247039d77a1d1b523497c9dcc4de7c1 /bk_info.c | |
| parent | a4782d9b40772389c3131a2f3c75009c2dd42ba3 (diff) | |
| download | halibut-25f36b82c96a65175ace06ded180130ff60fa4d3.zip halibut-25f36b82c96a65175ace06ded180130ff60fa4d3.tar.gz halibut-25f36b82c96a65175ace06ded180130ff60fa4d3.tar.bz2 halibut-25f36b82c96a65175ace06ded180130ff60fa4d3.tar.xz | |
Add a config directive to generate the INFO-DIR-ENTRY things that
appear to be used to automatically construct /usr/info/dir.
[originally from svn r4049]
Diffstat (limited to 'bk_info.c')
| -rw-r--r-- | bk_info.c | 55 |
1 files changed, 49 insertions, 6 deletions
@@ -3,10 +3,10 @@ * * TODO: * - * - basic vital configuration: Info dir entries in heading, and - * how to allocate node names + * - configurable choice of how to allocate node names * - escape, warn or simply remove commas and colons in node * names; also test colons in index terms. + * - might be helpful to diagnose duplicate node names too! * - test everything in info(1), and probably jed too * * Later: @@ -201,10 +201,8 @@ void info_backend(paragraph *sourceform, keywordlist *keywords, /* * An Info file begins with a piece of introductory text which * is apparently never shown anywhere. This seems to me to be a - * good place to put the copyright notice and the version IDs. - * - * FIXME: also Info directory entries are expected to go here. - * This will need to be a configurable thing of some sort. + * good place to put the copyright notice and the version IDs. + * Also, Info directory entries are expected to go here. */ rdaddsc(&intro_text, @@ -213,6 +211,51 @@ void info_backend(paragraph *sourceform, keywordlist *keywords, rdaddsc(&intro_text, "\n\n"); for (p = sourceform; p; p = p->next) + if (p->type == para_Config && + !ustricmp(p->keyword, L"info-dir-entry")) { + wchar_t *section, *shortname, *longname, *kw; + char *s; + + section = uadv(p->keyword); + shortname = *section ? uadv(section) : NULL; + longname = *shortname ? uadv(shortname) : NULL; + kw = *longname ? uadv(longname) : NULL; + + if (!*longname) { + error(err_infodirentry, &p->fpos); + continue; + } + + rdaddsc(&intro_text, "INFO-DIR-SECTION "); + s = utoa_dup(section); + rdaddsc(&intro_text, s); + sfree(s); + rdaddsc(&intro_text, "\nSTART-INFO-DIR-ENTRY\n* "); + s = utoa_dup(shortname); + rdaddsc(&intro_text, s); + sfree(s); + rdaddsc(&intro_text, ": ("); + s = dupstr(conf.filename); + if (strlen(s) > 5 && !strcmp(s+strlen(s)-5, ".info")) + s[strlen(s)-5] = '\0'; + rdaddsc(&intro_text, s); + sfree(s); + rdaddsc(&intro_text, ")"); + if (*kw) { + keyword *kwl = kw_lookup(keywords, kw); + if (kwl && kwl->para->private_data) { + node *n = (node *)kwl->para->private_data; + rdaddsc(&intro_text, n->name); + } + } + rdaddsc(&intro_text, ". "); + s = utoa_dup(longname); + rdaddsc(&intro_text, s); + sfree(s); + rdaddsc(&intro_text, "\nEND-INFO-DIR-ENTRY\n\n"); + } + + for (p = sourceform; p; p = p->next) if (p->type == para_Copyright) info_para(&intro_text, NULL, NULL, p->words, keywords, 0, 0, width); |