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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61306 in the body.
You can then email your comments to 61306 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to skribilo-bugs <at> nongnu.org:
bug#61306; Package skribilo. (Mon, 06 Feb 2023 00:07:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Arun Isaac <arunisaac <at> systemreboot.net>:
New bug report received and forwarded. Copy sent to skribilo-bugs <at> nongnu.org. (Mon, 06 Feb 2023 00:07:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: skribilo-bugs <at> nongnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [PATCH 0/5] Modernize the html engine
Date: Mon,  6 Feb 2023 00:06:26 +0000
This patchset adds a bunch of modernization fixes to the html
engine. Mainly:

- It removes br tags from various places. There is no need for br
  tags. Presentation should be handled in CSS. br tags insert unneeded
  unremovable space.

- Modernize code to use match and for-each.

Arun Isaac (5):
  html: Do not add br tag after chapter.
  html: Do not add br tag after section.
  html: Do not add br tags before footnotes.
  html: Use match instead of car and cdr.
  html: Use for-each instead of explicit loop.

 src/guile/skribilo/engine/html.scm | 99 +++++++++++++++---------------
 1 file changed, 48 insertions(+), 51 deletions(-)

-- 
2.38.1





Information forwarded to skribilo-bugs <at> nongnu.org:
bug#61306; Package skribilo. (Mon, 06 Feb 2023 00:09:02 GMT) Full text and rfc822 format available.

Message #8 received at 61306 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 61306 <at> debbugs.gnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [PATCH 2/5] html: Do not add br tag after section.
Date: Mon,  6 Feb 2023 00:08:16 +0000
* src/guile/skribilo/engine/html.scm (section): Do not br tag after.
---
 src/guile/skribilo/engine/html.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm
index 08a8eca..2ab5117 100644
--- a/src/guile/skribilo/engine/html.scm
+++ b/src/guile/skribilo/engine/html.scm
@@ -1368,7 +1368,7 @@
 (markup-writer 'section
    :options '(:title :html-title :number :toc :file :env)
    :before html-section-title
-   :after "</div><br>\n")
+   :after "</div>\n")
 
 ;; on-file section writer
 (markup-writer 'section
-- 
2.38.1





Information forwarded to skribilo-bugs <at> nongnu.org:
bug#61306; Package skribilo. (Mon, 06 Feb 2023 00:09:02 GMT) Full text and rfc822 format available.

Message #11 received at 61306 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 61306 <at> debbugs.gnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [PATCH 1/5] html: Do not add br tag after chapter.
Date: Mon,  6 Feb 2023 00:08:15 +0000
* src/guile/skribilo/engine/html.scm (chapter): Do not br tag after.
---
 src/guile/skribilo/engine/html.scm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm
index 51d8eec..08a8eca 100644
--- a/src/guile/skribilo/engine/html.scm
+++ b/src/guile/skribilo/engine/html.scm
@@ -2,7 +2,7 @@
 ;;;
 ;;; Copyright 2005, 2006, 2007, 2008, 2009, 2011, 2012, 2018, 2020  Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright 2003, 2004  Manuel Serrano
-;;; Copyright 2022 Arun Isaac <arunisaac <at> systemreboot.net>
+;;; Copyright 2022, 2023 Arun Isaac <arunisaac <at> systemreboot.net>
 ;;;
 ;;;
 ;;; This file is part of Skribilo.
@@ -1308,8 +1308,7 @@
 		 (output (html-container-number n e) e)
 		 (display " ")
 		 (output (markup-option n :title) e)
-		 (display "</h1></center>")))
-   :after "<br>")
+		 (display "</h1></center>"))))
 
 ;; This writer is invoked only for chapters rendered inside separate files!
 (markup-writer 'chapter
-- 
2.38.1





Information forwarded to skribilo-bugs <at> nongnu.org:
bug#61306; Package skribilo. (Mon, 06 Feb 2023 00:09:03 GMT) Full text and rfc822 format available.

Message #14 received at 61306 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 61306 <at> debbugs.gnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [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





Information forwarded to skribilo-bugs <at> nongnu.org:
bug#61306; Package skribilo. (Mon, 06 Feb 2023 00:09:03 GMT) Full text and rfc822 format available.

Message #17 received at 61306 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 61306 <at> debbugs.gnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [PATCH 3/5] html: Do not add br tags before footnotes.
Date: Mon,  6 Feb 2023 00:08:17 +0000
* src/guile/skribilo/engine/html.scm (&html-footnotes): Do not add br
tags before.
---
 src/guile/skribilo/engine/html.scm | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm
index 2ab5117..367eb3c 100644
--- a/src/guile/skribilo/engine/html.scm
+++ b/src/guile/skribilo/engine/html.scm
@@ -937,7 +937,6 @@
 	      (let ((footnotes (markup-body n)))
 		 (when (pair? footnotes)
 		    (display "<div class=\"skribilo-footnote\">")
-		    (display "<br><br>\n")
 		    (display "<hr width='20%' size='2' align='left'>\n"))))
    :action (lambda (n e)
 	      (let ((footnotes (markup-body n)))
-- 
2.38.1





Information forwarded to skribilo-bugs <at> nongnu.org:
bug#61306; Package skribilo. (Mon, 06 Feb 2023 00:09:04 GMT) Full text and rfc822 format available.

Message #20 received at 61306 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 61306 <at> debbugs.gnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [PATCH 5/5] html: Use for-each instead of explicit loop.
Date: Mon,  6 Feb 2023 00:08:19 +0000
* src/guile/skribilo/engine/html.scm (&html-footnotes): Use for-each
instead of explicit loop.
---
 src/guile/skribilo/engine/html.scm | 41 +++++++++++++++---------------
 1 file changed, 20 insertions(+), 21 deletions(-)

diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm
index e9293e6..da40475 100644
--- a/src/guile/skribilo/engine/html.scm
+++ b/src/guile/skribilo/engine/html.scm
@@ -939,27 +939,26 @@
 		    (display "<div class=\"skribilo-footnote\">")
 		    (display "<hr width='20%' size='2' align='left'>\n"))))
    :action (lambda (n e)
-	      (let ((footnotes (markup-body n)))
-		 (when (pair? footnotes)
-		    (let loop ((fns footnotes))
-		       (if (pair? fns)
-			   (let ((fn (car fns)))
-                              (display "\n<div class=\"footnote\">")
-
-                              ;; Note: the <a> tags must not be nested.
-			      (format #t "<a name=\"footnote-~a\"></a>"
-				      (string-canonicalize
-				       (container-ident fn)))
-                              (format #t "<a href=\"#footnote-site-~a\">"
-                                      (string-canonicalize
-                                       (container-ident fn)))
-                              (format #t "<sup><small>~a</small></sup></a>"
-                                      (markup-option fn :label))
-			      (output (markup-body fn) e)
-
-			      (display "\n</div>\n")
-			      (loop (cdr fns)))))
-		    (display "</div>")))))
+             (let ((footnotes (markup-body n)))
+               (for-each (lambda (fn)
+                           (display "\n<div class=\"footnote\">")
+
+                           ;; Note: the <a> tags must not be nested.
+
+			   (format #t "<a name=\"footnote-~a\"></a>"
+				   (string-canonicalize
+				    (container-ident fn)))
+                           (format #t "<a href=\"#footnote-site-~a\">"
+                                   (string-canonicalize
+                                    (container-ident fn)))
+                           (format #t "<sup><small>~a</small></sup></a>"
+                                   (markup-option fn :label))
+			   (output (markup-body fn) e)
+
+			   (display "\n</div>\n"))
+                         footnotes)
+               (when (pair? footnotes)
+                 (display "</div>")))))
 
 ;*---------------------------------------------------------------------*/
 ;*    html-title-authors ...                                           */
-- 
2.38.1





Reply sent to Arun Isaac <arunisaac <at> systemreboot.net>:
You have taken responsibility. (Tue, 28 Feb 2023 00:00:02 GMT) Full text and rfc822 format available.

Notification sent to Arun Isaac <arunisaac <at> systemreboot.net>:
bug acknowledged by developer. (Tue, 28 Feb 2023 00:00:03 GMT) Full text and rfc822 format available.

Message #25 received at 61306-done <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 61306-done <at> debbugs.gnu.org
Subject: Re: bug#61306: Acknowledgement ([PATCH 0/5] Modernize the html engine)
Date: Mon, 27 Feb 2023 23:59:41 +0000
Pushed!




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 28 Mar 2023 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 30 days ago.

Previous Next


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