From: simon Date: Sun, 20 Jun 2004 12:20:44 +0000 (+0000) Subject: Improve the naming of fragment IDs for numbered list elements and X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/halibut/commitdiff_plain/04781c84bdab91b4a1a05115be75830841359bc9 Improve the naming of fragment IDs for numbered list elements and bibliography entries. git-svn-id: svn://svn.tartarus.org/sgt/halibut@4305 cda61777-01e9-0310-a592-d414129be87e --- 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 and obsoleteness * of . * - * - 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