summaryrefslogtreecommitdiff
path: root/doc/build.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-04-13 12:27:17 +0200
committerLudovic Courtès <ludo@gnu.org>2020-04-13 12:28:41 +0200
commitdeac7bf6ac7a943c9685949bf4dda7a2b1ba56c3 (patch)
treed48432e05e93fc9b1565f13d056236ef0ec70fce /doc/build.scm
parentf6145358c7d33e73c0708bbe400e6e8e65512ef3 (diff)
doc: Improve anchor collection.
This allows us to catch "operating_002dsystem-1", for instance. * doc/build.scm (syntax-highlighted-html)[build](anchor-id->key): Drop "-1" & co. from ID.
Diffstat (limited to 'doc/build.scm')
-rw-r--r--doc/build.scm12
1 files changed, 9 insertions, 3 deletions
diff --git a/doc/build.scm b/doc/build.scm
index ca81d813a9..994b94eae2 100644
--- a/doc/build.scm
+++ b/doc/build.scm
@@ -221,6 +221,7 @@ its <pre class=\"lisp\"> blocks (as produced by 'makeinfo --html')."
(syntax-highlight lexers)
(guix build utils)
(srfi srfi-1)
+ (srfi srfi-26)
(ice-9 match)
(ice-9 threads)
(ice-9 vlist))
@@ -358,9 +359,14 @@ its <pre class=\"lisp\"> blocks (as produced by 'makeinfo --html')."
(define (anchor-id->key id)
;; Convert ID, an anchor ID such as
;; "index-pam_002dlimits_002dservice" to the corresponding key,
- ;; "pam-limits-service" in this example.
- (underscore-decode
- (string-drop id (string-length "index-"))))
+ ;; "pam-limits-service" in this example. Drop the suffix of
+ ;; duplicate anchor IDs like "operating_002dsystem-1".
+ (let ((id (if (any (cut string-suffix? <> id)
+ '("-1" "-2" "-3" "-4" "-5"))
+ (string-drop-right id 2)
+ id)))
+ (underscore-decode
+ (string-drop id (string-length "index-")))))
(define* (collect-anchors file #:optional (vhash vlist-null))
;; Collect the anchors that appear in FILE, a makeinfo-generated