[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/06: doc: Avoid invalid 'match' pattern in 'syntax-highlighted-html'.
From: |
guix-commits |
Subject: |
05/06: doc: Avoid invalid 'match' pattern in 'syntax-highlighted-html'. |
Date: |
Tue, 14 Apr 2020 10:02:22 -0400 (EDT) |
civodul pushed a commit to branch version-1.1.0
in repository guix.
commit 4487e42cba15110bce91d729b3e964f62347ed50
Author: Ludovic Courtès <address@hidden>
AuthorDate: Mon Apr 13 02:09:09 2020 +0200
doc: Avoid invalid 'match' pattern in 'syntax-highlighted-html'.
This is a followup to da9deba13d551e316f5a99a614834efa27ddc7d1.
Last-minute modification of the 'match' pattern would lead to an error:
"multiple ellipsis patterns not allowed at same level"
* doc/build.scm (syntax-highlighted-html)[build](collect-anchors):
Add 'worthy-entry?' procedure and use it instead of the unsupported
pattern for ('dt ...).
---
doc/build.scm | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/doc/build.scm b/doc/build.scm
index c3d61f8..ca81d81 100644
--- a/doc/build.scm
+++ b/doc/build.scm
@@ -373,17 +373,26 @@ its <pre class=\"lisp\"> blocks (as produced by 'makeinfo
--html')."
(('*ENTITY* _ ...) #t)
(_ #f)))
+ (define (worthy-entry? lst)
+ ;; Attempt to match:
+ ;; Scheme Variable: <strong>x</strong>
+ ;; but not:
+ ;; <code>cups-configuration</code> parameter: …
+ (let loop ((lst lst))
+ (match lst
+ (((? string-or-entity?) rest ...)
+ (loop rest))
+ ((('strong _ ...) _ ...)
+ #t)
+ (_ #f))))
+
(let ((shtml (call-with-input-file file html->shtml)))
(let loop ((shtml shtml)
(vhash vhash))
(match shtml
- ;; Attempt to match:
- ;; <dt>Scheme Variable: <strong>x</strong></dt>
- ;; but not:
- ;; <dt><code>cups-configuration</code> parameter: …</dt>
- (('dt ('@ ('id id))
- (? string-or-entity?) ... ('strong _ ...) _ ...)
- (if (string-prefix? "index-" id)
+ (('dt ('@ ('id id)) rest ...)
+ (if (and (string-prefix? "index-" id)
+ (worthy-entry? rest))
(vhash-cons (anchor-id->key id)
(string-append (basename file)
"#" id)
- branch version-1.1.0 updated (0ad60b2 -> bd4c345), guix-commits, 2020/04/14
- 01/06: maint: Actually check for the availablility of system packages., guix-commits, 2020/04/14
- 02/06: maint: Ensure substitutes are available for '%default-xorg-modules'., guix-commits, 2020/04/14
- 03/06: weather: Delete duplicate entries coming from '--manifest'., guix-commits, 2020/04/14
- 05/06: doc: Avoid invalid 'match' pattern in 'syntax-highlighted-html'.,
guix-commits <=
- 04/06: doc: Emit hyperlinks in HTML output for @lisp snippets., guix-commits, 2020/04/14
- 06/06: doc: Improve anchor collection., guix-commits, 2020/04/14