guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: doc: Improve anchor collection.


From: guix-commits
Subject: branch master updated: doc: Improve anchor collection.
Date: Mon, 13 Apr 2020 06:31:48 -0400

This is an automated email from the git hooks/post-receive script.

civodul pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new deac7bf  doc: Improve anchor collection.
deac7bf is described below

commit deac7bf6ac7a943c9685949bf4dda7a2b1ba56c3
Author: Ludovic Courtès <address@hidden>
AuthorDate: Mon Apr 13 12:27:17 2020 +0200

    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.
---
 doc/build.scm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/build.scm b/doc/build.scm
index ca81d81..994b94e 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]