Wrap "words separated by space characters" groups in LaTeX commands
This commit is contained in:
parent
5974a1c84a
commit
1011bba04e
36
README.org
36
README.org
@ -2262,24 +2262,24 @@ configuration.
|
||||
#'engrave-faces-latex--protect-content-mathescape
|
||||
#'engrave-faces-latex--protect-content)
|
||||
content)))
|
||||
(if (string-match-p "\\`[\n[:space:]]+\\'" content)
|
||||
protected-content
|
||||
;; Move newlines with whitespace outside the engrave face commands.
|
||||
(let ((regexp "\\(?1:[^\n]+\\)\\|\\(?2:\n[[:space:]]*\\)")
|
||||
(slug (when (and style
|
||||
(eq engrave-faces-latex-output-style 'preset))
|
||||
(plist-get (cdr style) :slug)))
|
||||
(start 0)
|
||||
(stack))
|
||||
(while (string-match regexp protected-content start)
|
||||
(setq start (match-end 0))
|
||||
(when-let ((pc (match-string 1 protected-content)))
|
||||
(if (stringp slug)
|
||||
(push (concat "\\EF" slug "{" pc "}") stack)
|
||||
(push (engrave-faces-latex-face-apply faces pc) stack)))
|
||||
(when-let ((pc (match-string 2 protected-content)))
|
||||
(push pc stack)))
|
||||
(apply #'concat (nreverse stack)))))))
|
||||
;; Wrap "words separated by space characters" groups in LaTeX commands.
|
||||
;; Do not wrap newlines and other whitespace separating those groups.
|
||||
(let ((regexp (rx (or (group-n 1 (+ graph ) (* (*? print) (+ graph)))
|
||||
(group-n 2 (+ (any "\n" space))))))
|
||||
(slug (when (and style
|
||||
(eq engrave-faces-latex-output-style 'preset))
|
||||
(plist-get (cdr style) :slug)))
|
||||
(start 0)
|
||||
(stack))
|
||||
(while (string-match regexp protected-content start)
|
||||
(setq start (match-end 0))
|
||||
(when-let ((pc (match-string 1 protected-content)))
|
||||
(if (stringp slug)
|
||||
(push (concat "\\EF" slug "{" pc "}") stack)
|
||||
(push (engrave-faces-latex-face-apply faces pc) stack)))
|
||||
(when-let ((pc (match-string 2 protected-content)))
|
||||
(push pc stack)))
|
||||
(apply #'concat (nreverse stack))))))
|
||||
|
||||
(with-eval-after-load 'emacs
|
||||
(defun toggle-engrave-faces-latex-face-mapper-override ()
|
||||
|
Loading…
Reference in New Issue
Block a user