Author: Jim Winstead (jimwins)
Date: 2024-08-23T17:16:11-07:00

Commit: 
https://github.com/php/web-news/commit/0a39ce25c28a21441e7dda17462825666f791467
Raw diff: 
https://github.com/php/web-news/commit/0a39ce25c28a21441e7dda17462825666f791467.diff

Wrap long lines and style quote levels distinctly

(Based on how lists.mysql.com used to work.)

Changed paths:
  M  article.php
  M  style.css


Diff:

diff --git a/article.php b/article.php
index 578b030..2da7d6d 100644
--- a/article.php
+++ b/article.php
@@ -139,10 +139,11 @@
         echo "<span class=\"signature\">";
         $insig = 1;
     }
-    if (!$insig && substr($line, 0, 4) == "&gt;") {
-        echo "<span class=\"quote\">$line</span>";
+    if (!$insig && preg_match('/^((\w*?&gt; ?)+)/', $line, $m)) {
+        $level = substr_count($m[1], '&gt;') % 4;
+        echo "<span class=\"quote$level\">", wordwrap($line, 90, "\n" . 
$m[1]), "</span>";
     } else {
-        echo $line;
+        echo wordwrap($line, 90);
     }
 }
 
diff --git a/style.css b/style.css
index 7ea31a5..cb41eec 100644
--- a/style.css
+++ b/style.css
@@ -364,6 +364,19 @@ table.standard th.subr {
     display: none;
 }
 
+/* Shading for quotes */
+.quote1 { color: #006486; }
+.quote2 { color: #900; }
+.quote3 { color: #a36008; }
+.quote0 { color: #909; }
+
+/* Dim signatures */
+.signature { font-size: smaller; color: gray; }
+.signature a:link    { color: #9999ff; }
+.signature a:hover   { color: #ff9999; }
+.signature a:active  { color: #ff9999; }
+.signature a:visited { color: #ff66ff; }
+
 @media screen and (max-width: 760px) {
     .welcome {
         display: none;

Reply via email to