X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/halibut/blobdiff_plain/b0fe32e877d8145d6cdb23981b46b3d37319acc8..2e032f926f6ad66ecc1546fe582430007bf05907:/bk_html.c diff --git a/bk_html.c b/bk_html.c index 433dde1..1d4aa5b 100644 --- a/bk_html.c +++ b/bk_html.c @@ -49,6 +49,7 @@ typedef struct { int address_section, visible_version_id; int leaf_contains_contents, leaf_smallest_contents; int navlinks; + int rellinks; char *contents_filename; char *index_filename; char *template_filename; @@ -259,6 +260,7 @@ static htmlconfig html_configure(paragraph *source) { ret.leaf_contains_contents = FALSE; ret.leaf_smallest_contents = 4; ret.navlinks = TRUE; + ret.rellinks = TRUE; ret.single_filename = dupstr("Manual.html"); ret.contents_filename = dupstr("Contents.html"); ret.index_filename = dupstr("IndexPage.html"); @@ -381,6 +383,8 @@ static htmlconfig html_configure(paragraph *source) { ret.achapter.just_numbers = utob(uadv(k)); } else if (!ustricmp(k, L"html-suppress-navlinks")) { ret.navlinks = !utob(uadv(k)); + } else if (!ustricmp(k, L"html-rellinks")) { + ret.rellinks = utob(uadv(k)); } else if (!ustricmp(k, L"html-chapter-suffix")) { ret.achapter.number_suffix = uadv(k); } else if (!ustricmp(k, L"html-leaf-level")) { @@ -957,6 +961,40 @@ void html_backend(paragraph *sourceform, keywordlist *keywords, element_close(&ho, "title"); html_nl(&ho); + if (conf.rellinks) { + + if (prevf) { + element_empty(&ho, "link"); + element_attr(&ho, "rel", "previous"); + element_attr(&ho, "href", prevf->filename); + html_nl(&ho); + } + + /* FIXME: link rel="up" */ + + if (f != files.head) { + element_empty(&ho, "link"); + element_attr(&ho, "rel", "ToC"); + element_attr(&ho, "href", files.head->filename); + html_nl(&ho); + } + + if (has_index && files.index && f != files.index) { + element_empty(&ho, "link"); + element_attr(&ho, "rel", "index"); + element_attr(&ho, "href", files.index->filename); + html_nl(&ho); + } + + if (f->next) { + element_empty(&ho, "link"); + element_attr(&ho, "rel", "next"); + element_attr(&ho, "href", f->next->filename); + html_nl(&ho); + } + + } + if (conf.head_end) html_raw(&ho, conf.head_end); @@ -1580,6 +1618,8 @@ void html_backend(paragraph *sourceform, keywordlist *keywords, /* * Output the MS HTML Help supporting files, if requested. + * + * A good unofficial reference for these is . */ if (conf.hhp_filename) { htmlfile *f; @@ -1599,6 +1639,8 @@ void html_backend(paragraph *sourceform, keywordlist *keywords, fprintf(ho.fp, "[OPTIONS]\n" + /* Binary TOC required for Next/Previous nav to work */ + "Binary TOC=Yes\n" "Compatibility=1.1 or later\n" "Compiled file=%s\n" "Default Window=main\n" @@ -1633,7 +1675,17 @@ void html_backend(paragraph *sourceform, keywordlist *keywords, NULL, keywords, &conf); fprintf(ho.fp, "\",\"%s\",\"%s\",\"%s\",,,,,," - "0x42520,,0x3876,,,,,,,,0\n", + /* This first magic number is fsWinProperties, controlling + * Navigation Pane options and the like. + * Constants HHWIN_PROP_* in htmlhelp.h. */ + "0x62520,," + /* This second number is fsToolBarFlags, mainly controlling + * toolbar buttons. Constants HHWIN_BUTTON_*. + * NOTE: there are two pairs of bits for Next/Previous + * buttons: 7/8 (which do nothing useful), and 21/22 + * (which work). (Neither of these are exposed in the HHW + * UI, but they work fine in HH.) We use the latter. */ + "0x60304e,,,,,,,,0\n", conf.hhc_filename ? conf.hhc_filename : "", hhk_filename ? hhk_filename : "", files.head->filename);