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.master
parent
4487e42cba
commit
bd4c345ef7
|
@ -221,6 +221,7 @@ its <pre class=\"lisp\"> blocks (as produced by 'makeinfo --html')."
|
||||||
(syntax-highlight lexers)
|
(syntax-highlight lexers)
|
||||||
(guix build utils)
|
(guix build utils)
|
||||||
(srfi srfi-1)
|
(srfi srfi-1)
|
||||||
|
(srfi srfi-26)
|
||||||
(ice-9 match)
|
(ice-9 match)
|
||||||
(ice-9 threads)
|
(ice-9 threads)
|
||||||
(ice-9 vlist))
|
(ice-9 vlist))
|
||||||
|
@ -358,9 +359,14 @@ its <pre class=\"lisp\"> blocks (as produced by 'makeinfo --html')."
|
||||||
(define (anchor-id->key id)
|
(define (anchor-id->key id)
|
||||||
;; Convert ID, an anchor ID such as
|
;; Convert ID, an anchor ID such as
|
||||||
;; "index-pam_002dlimits_002dservice" to the corresponding key,
|
;; "index-pam_002dlimits_002dservice" to the corresponding key,
|
||||||
;; "pam-limits-service" in this example.
|
;; "pam-limits-service" in this example. Drop the suffix of
|
||||||
(underscore-decode
|
;; duplicate anchor IDs like "operating_002dsystem-1".
|
||||||
(string-drop id (string-length "index-"))))
|
(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))
|
(define* (collect-anchors file #:optional (vhash vlist-null))
|
||||||
;; Collect the anchors that appear in FILE, a makeinfo-generated
|
;; Collect the anchors that appear in FILE, a makeinfo-generated
|
||||||
|
|
Reference in New Issue