mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
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.
This commit is contained in:
parent
f6145358c7
commit
deac7bf6ac
1 changed files with 9 additions and 3 deletions
|
@ -221,6 +221,7 @@ (define build
|
|||
(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 @@ (define (underscore-decode str)
|
|||
(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
|
||||
|
|
Loading…
Reference in a new issue