GNU bug report logs - #61306
[PATCH 0/5] Modernize the html engine

Previous Next

Package: skribilo;

Reported by: Arun Isaac <arunisaac <at> systemreboot.net>

Date: Mon, 6 Feb 2023 00:07:02 UTC

Severity: normal

Tags: patch

Done: Arun Isaac <arunisaac <at> systemreboot.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 61306 <at> debbugs.gnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: bug#61306: [PATCH 4/5] html: Use match instead of car and cdr.
Date: Mon,  6 Feb 2023 00:08:18 +0000
* src/guile/skribilo/engine/html.scm (toc): Use match instead of car
and cdr.
---
 src/guile/skribilo/engine/html.scm | 50 +++++++++++++++---------------
 1 file 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))
-- 
2.38.1





This bug report was last modified 2 years and 80 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.