summaryrefslogtreecommitdiffstats
path: root/genman.txr
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-08-25 21:50:01 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-08-25 21:50:01 -0700
commit366351ec32816b5076aedcc8b5f871c4bbad2690 (patch)
treeccc7acda6d317acdc6450742d6fa92f0726994af /genman.txr
parent1641dc6b1d54d5477fdd0c3be3aeaed3d699350f (diff)
downloadtxr-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.txr9
1 files changed, 7 insertions, 2 deletions
diff --git a/genman.txr b/genman.txr
index 63130521..0fe17b7d 100644
--- a/genman.txr
+++ b/genman.txr
@@ -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">&nbsp;</A>