aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2023-01-28 12:25:40 +0000
committerArun Isaac2023-02-06 00:04:00 +0000
commitcb41281bc88790605383be498bf5e10d360a043e (patch)
tree0424f6bd5c2a99f6cef624d08be9c6a0413f3890
parent6a8546e82618e24c2601c083b0532997613f486e (diff)
downloadskribilo-cb41281bc88790605383be498bf5e10d360a043e.tar.gz
skribilo-cb41281bc88790605383be498bf5e10d360a043e.tar.lz
skribilo-cb41281bc88790605383be498bf5e10d360a043e.zip
html: Use match instead of car and cdr.
* src/guile/skribilo/engine/html.scm (toc): Use match instead of car and cdr.
-rw-r--r--src/guile/skribilo/engine/html.scm50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm
index 367eb3c..e9293e6 100644
--- a/src/guile/skribilo/engine/html.scm
+++ b/src/guile/skribilo/engine/html.scm
@@ -1089,34 +1089,34 @@
(display "<td></td>")
(loop (+ i 1))))))
(define (toc-entry fe level)
- (let* ((c (car fe))
- (ch (cdr fe))
- (id (markup-ident c))
- (f (html-file c e)))
- (unless (string? id)
+ (match fe
+ ((c ch ...)
+ (let ((id (markup-ident c))
+ (f (html-file c e)))
+ (unless (string? id)
(skribe-error 'toc
(format #f "invalid identifier '~a'" id)
c))
- (display " <tr>")
- ;; blank columns
- (col level)
- ;; number
- (format #t "<td valign=\"top\" align=\"left\">~a</td>"
- (html-container-number c e))
- ;; title
- (format #t "<td colspan=\"~a\" width=\"100%\">"
- (- 4 level))
- (format #t "<a href=\"~a#~a\">"
- (if (and (*destination-file*)
- (string=? f (*destination-file*)))
- ""
- (strip-ref-base (or f (*destination-file*) "")))
- (string-canonicalize id))
- (output (markup-option c :title) e)
- (display "</a></td>")
- (display "</tr>\n")
- ;; the children
- (for-each (lambda (n) (toc-entry n (+ 1 level))) ch)))
+ (display " <tr>")
+ ;; blank columns
+ (col level)
+ ;; number
+ (format #t "<td valign=\"top\" align=\"left\">~a</td>"
+ (html-container-number c e))
+ ;; title
+ (format #t "<td colspan=\"~a\" width=\"100%\">"
+ (- 4 level))
+ (format #t "<a href=\"~a#~a\">"
+ (if (and (*destination-file*)
+ (string=? f (*destination-file*)))
+ ""
+ (strip-ref-base (or f (*destination-file*) "")))
+ (string-canonicalize id))
+ (output (markup-option c :title) e)
+ (display "</a></td>")
+ (display "</tr>\n")
+ ;; the children
+ (for-each (lambda (n) (toc-entry n (+ 1 level))) ch)))))
(let* ((c (markup-option n :chapter))
(s (markup-option n :section))