typedef struct {
htmlsect *section;
char *fragment;
+ int generated, referenced;
} htmlindexref;
typedef struct {
htmlconfig *cfg);
static void html_section_title(htmloutput *ho, htmlsect *s,
htmlfile *thisfile, keywordlist *keywords,
- htmlconfig *cfg);
+ htmlconfig *cfg, int real);
static htmlconfig html_configure(paragraph *source) {
htmlconfig ret;
indextag *tag;
int i;
+ hr->referenced = hr->generated = FALSE;
hr->section = lastsect;
{
char buf[40];
element_attr(&ho, "name", s->fragment);
element_close(&ho, "a");
- html_section_title(&ho, s, f, keywords, &conf);
+ html_section_title(&ho, s, f, keywords, &conf, TRUE);
element_close(&ho, htag);
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);
}
/*
+ * 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.
*/
}
element_open(ho, "a");
element_attr(ho, "name", hr->fragment);
element_close(ho, "a");
+ hr->generated = TRUE;
}
break;
case word_Normal:
element_open(ho, "li");
html_href(ho, thisfile, s->file, s->fragment);
- html_section_title(ho, s, thisfile, keywords, cfg);
+ html_section_title(ho, s, thisfile, keywords, cfg, FALSE);
element_close(ho, "a");
element_close(ho, "li");
}
static void html_section_title(htmloutput *ho, htmlsect *s, htmlfile *thisfile,
- keywordlist *keywords, htmlconfig *cfg)
+ keywordlist *keywords, htmlconfig *cfg,
+ int real)
{
if (s->title) {
sectlevel *sl;
html_text(ho, sl->number_suffix);
}
- html_words(ho, s->title->words, MARKUP,
+ html_words(ho, s->title->words, real ? ALL : MARKUP,
thisfile, keywords, cfg);
} else {
assert(s->type != NORMAL);