diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2020-04-13 12:27:17 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2020-04-13 12:28:41 +0200 |
| commit | deac7bf6ac7a943c9685949bf4dda7a2b1ba56c3 (patch) | |
| tree | d48432e05e93fc9b1565f13d056236ef0ec70fce | |
| parent | f6145358c7d33e73c0708bbe400e6e8e65512ef3 (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.
| -rw-r--r-- | doc/build.scm | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/doc/build.scm b/doc/build.scm index ca81d813a9c..994b94eae2f 100644 --- a/doc/build.scm +++ b/doc/build.scm | |||
| @@ -221,6 +221,7 @@ its <pre class=\"lisp\"> blocks (as produced by 'makeinfo --html')." | |||
| 221 | (syntax-highlight lexers) | 221 | (syntax-highlight lexers) |
| 222 | (guix build utils) | 222 | (guix build utils) |
| 223 | (srfi srfi-1) | 223 | (srfi srfi-1) |
| 224 | (srfi srfi-26) | ||
| 224 | (ice-9 match) | 225 | (ice-9 match) |
| 225 | (ice-9 threads) | 226 | (ice-9 threads) |
| 226 | (ice-9 vlist)) | 227 | (ice-9 vlist)) |
| @@ -358,9 +359,14 @@ its <pre class=\"lisp\"> blocks (as produced by 'makeinfo --html')." | |||
| 358 | (define (anchor-id->key id) | 359 | (define (anchor-id->key id) |
| 359 | ;; Convert ID, an anchor ID such as | 360 | ;; Convert ID, an anchor ID such as |
| 360 | ;; "index-pam_002dlimits_002dservice" to the corresponding key, | 361 | ;; "index-pam_002dlimits_002dservice" to the corresponding key, |
| 361 | ;; "pam-limits-service" in this example. | 362 | ;; "pam-limits-service" in this example. Drop the suffix of |
| 362 | (underscore-decode | 363 | ;; duplicate anchor IDs like "operating_002dsystem-1". |
| 363 | (string-drop id (string-length "index-")))) | 364 | (let ((id (if (any (cut string-suffix? <> id) |
| 365 | '("-1" "-2" "-3" "-4" "-5")) | ||
| 366 | (string-drop-right id 2) | ||
| 367 | id))) | ||
| 368 | (underscore-decode | ||
| 369 | (string-drop id (string-length "index-"))))) | ||
| 364 | 370 | ||
| 365 | (define* (collect-anchors file #:optional (vhash vlist-null)) | 371 | (define* (collect-anchors file #:optional (vhash vlist-null)) |
| 366 | ;; Collect the anchors that appear in FILE, a makeinfo-generated | 372 | ;; Collect the anchors that appear in FILE, a makeinfo-generated |
