emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/engrave-faces f18636f 1/4: Move style matching logic to


From: ELPA Syncer
Subject: [elpa] externals/engrave-faces f18636f 1/4: Move style matching logic to core
Date: Sun, 5 Sep 2021 16:57:11 -0400 (EDT)

branch: externals/engrave-faces
commit f18636f86fb25b8c1d784607f3ab69c0d1b88a0c
Author: TEC <tec@tecosaur.com>
Commit: TEC <tec@tecosaur.com>

    Move style matching logic to core
---
 engrave-faces-html.el  | 2 +-
 engrave-faces-latex.el | 2 +-
 engrave-faces.el       | 8 ++++++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/engrave-faces-html.el b/engrave-faces-html.el
index 911f03f..cdeca29 100644
--- a/engrave-faces-html.el
+++ b/engrave-faces-html.el
@@ -101,7 +101,7 @@ See `engrave-faces-preset-styles' and 
`engrave-faces-html-output-style'."
 (defun engrave-faces-html-face-mapper (faces content)
   "Create a HTML representation of CONTENT With FACES applied."
   (let ((protected-content (engrave-faces-html-protect-string content))
-        (style (unless (eq faces 'default) (assoc faces 
engrave-faces-preset-styles))))
+        (style (engrave-faces-preset-style faces)))
     (if (string-match-p "\\`[\n[:space:]]+\\'" content)
         protected-content
       (if (and style (eq engrave-faces-html-output-style 'preset))
diff --git a/engrave-faces-latex.el b/engrave-faces-latex.el
index 4e69cca..3998571 100644
--- a/engrave-faces-latex.el
+++ b/engrave-faces-latex.el
@@ -66,7 +66,7 @@ See `engrave-faces-preset-styles' and 
`engrave-faces-latex-output-style'."
 (defun engrave-faces-latex-face-mapper (faces content)
   "Create a LaTeX representation of CONTENT With FACES applied."
   (let ((protected-content (replace-regexp-in-string "[\\{}$%&_#]" "\\\\\\&" 
content))
-        (style (unless (eq faces 'default) (assoc faces 
engrave-faces-preset-styles))))
+        (style (engrave-faces-preset-style faces)))
     (if (string-match-p "\\`[\n[:space:]]+\\'" content)
         protected-content
       (if (and style (eq engrave-faces-latex-output-style 'preset))
diff --git a/engrave-faces.el b/engrave-faces.el
index 541d4dd..f9c5b37 100644
--- a/engrave-faces.el
+++ b/engrave-faces.el
@@ -289,6 +289,14 @@ faces will need to be explicitly styled each time they're 
used."
               (eq value 'unspecified))
     value))
 
+(defun engrave-faces-preset-style (faces)
+  "Return the preset style for FACES, should it exist.
+Unconditionally returns nil when FACES is default."
+  (pcase faces
+    ('default nil)
+    ((pred symbolp) (assoc faces engrave-faces-preset-styles))
+    ((and (pred listp) (app length 1)) (assoc (car faces) 
engrave-faces-preset-styles))))
+
 (defun engrave-faces-generate-preset ()
   "Generate `engrave-faces-preset-styles' based on the current theme."
   (mapcar



reply via email to

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