summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-06-20 12:20:44 +0000
committerSimon Tatham <anakin@pobox.com>2004-06-20 12:20:44 +0000
commite43b0f797c0fdf00b38fad69bbbf85a4b068cf9f (patch)
tree2ba145eb6f0bd53c219259632d689ac16bf36e03
parentbaa51f984c794aeada3bd2d2a290a5b7fff554e0 (diff)
downloadhalibut-e43b0f797c0fdf00b38fad69bbbf85a4b068cf9f.zip
halibut-e43b0f797c0fdf00b38fad69bbbf85a4b068cf9f.tar.gz
halibut-e43b0f797c0fdf00b38fad69bbbf85a4b068cf9f.tar.bz2
halibut-e43b0f797c0fdf00b38fad69bbbf85a4b068cf9f.tar.xz
Improve the naming of fragment IDs for numbered list elements and
bibliography entries. [originally from svn r4305]
-rw-r--r--bk_html.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/bk_html.c b/bk_html.c
index c58ecf1..5cd145e 100644
--- a/bk_html.c
+++ b/bk_html.c
@@ -31,11 +31,6 @@
* remaining confusion issues such as <?xml?> and obsoleteness
* of <a name>.
*
- * - proper naming of all fragment IDs. The ones for sections are
- * fine; the ones for numbered list and bibliociteds are utter
- * crap; the ones for indexes _might_ do but it might be worth
- * giving some thought to how to do them better.
- *
* - nonbreaking spaces.
*
* - free up all the data we have allocated while running this
@@ -561,13 +556,12 @@ void html_backend(paragraph *sourceform, keywordlist *keywords,
p->private_data = sect;
/*
- * FIXME: We need a much better means of naming
- * these, possibly involving an additional
- * configuration template. For the moment I'll just
- * invent something completely stupid.
+ * Fragment IDs for these paragraphs will simply be
+ * `p' followed by an integer.
*/
sect->fragment = snewn(40, char);
- sprintf(sect->fragment, "frag%p", sect);
+ sprintf(sect->fragment, "p%d",
+ sect->file->last_fragment_number++);
sect->fragment = html_sanitise_fragment(&files, sect->file,
sect->fragment);
}
@@ -575,6 +569,18 @@ void html_backend(paragraph *sourceform, keywordlist *keywords,
}
/*
+ * Reset the fragment numbers in each file. I've just used them
+ * to generate `p' fragment IDs for non-section paragraphs
+ * (numbered list elements, bibliocited), and now I want to use
+ * them for `i' fragment IDs for index entries.
+ */
+ {
+ htmlfile *file;
+ for (file = files.head; file; file = file->next)
+ file->last_fragment_number = 0;
+ }
+
+ /*
* Now sort out the index. This involves:
*
* - For each index term, we set up an htmlindex structure to