From 366351ec32816b5076aedcc8b5f871c4bbad2690 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 25 Aug 2015 21:50:01 -0700 Subject: 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. --- genman.txr | 9 +++++++-- 1 file 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)

TXR

@@ -35,7 +40,7 @@ Content-type: text/html @sec @title @ (end) -@ (bind newtag @(hash-title title)) +@ (bind newtag @(hash-title (enumerate title))) @ (do (set [tagmap tag] newtag)) @ (output :into BODY)   -- cgit v1.2.3