emacs-diffs
[Top][All Lists]
Advanced

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

master 1431fd9 2/2: Add faces for shr heading elements (bug#49433)


From: Lars Ingebrigtsen
Subject: master 1431fd9 2/2: Add faces for shr heading elements (bug#49433)
Date: Tue, 6 Jul 2021 11:07:02 -0400 (EDT)

branch: master
commit 1431fd91b4d885560800e6b1b2a47aac24f72ff1
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Add faces for shr heading elements (bug#49433)
    
    * etc/NEWS: Document new faces.
    * lisp/net/shr.el (shr-h1, shr-h2, shr-h3, shr-h4, shr-h5, shr-h6):
    Define new faces.
    (shr-tag-h1): Remove inclusion of 'variable-pitch' face.  Fix
    bug#49433 by applying a new face directly.
    (shr-tag-h2, shr-tag-h3, shr-tag-h4, shr-tag-h5, shr-tag-h6): Apply
    new faces.
---
 etc/NEWS        |  4 ++++
 lisp/net/shr.el | 41 +++++++++++++++++++++++++++++++++--------
 2 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index c3eaf5f..b1ab694 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1620,6 +1620,10 @@ t, which preserves the original behavior.
 If set non-nil, showing an unseen message will set the Rmail buffer's
 modified flag.
 
+---
+*** New faces for heading elements.
+Those are 'shr-h1', 'shr-h2', 'shr-h3', 'shr-h4', 'shr-h5', 'shr-h6'.
+
 ** Apropos
 
 *** New commands 'apropos-next-symbol' and 'apropos-previous-symbol'.
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 873f045..85d81b6 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -183,6 +183,33 @@ temporarily blinks with this face."
   "Face for <abbr> elements."
   :version "27.1")
 
+(defface shr-h1
+  '((t :height 1.3 :weight bold))
+  "Face for <h1> elements."
+  :version "28.1")
+
+(defface shr-h2
+  '((t :weight bold))
+  "Face for <h2> elements."
+  :version "28.1")
+
+(defface shr-h3
+  '((t :slant italic))
+  "Face for <h3> elements."
+  :version "28.1")
+
+(defface shr-h4 nil
+  "Face for <h4> elements."
+  :version "28.1")
+
+(defface shr-h5 nil
+  "Face for <h5> elements."
+  :version "28.1")
+
+(defface shr-h6 nil
+  "Face for <h6> elements."
+  :version "28.1")
+
 (defcustom shr-inhibit-images nil
   "If non-nil, inhibit loading images."
   :version "28.1"
@@ -1939,24 +1966,22 @@ BASE is the URL of the HTML being rendered."
   (shr-generic dom))
 
 (defun shr-tag-h1 (dom)
-  (shr-heading dom (if shr-use-fonts
-                      '(variable-pitch (:height 1.3 :weight bold))
-                    'bold)))
+  (shr-heading dom 'shr-h1))
 
 (defun shr-tag-h2 (dom)
-  (shr-heading dom 'bold))
+  (shr-heading dom 'shr-h2))
 
 (defun shr-tag-h3 (dom)
-  (shr-heading dom 'italic))
+  (shr-heading dom 'shr-h3))
 
 (defun shr-tag-h4 (dom)
-  (shr-heading dom))
+  (shr-heading dom 'shr-h4))
 
 (defun shr-tag-h5 (dom)
-  (shr-heading dom))
+  (shr-heading dom 'shr-h5))
 
 (defun shr-tag-h6 (dom)
-  (shr-heading dom))
+  (shr-heading dom 'shr-h6))
 
 (defun shr-tag-hr (_dom)
   (shr-ensure-newline)



reply via email to

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