summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Nevins <jacobn@chiark.greenend.org.uk>2005-03-07 20:00:18 +0000
committerJacob Nevins <jacobn@chiark.greenend.org.uk>2005-03-07 20:00:18 +0000
commit80e2c3c940aeb3a0e97420c2e81fb137c7a370f0 (patch)
treee70305670d6c381df68cf3376ea172391d678226
parent1dd11fb9b97c2e9a663a67179c755c854d0c57ad (diff)
downloadhalibut-80e2c3c940aeb3a0e97420c2e81fb137c7a370f0.zip
halibut-80e2c3c940aeb3a0e97420c2e81fb137c7a370f0.tar.gz
halibut-80e2c3c940aeb3a0e97420c2e81fb137c7a370f0.tar.bz2
halibut-80e2c3c940aeb3a0e97420c2e81fb137c7a370f0.tar.xz
In contents lists, put <ul> inside <li> to make validator.w3.org happier (for
all HTML flavours). Also add newlines to the contents output so that the source is vaguely legible. Couple of extra comments in the code. [originally from svn r5453]
-rw-r--r--bk_html.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/bk_html.c b/bk_html.c
index 96092aa..c98d932 100644
--- a/bk_html.c
+++ b/bk_html.c
@@ -912,7 +912,7 @@ void html_backend(paragraph *sourceform, keywordlist *keywords,
prevf = f;
/*
- * Write out a prefix TOC for the file.
+ * Write out a prefix TOC for the file (if a leaf file).
*
* We start by going through the section list and
* collecting the sections which need to be added to
@@ -995,6 +995,12 @@ void html_backend(paragraph *sourceform, keywordlist *keywords,
*/
displaying = TRUE;
} else {
+ /*
+ * Doesn't belong in this file, but it may be
+ * a descendant of a section which does, in
+ * which case we should consider it for the
+ * main TOC of this file (for non-leaf files).
+ */
htmlsect *a, *ac;
int depth, adepth;
@@ -2071,13 +2077,24 @@ static void html_contents_entry(htmloutput *ho, int depth, htmlsect *s,
htmlfile *thisfile, keywordlist *keywords,
htmlconfig *cfg)
{
+ if (ho->contents_level >= depth && ho->contents_level > 0) {
+ element_close(ho, "li");
+ html_nl(ho);
+ }
+
while (ho->contents_level > depth) {
element_close(ho, "ul");
ho->contents_level--;
+ if (ho->contents_level > 0) {
+ element_close(ho, "li");
+ }
+ html_nl(ho);
}
while (ho->contents_level < depth) {
+ html_nl(ho);
element_open(ho, "ul");
+ html_nl(ho);
ho->contents_level++;
}
@@ -2088,7 +2105,7 @@ static void html_contents_entry(htmloutput *ho, int depth, htmlsect *s,
html_href(ho, thisfile, s->file, s->fragment);
html_section_title(ho, s, thisfile, keywords, cfg, FALSE);
element_close(ho, "a");
- element_close(ho, "li");
+ /* <li> will be closed by a later invocation */
}
static void html_section_title(htmloutput *ho, htmlsect *s, htmlfile *thisfile,