diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-12-14 22:03:50 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-12-14 22:03:50 -0800 |
commit | 237237b92d00ac9d15bbe01c7d13ec6fb0fb850c (patch) | |
tree | 0c71b49e34c5bf38bbc0d6788e5e1f409bc7539b /genman.txr | |
parent | c4f7b5ed5aca0bd61cae278b7081b5b998494229 (diff) | |
download | txr-237237b92d00ac9d15bbe01c7d13ec6fb0fb850c.tar.gz txr-237237b92d00ac9d15bbe01c7d13ec6fb0fb850c.tar.bz2 txr-237237b92d00ac9d15bbe01c7d13ec6fb0fb850c.zip |
HTML doc: fix back jumping flaw.
Issue: wrong [+] changes to [-], leading to
inconsistent state.
* genman.txr: In TOC extraction and transformation,
we fix the stupid broken <DT>....<DD> that man2html puts
out and turn it into <DT>...</DT>. This way a DL
now has a DT element as its previous sibling.
(tocjump): When we see a DL now, we get the correct
element which has the expand/collapse: the previous
sibling which is a DT containing the anchor.
Diffstat (limited to 'genman.txr')
-rw-r--r-- | genman.txr | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -74,8 +74,13 @@ Content-type: text/html @(collect :vars (TOC)) @ (some) @ (cases) +@ (cases) +<DT><A HREF="#@tag">@num @rest</A><DD> +@ (or) <DT><A HREF="#@tag">@num @rest -@ (bind TOC `<DT><A NAME="@(toc-tag num)" CLASS="tocanchor">@num</A> <A HREF="#@[tagmap tag]">@rest`) +</A><DD> +@ (end) +@ (bind TOC `<DT><A NAME="@(toc-tag num)" CLASS="tocanchor">@num</A> <A HREF="#@[tagmap tag]">@rest</A></DT>`) @ (or) <A NAME="index">@(skip) @ (output :into TOC) @@ -96,7 +101,7 @@ Content-type: text/html @ (do (mapdo (do unless [tgthash @1] (set [tgthash @1] [tagmap tag])) sym)) @ (and) -<DT><A HREF="#@tag">@num @rest +<DT><A HREF="#@tag">@num @nil <DL> @ (cat TOC) @ (bind pos @(car (search-regex TOC #/<A/))) @@ -193,10 +198,13 @@ function tocjump(hash) { if (ta.name == hash) { for (var e = ta.parentNode; e !== null; e = e.parentElement) { if (e.tagName == "DL") { - var atoggles = e.getElementsByClassName("toggle"); + var dt = e.previousElementSibling; e.style.display = ''; - if (atoggles.length > 0) - atoggles[0].innerHTML = '@opentxt'; + if (dt !== null) { + var atoggles = dt.getElementsByClassName("toggle"); + if (atoggles.length > 0) + atoggles[0].innerHTML = '@opentxt'; + } } } } |