summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-04-10 12:55:06 +0000
committerSimon Tatham <anakin@pobox.com>2004-04-10 12:55:06 +0000
commit2847942a27c5e6c297f59f82b47b69e4abb3dc33 (patch)
tree13b0ca95f10e78f82bc76ae92c1ddd89f85cb253
parent662f8ee7b6ba45a226b2f11ebd35805a33651762 (diff)
downloadhalibut-2847942a27c5e6c297f59f82b47b69e4abb3dc33.zip
halibut-2847942a27c5e6c297f59f82b47b69e4abb3dc33.tar.gz
halibut-2847942a27c5e6c297f59f82b47b69e4abb3dc33.tar.bz2
halibut-2847942a27c5e6c297f59f82b47b69e4abb3dc33.tar.xz
The Emacs and Jed info readers don't like my index format: Info menu
items of the form `* stuff: Section 1.2.' are parsed by standalone info as `Section 1.2' followed by a period, but are parsed by other readers as `Section 1' followed by a period and then some spare text. Therefore, I've changed strategy, and the index is now full of *Note cross-references rather than menu items. On the plus side, this means there are no longer any special characters which we can't tolerate in an index entry; on the minus side, my shiny new infrastructure for tracking the filepos of index entries is now rendered pointless. I'll leave it in, though, since it may come in handy again. [originally from svn r4053]
-rw-r--r--bk_info.c48
-rw-r--r--error.c6
-rw-r--r--halibut.h1
3 files changed, 22 insertions, 33 deletions
diff --git a/bk_info.c b/bk_info.c
index d4179f2..23f8628 100644
--- a/bk_info.c
+++ b/bk_info.c
@@ -1,15 +1,28 @@
/*
* info backend for Halibut
*
- * TODO:
+ * Possible future work:
*
- * - configurable choice of how to allocate node names
- * - might be helpful to diagnose duplicate node names!
- * - test everything in info(1), and probably jed too
+ * - configurable indentation, bullets, emphasis, quotes etc?
*
- * Later:
+ * - configurable choice of how to allocate node names?
+ * + possibly a template-like approach, choosing node names to
+ * be the full section title or perhaps the internal keyword?
+ * + neither of those seems quite right. Perhaps instead a
+ * Windows Help-like mechanism, where a magic config
+ * directive allows user choice of name for every node.
+ * + Only trouble with that is, now what happens to the section
+ * numbers? Do they become completely vestigial and just sit
+ * in the title text of each node? Or do we keep them in the
+ * menus somehow? I think people might occasionally want to
+ * go to a section by number, if only because all the _other_
+ * formats of the same document will reference the numbers
+ * all the time. So our menu lines could look like one of
+ * these:
+ * * Nodename: Section 1.2. Title of section.
+ * * Section 1.2: Nodename. Title of section.
*
- * - configurable indentation, bullets, emphasis, quotes etc?
+ * - might be helpful to diagnose duplicate node names!
*/
#include <stdio.h>
@@ -182,28 +195,12 @@ void info_backend(paragraph *sourceform, keywordlist *keywords,
for (i = 0; (entry = index234(idx->entries, i)) != NULL; i++) {
info_idx *ii = mknew(info_idx);
rdstringc rs = { 0, 0, NULL };
- char *p, *q;
ii->nnodes = ii->nodesize = 0;
ii->nodes = NULL;
info_rdaddwc(&rs, entry->text, NULL, FALSE);
- /*
- * We cannot have colons in index terms, since they
- * disrupt the structure of the index menu. Remove any
- * that we find, with a warning.
- */
- p = q = rs.text;
- while (*p) {
- if (*p == ':') {
- error(err_infoindexcolon, &entry->fpos);
- } else {
- *q++ = *p;
- }
- p++;
- }
-
ii->text = rs.text;
entry->backend_data = ii;
@@ -422,7 +419,7 @@ void info_backend(paragraph *sourceform, keywordlist *keywords,
newnode->prev = currnode;
currnode->listnext = newnode;
- rdaddsc(&newnode->text, "Index\n-----\n\n* Menu:\n\n");
+ rdaddsc(&newnode->text, "Index\n-----\n\n");
info_menu_item(&topnode->text, newnode, NULL);
@@ -431,7 +428,6 @@ void info_backend(paragraph *sourceform, keywordlist *keywords,
for (j = 0; j < ii->nnodes; j++) {
int pos0 = newnode->text.pos;
- rdaddsc(&newnode->text, "* ");
/*
* When we have multiple references for a single
* index term, we only display the actual term on
@@ -442,9 +438,9 @@ void info_backend(paragraph *sourceform, keywordlist *keywords,
rdaddsc(&newnode->text, ii->text);
for (k = newnode->text.pos - pos0; k < index_width; k++)
rdaddc(&newnode->text, ' ');
- rdaddsc(&newnode->text, ": ");
+ rdaddsc(&newnode->text, " *Note ");
rdaddsc(&newnode->text, ii->nodes[j]->name);
- rdaddsc(&newnode->text, ".\n");
+ rdaddsc(&newnode->text, "::\n");
}
}
}
diff --git a/error.c b/error.c
index 3bfa78b..5f5cbda 100644
--- a/error.c
+++ b/error.c
@@ -208,12 +208,6 @@ static void do_error(int code, va_list ap) {
" parameters");
flags = FILEPOS;
break;
- case err_infoindexcolon:
- fpos = *va_arg(ap, filepos *);
- sprintf(error, "info output format does not support colons in"
- " index terms; removing");
- flags = FILEPOS;
- break;
case err_infonodechar:
fpos = *va_arg(ap, filepos *);
c = (char)va_arg(ap, int);
diff --git a/halibut.h b/halibut.h
index 24ad3a5..fd93408 100644
--- a/halibut.h
+++ b/halibut.h
@@ -219,7 +219,6 @@ enum {
err_misplacedlcont, /* \lcont not after a list item */
err_sectmarkerinblock, /* section marker appeared in block */
err_infodirentry, /* \cfg{info-dir-entry} missing param */
- err_infoindexcolon, /* colon in index term in info */
err_infonodechar, /* colon/comma in node name in info */
err_whatever /* random error of another type */
};