summaryrefslogtreecommitdiff
path: root/bk_html.c
diff options
context:
space:
mode:
Diffstat (limited to 'bk_html.c')
-rw-r--r--bk_html.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/bk_html.c b/bk_html.c
index bb98eb8..c58ecf1 100644
--- a/bk_html.c
+++ b/bk_html.c
@@ -136,6 +136,7 @@ typedef struct {
typedef struct {
htmlsect *section;
char *fragment;
+ int generated, referenced;
} htmlindexref;
typedef struct {
@@ -621,6 +622,7 @@ void html_backend(paragraph *sourceform, keywordlist *keywords,
indextag *tag;
int i;
+ hr->referenced = hr->generated = FALSE;
hr->section = lastsect;
{
char buf[40];
@@ -1223,6 +1225,7 @@ void html_backend(paragraph *sourceform, keywordlist *keywords,
html_href(&ho, f, hr->section->file,
hr->fragment);
+ hr->referenced = TRUE;
if (p && p->kwtext)
html_words(&ho, p->kwtext, MARKUP|LINKS,
f, keywords, &conf);
@@ -1314,6 +1317,23 @@ void html_backend(paragraph *sourceform, keywordlist *keywords,
}
/*
+ * Go through and check that no index fragments were referenced
+ * without being generated, or indeed vice versa.
+ *
+ * (When I actually get round to freeing everything, this can
+ * probably be the freeing loop as well.)
+ */
+ for (p = sourceform; p; p = p->next) {
+ word *w;
+ for (w = p->words; w; w = w->next)
+ if (w->type == word_IndexRef) {
+ htmlindexref *hr = (htmlindexref *)w->private_data;
+
+ assert(!hr->referenced == !hr->generated);
+ }
+ }
+
+ /*
* FIXME: Free all the working data.
*/
}
@@ -1471,6 +1491,7 @@ static void html_words(htmloutput *ho, word *words, int flags,
element_open(ho, "a");
element_attr(ho, "name", hr->fragment);
element_close(ho, "a");
+ hr->generated = TRUE;
}
break;
case word_Normal: