[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org ca91473639 03/13: ox-latex: More versitile option c
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org ca91473639 03/13: ox-latex: More versitile option construction |
Date: |
Thu, 12 May 2022 12:57:51 -0400 (EDT) |
branch: externals/org
commit ca91473639153ac53500f118b50f0a237fd87444
Author: TEC <tec@tecosaur.com>
Commit: TEC <tec@tecosaur.com>
ox-latex: More versitile option construction
* lisp/ox-latex.el (org-latex--make-option-string): Support a custom
option seperator string.
(org-latex--make-option-string, org-latex-minted-options,
org-latex-listings-options): The first line of the docstrings for
`org-latex-minted-options` and `org-latex-listings-options` describe the
variables as "association lists", yet `org-latex--make-option-string`
does not handle association lists and an example of two-value lists is
provided. To make the behaviour match the docstring,
`org-latex--make-option-string` is modified to work with either a list
two-value lists or an association list, and the examples in
`org-latex-minted-options` and `org-latex-listings-options` updated
accordingly.
---
lisp/ox-latex.el | 38 ++++++++++++++++++++++++--------------
1 file changed, 24 insertions(+), 14 deletions(-)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 38f36a1f38..2d4b3baced 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1006,12 +1006,16 @@ in this list - but it does not hurt if it is present."
These options are supplied as a comma-separated list to the
\\lstset command. Each element of the association list should be
-a list containing two strings: the name of the option, and the
-value. For example,
+a list or cons cell containing two strings: the name of the
+option, and the value. For example,
(setq org-latex-listings-options
\\='((\"basicstyle\" \"\\\\small\")
(\"keywordstyle\" \"\\\\color{black}\\\\bfseries\\\\underbar\")))
+ ; or
+ (setq org-latex-listings-options
+ \\='((\"basicstyle\" . \"\\\\small\")
+ (\"keywordstyle\" . \"\\\\color{black}\\\\bfseries\\\\underbar\")))
will typeset the code in a small size font with underlined, bold
black keywords.
@@ -1059,11 +1063,14 @@ with:
These options are supplied within square brackets in
\\begin{minted} environments. Each element of the alist should
-be a list containing two strings: the name of the option, and the
-value. For example,
+be a list or cons cell containing two strings: the name of the
+option, and the value. For example,
(setq org-latex-minted-options
\\='((\"bgcolor\" \"bg\") (\"frame\" \"lines\")))
+ ; or
+ (setq org-latex-minted-options
+ \\='((\"bgcolor\" . \"bg\") (\"frame\" . \"lines\")))
will result in source blocks being exported with
@@ -1506,21 +1513,24 @@ This is used to choose a separator for constructs like
\\verb."
when (not (string-match (regexp-quote (char-to-string c)) s))
return (char-to-string c))))
-(defun org-latex--make-option-string (options)
+(defun org-latex--make-option-string (options &optional seperator)
"Return a comma separated string of keywords and values.
OPTIONS is an alist where the key is the options keyword as
a string, and the value a list containing the keyword value, or
nil."
(mapconcat (lambda (pair)
- (pcase-let ((`(,keyword ,value) pair))
- (concat keyword
- (and (> (length value) 0)
- (concat "="
- (if (string-match-p (rx (any "[]"))
value)
- (format "{%s}" value)
- value))))))
- options
- ","))
+ (let ((keyword (car pair))
+ (value (pcase (cdr pair)
+ ((pred stringp) (cdr pair))
+ ((pred consp) (cadr pair)))))
+ (concat keyword
+ (when value
+ (concat "="
+ (if (string-match-p (rx (any "[]")) value)
+ (format "{%s}" value)
+ value))))))
+ options
+ (or seperator ",")))
(defun org-latex--wrap-label (element output info)
"Wrap label associated to ELEMENT around OUTPUT, if appropriate.
- [elpa] externals/org bbba45a07f 05/13: ox-latex: Don't use `length' to get string width, (continued)
- [elpa] externals/org bbba45a07f 05/13: ox-latex: Don't use `length' to get string width, ELPA Syncer, 2022/05/12
- [elpa] externals/org b4e4b3c502 07/13: ox-latex: Replace `org-latex-listings', ELPA Syncer, 2022/05/12
- [elpa] externals/org 61d85bcdb3 01/13: ox-latex: Refactor `org-latex-src-block', ELPA Syncer, 2022/05/12
- [elpa] externals/org 40c559ac3d 02/13: ox-latex: Refactor `org-latex-inline-src-block', ELPA Syncer, 2022/05/12
- [elpa] externals/org e07b89c31c 06/13: ox-latex: Refactor source block transcode fun sigs, ELPA Syncer, 2022/05/12
- [elpa] externals/org d30738b786 04/13: ox-latex: Introduce "engraved" code highlighting, ELPA Syncer, 2022/05/12
- [elpa] externals/org a16e208938 08/13: ox-latex: Support setting the engraved theme, ELPA Syncer, 2022/05/12
- [elpa] externals/org 4d5805755c 09/13: ox-latex: Support setting engraved theme per-block, ELPA Syncer, 2022/05/12
- [elpa] externals/org faa5c1887c 11/13: ox-latex: Support mathescape'd code with engraved, ELPA Syncer, 2022/05/12
- [elpa] externals/org 5766ddd758 13/13: ox-latex: Prefix lst: to source block labels, ELPA Syncer, 2022/05/12
- [elpa] externals/org ca91473639 03/13: ox-latex: More versitile option construction,
ELPA Syncer <=
- [elpa] externals/org af4ca40eae 10/13: ox-latex: Fix %-captions in minted/engraved code, ELPA Syncer, 2022/05/12
- [elpa] externals/org 2cb62c0798 12/13: news and manual: Mention ox-latex's engraved code, ELPA Syncer, 2022/05/12