X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/halibut/blobdiff_plain/03fcb340d22b423440633017f7e43dc89cd015e8..ccd787f7d03826c25b7aad2f239826c060766707:/bk_html.c diff --git a/bk_html.c b/bk_html.c index 23219be..7914024 100644 --- a/bk_html.c +++ b/bk_html.c @@ -540,6 +540,7 @@ void html_backend(paragraph *sourceform, keywordlist *keywords, sect->text = NULL; sect->type = INDEX; sect->parent = topsect; + sect->contents_depth = 0; html_file_section(&conf, &files, sect, 0); /* peer of chapters */ sect->fragment = utoa_dup(conf.index_text, CS_ASCII); sect->fragment = html_sanitise_fragment(&files, sect->file, @@ -825,6 +826,26 @@ void html_backend(paragraph *sourceform, keywordlist *keywords, if (conf.head_end) html_raw(&ho, conf.head_end); + /* + * Add any data defined in specific sections + * that go in this file. (This is mostly to allow tags for Mac online help.) + */ + for (s = sects.head; s; s = s->next) { + if (s->file == f && s->text) { + for (p = s->text; + p && (p == s->text || p->type == para_Title || + !is_heading_type(p->type)); + p = p->next) { + if (p->type == para_Config) { + if (!ustricmp(p->keyword, L"html-local-head")) { + html_raw(&ho, adv(p->origkeyword)); + } + } + } + } + } + element_close(&ho, "head"); html_nl(&ho); @@ -1604,8 +1625,12 @@ static void html_words(htmloutput *ho, word *words, int flags, case word_LowerXref: if (flags & LINKS) { keyword *kwl = kw_lookup(keywords, w->text); - paragraph *p = kwl->para; - htmlsect *s = (htmlsect *)p->private_data; + paragraph *p; + htmlsect *s; + + assert(kwl); + p = kwl->para; + s = (htmlsect *)p->private_data; assert(s); @@ -1963,6 +1988,7 @@ static char *html_format(paragraph *p, char *template_string) } else if (p->keyword && *p->keyword && fmt == 'k') ws = p->keyword; else + /* %N comes here; also failure cases of other fmts */ w = p->words; if (ws) {