diff options
| author | Jacob Nevins <jacobn@chiark.greenend.org.uk> | 2007-01-31 23:32:12 +0000 |
|---|---|---|
| committer | Jacob Nevins <jacobn@chiark.greenend.org.uk> | 2007-01-31 23:32:12 +0000 |
| commit | 00a9dfeae70a670a881f1af41dbe32833dfa6dc5 (patch) | |
| tree | 8b84215e057776eb025179047ac2755986f521fa | |
| parent | b9c115fc173a1374e32453054a3b86c67934d604 (diff) | |
| download | halibut-00a9dfeae70a670a881f1af41dbe32833dfa6dc5.zip halibut-00a9dfeae70a670a881f1af41dbe32833dfa6dc5.tar.gz halibut-00a9dfeae70a670a881f1af41dbe32833dfa6dc5.tar.bz2 halibut-00a9dfeae70a670a881f1af41dbe32833dfa6dc5.tar.xz | |
Add an `Up' link to the HTML navigation bar of sufficiently deep documents.
(This doesn't affect any of the source texts I know about.)
Also add <link rel="up">, even in the cases where it's just the same as
<link rel="ToC">. (This does.)
[originally from svn r7193]
| -rw-r--r-- | bk_html.c | 34 | ||||
| -rw-r--r-- | doc/index.but | 3 | ||||
| -rw-r--r-- | doc/output.but | 7 |
3 files changed, 39 insertions, 5 deletions
@@ -61,7 +61,7 @@ typedef struct { char *body_tag, *nav_attr; wchar_t *author, *description; wchar_t *index_text, *contents_text, *preamble_text, *title_separator; - wchar_t *nav_prev_text, *nav_next_text, *nav_separator; + wchar_t *nav_prev_text, *nav_next_text, *nav_up_text, *nav_separator; wchar_t *index_main_sep, *index_multi_sep; wchar_t *pre_versionid, *post_versionid; int restrict_charset, output_charset; @@ -282,6 +282,7 @@ static htmlconfig html_configure(paragraph *source) { ret.title_separator = L" - "; ret.nav_prev_text = L"Previous"; ret.nav_next_text = L"Next"; + ret.nav_up_text = L"Up"; ret.nav_separator = L" | "; ret.index_main_sep = L": "; ret.index_multi_sep = L", "; @@ -494,6 +495,8 @@ static htmlconfig html_configure(paragraph *source) { ret.nav_prev_text = uadv(k); } else if (!ustricmp(k, L"html-nav-next-text")) { ret.nav_next_text = uadv(k); + } else if (!ustricmp(k, L"html-nav-up-text")) { + ret.nav_up_text = uadv(k); } else if (!ustricmp(k, L"html-nav-separator")) { ret.nav_separator = uadv(k); } else if (!ustricmp(k, L"html-index-main-separator")) { @@ -970,8 +973,6 @@ void html_backend(paragraph *sourceform, keywordlist *keywords, html_nl(&ho); } - /* FIXME: link rel="up" */ - if (f != files.head) { element_empty(&ho, "link"); element_attr(&ho, "rel", "ToC"); @@ -979,6 +980,17 @@ void html_backend(paragraph *sourceform, keywordlist *keywords, html_nl(&ho); } + if (conf.leaf_level > 0) { + htmlsect *p = f->first->parent; + assert(p == f->last->parent); + if (p) { + element_empty(&ho, "link"); + element_attr(&ho, "rel", "up"); + element_attr(&ho, "href", p->file->filename); + html_nl(&ho); + } + } + if (has_index && files.index && f != files.index) { element_empty(&ho, "link"); element_attr(&ho, "rel", "index"); @@ -1057,6 +1069,22 @@ void html_backend(paragraph *sourceform, keywordlist *keywords, if (f != files.head) element_close(&ho, "a"); + /* We don't bother with "Up" links for leaf-level 1, + * as they would be identical to the "Contents" links. */ + if (conf.leaf_level >= 2) { + htmlsect *p = f->first->parent; + assert(p == f->last->parent); + html_text(&ho, conf.nav_separator); + if (p) { + element_open(&ho, "a"); + element_attr(&ho, "href", p->file->filename); + } + html_text(&ho, conf.nav_up_text); + if (p) { + element_close(&ho, "a"); + } + } + if (has_index && files.index) { html_text(&ho, conf.nav_separator); if (f != files.index) { diff --git a/doc/index.but b/doc/index.but index e9d6e51..351e3d2 100644 --- a/doc/index.but +++ b/doc/index.but @@ -305,6 +305,9 @@ configuration directive \IM{\\cfg\{html-nav-next-text\}} \c{html-nav-next-text} configuration directive \IM{\\cfg\{html-nav-next-text\}} \cw{\\cfg\{html-nav-next-text\}} +\IM{\\cfg\{html-nav-up-text\}} \c{html-nav-up-text} configuration directive +\IM{\\cfg\{html-nav-up-text\}} \cw{\\cfg\{html-nav-up-text\}} + \IM{\\cfg\{html-nav-separator\}} \c{html-nav-separator} configuration directive \IM{\\cfg\{html-nav-separator\}} \cw{\\cfg\{html-nav-separator\}} diff --git a/doc/output.but b/doc/output.but index 0cea3c2..98637df 100644 --- a/doc/output.but +++ b/doc/output.but @@ -664,8 +664,10 @@ the index. \dt \I{\cw{\\cfg\{html-nav-next-text\}}}\cw{\\cfg\{html-nav-next-text\}\{}\e{text}\cw{\}} -\dd The text used for the \q{previous page} and \q{next page} links on -the navigation bar. +\dt \I{\cw{\\cfg\{html-nav-up-text\}}}\cw{\\cfg\{html-nav-up-text\}\{}\e{text}\cw{\}} + +\dd The text used for the \q{previous page}, \q{next page}, and \q{up} +links on the navigation bar. \dt \I{\cw{\\cfg\{html-nav-separator\}}}\cw{\\cfg\{html-nav-separator\}\{}\e{text}\cw{\}} @@ -965,6 +967,7 @@ The \i{default settings} for Halibut's HTML output format are: \c \cfg{html-post-versionid}{]} \c \cfg{html-nav-prev-text}{Previous} \c \cfg{html-nav-next-text}{Next} +\c \cfg{html-nav-up-text}{Up} \c \cfg{html-nav-separator}{ | } \c \c \cfg{html-output-charset}{ASCII} |