bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#43166: The issues.guix.gnu.org is hard to read in emacs-w3m.


From: Ricardo Wurmus
Subject: bug#43166: The issues.guix.gnu.org is hard to read in emacs-w3m.
Date: Tue, 15 Sep 2020 03:06:38 +0200
User-agent: mu4e 1.4.13; emacs 27.1

The attached patch seems to fix the worst problems.

I’m marking up each line in a message with a “span” tag and a “line”
class; then I use CSS to visually separate the lines.  Simple browsers
that don’t support this CSS rely on “span” to be an inline tag; likewise
they rely on “div” to be a block tag, no matter what the CSS might say.

So the attached patch changes the tag from “span” to “div”, so simple
browsers will render each line on their own instead of joining them.
This seems to have no negative impact on the rendering in other
browsers.  It also shouldn’t be a problem going forward, as popular
powerful browsers allow me to style these “div” tags without
limitations.

What do you think?

-- 
Ricardo


diff --git a/assets/css/screen.css b/assets/css/screen.css
index 684bc01..5d8513d 100644
--- a/assets/css/screen.css
+++ b/assets/css/screen.css
@@ -353,28 +353,28 @@ details {
     display: none;
 }
 
-.message span.line {
+.message div.line {
     white-space: pre-wrap;
     font-family: monospace;
     display: block;
 }
 
 /* diff styles */
-.message .diff span.line.diff.file {
+.message .diff div.line.diff.file {
     color: #005cc5;
 }
-.message .diff span.line.diff.separator {
+.message .diff div.line.diff.separator {
     color: #005cc5;
 }
-.message .diff span.line.diff.addition {
+.message .diff div.line.diff.addition {
     color: #22863a;
     background-color: #f0fff4;
 }
-.message .diff span.line.diff.deletion {
+.message .diff div.line.diff.deletion {
     color: #b31d28;
     background-color: #ffeef0;
 }
-.message .diff span.line.diff.range {
+.message .diff div.line.diff.range {
     color: #6f42c1;
     font-weight: bold;
 }
@@ -394,7 +394,7 @@ details {
 }
 
 /* quote styles */
-.message .quote span.line {
+.message .quote div.line {
     color: #3868cc;
 }
 
diff --git a/mumi/web/view/utils.scm b/mumi/web/view/utils.scm
index 3c95644..4a4ecb0 100644
--- a/mumi/web/view/utils.scm
+++ b/mumi/web/view/utils.scm
@@ -68,7 +68,7 @@ with the next context."
        (if (string-prefix? "--8<---------------cut here" line)
            (values blocks #f)
            (values (cons (add-block-line! block
-                                          `(span (@ (class "line")) ,line))
+                                          `(div (@ (class "line")) ,line))
                          other-blocks)
                    context)))
       ((eq? context 'diff)
@@ -79,17 +79,17 @@ with the next context."
            (let ((formatted-line
                   (cond
                    ((string= "---" line)
-                    `(span (@ (class "line diff separator")) ,line))
+                    `(div (@ (class "line diff separator")) ,line))
                    ((string-prefix? "+" line)
-                    `(span (@ (class "line diff addition")) ,line))
+                    `(div (@ (class "line diff addition")) ,line))
                    ((and (string-prefix? "-" line)
                          (not (string= "--" line))
                          (not (string= "-- " line)))
-                    `(span (@ (class "line diff deletion")) ,line))
+                    `(div (@ (class "line diff deletion")) ,line))
                    ((string-prefix? "@@" line)
-                    `(span (@ (class "line diff range")) ,line))
+                    `(div (@ (class "line diff range")) ,line))
                    (else
-                    `(span (@ (class "line")) ,line)))))
+                    `(div (@ (class "line")) ,line)))))
              (values (cons (add-block-line! block formatted-line)
                            other-blocks)
                      context))))
@@ -97,7 +97,7 @@ with the next context."
        (if (string-prefix? ">" line)
            ;; Add line to current block
            (values (cons (add-block-line! block
-                                          `(span (@ (class "line")) ,line))
+                                          `(div (@ (class "line")) ,line))
                          other-blocks)
                    context)
            ;; Retry
@@ -124,28 +124,28 @@ with the next context."
                           ((uri-string . rest)
                            (or (and=> (string->uri uri-string)
                                       (lambda (uri)
-                                        `(span (@ (class "line"))
-                                               ,(string-trim-right pre #\<)
-                                               (a (@ (href ,uri-string))
-                                                  ,uri-string)
-                                               ,(string-join rest " "))))
-                               `(span (@ (class "line")) ,line)))))))
+                                        `(div (@ (class "line"))
+                                              ,(string-trim-right pre #\<)
+                                              (a (@ (href ,uri-string))
+                                                 ,uri-string)
+                                              ,(string-join rest " "))))
+                               `(div (@ (class "line")) ,line)))))))
                ((or (string-prefix? "Signed-off-by" line)
                     (string-prefix? "Co-authored-by" line))
-                `(span (@ (class "line commit attribution")) ,line))
+                `(div (@ (class "line commit attribution")) ,line))
                ((or (string-prefix? "From: " line)
                     (string-prefix? "Date: " line)
                     (string-prefix? "Subject: " line))
-                `(span (@ (class "line commit header")) ,line))
+                `(div (@ (class "line commit header")) ,line))
                ((or (string-prefix? "* " line)
                     (string-prefix? " * " line))
-                `(span (@ (class "line commit changelog")) ,line))
+                `(div (@ (class "line commit changelog")) ,line))
                ((string-prefix? "diff --git" line)
-                `(span (@ (class "line diff file")) ,line))
+                `(div (@ (class "line diff file")) ,line))
                ((string-prefix? "--8<---------------cut here" line)
                 "")
                (else
-                `(span (@ (class "line")) ,line)))))
+                `(div (@ (class "line")) ,line)))))
          (if (eq? new-context context)
              (values (cons (add-block-line! block formatted-line)
                            other-blocks)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]