diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-08-25 21:50:01 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-08-25 21:50:01 -0700 |
commit | 366351ec32816b5076aedcc8b5f871c4bbad2690 (patch) | |
tree | ccc7acda6d317acdc6450742d6fa92f0726994af /genman.txr | |
parent | 1641dc6b1d54d5477fdd0c3be3aeaed3d699350f (diff) | |
download | txr-366351ec32816b5076aedcc8b5f871c4bbad2690.tar.gz txr-366351ec32816b5076aedcc8b5f871c4bbad2690.tar.bz2 txr-366351ec32816b5076aedcc8b5f871c4bbad2690.zip |
Fix wrong HTML references caused by identical section names.
For instance, both entries in the TOC titled "Overview"
navigate to the the same section when we click on them.
* genman.txr (tagnum): New hash for counting duplicate
occurrences of section title.
(enumerate): New function for adding numeric suffix
to titles which are the same as previously seen titles.
Diffstat (limited to 'genman.txr')
-rw-r--r-- | genman.txr | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -6,6 +6,7 @@ @(bind tagmap @(hash :equal-based)) @(do (defvar dupes (hash)) + (defvar tagnum (hash :equal-based)) (defun hash-title (title) (let* ((h (logtrunc (hash-equal title) 32)) @@ -16,7 +17,11 @@ (set [dupes h] title) (format nil "N-~,08X" h))) - (set [tagmap "lbAB"] (hash-title "NAME"))) + (set [tagmap "lbAB"] (hash-title "NAME")) + + (defun enumerate (title) + (let ((num (inc [tagnum title 0]))) + `@title@(if (> num 1) `-@num` "")`))) Content-type: text/html @(skip 15) <H1>TXR</H1> @@ -35,7 +40,7 @@ Content-type: text/html <H@level>@sec @title </H@level> @ (end) -@ (bind newtag @(hash-title title)) +@ (bind newtag @(hash-title (enumerate title))) @ (do (set [tagmap tag] newtag)) @ (output :into BODY) <A NAME="@newtag"> </A> |