Tweak naming in preparation always in preparation of a patch

This commit is contained in:
Gerard Vermeulen 2023-06-04 17:56:33 +02:00
parent f50bf98897
commit 59bc902bdb
1 changed files with 22 additions and 20 deletions

View File

@ -53,10 +53,10 @@
(if a (org-my-html-export-to-html t s v b) (if a (org-my-html-export-to-html t s v b)
(org-open-file (org-my-html-export-to-html nil s v b))))))) (org-open-file (org-my-html-export-to-html nil s v b)))))))
:options-alist :options-alist
'((:html-exclude-embed-svgs "HTML_EXCLUDE_EMBED_SVGS" nil '((:html-embed-svg-excludes "HTML_EMBED_SVG_EXCLUDES" nil
org-html-exclude-embed-svgs split) org-html-embed-svg-excludes split)
(:html-select-embed-svgs "HTML_SELECT_EMBED_SVGS" nil (:html-embed-svg-includes "HTML_EMBED_SVG_INCLUDES" nil
org-html-select-embed-svgs split) org-html-embed-svg-includes split)
(:with-html-svg-embedding nil "html-embed-svg" org-html-embed-svg)) (:with-html-svg-embedding nil "html-embed-svg" org-html-embed-svg))
:translate-alist :translate-alist
'((link . org-my-html-link))) '((link . org-my-html-link)))
@ -79,46 +79,43 @@ to enable or disable SVG embedding in Org files."
:version "30.0" :version "30.0"
:type 'boolean) :type 'boolean)
(defcustom org-html-exclude-embed-svgs nil (defcustom org-html-embed-svg-excludes nil
"List of SVG paths to exclude from SVG embedding. "List of SVG paths to exclude from SVG embedding.
This option overrules an `org-html-embed-svg' non-nil value. This option overrules an `org-html-embed-svg' non-nil value.
It can also be set with the HTML_EXCLUDE_EMBED_SVGS keyword." It can also be set with the HTML_EMBED_SVG_EXCLUDES keyword."
:group 'org-export-html :group 'org-export-html
:version "30.0" :version "30.0"
:type '(repeat string) :type '(repeat string)
:safe (lambda (x) (and (listp x) (cl-every #'stringp x)))) :safe (lambda (x) (and (listp x) (cl-every #'stringp x))))
(defcustom org-html-select-embed-svgs nil (defcustom org-html-embed-svg-includes nil
"List of SVG paths to select for SVG embedding. "List of SVG paths to include in SVG embedding.
This option overrules an `org-html-embed-svg' nil value. This option overrules an `org-html-embed-svg' nil value.
It can also be set with the HTML_SELECT_EMBED_SVGS keyword." It can also be set with the HTML_EMBED_SVG_INCLUDES keyword."
:group 'org-export-html :group 'org-export-html
:version "30.0" :version "30.0"
:type '(repeat string) :type '(repeat string)
:safe (lambda (x) (and (listp x) (cl-every #'stringp x)))) :safe (lambda (x) (and (listp x) (cl-every #'stringp x))))
;;; Internal Functions
;;; Transcode Functions
;;;; Link (defun org-my-html--embed-svg-p (link path info)
(defun org--my-html-embed-svg-p (link path info)
"Check whether LINK and INFO specify to embed the SVG file named PATH. "Check whether LINK and INFO specify to embed the SVG file named PATH.
LINK must have no contents and link to an SVG file. INFO may contain LINK must have no contents and link to an SVG file. INFO may contain
lists of SVG files to select for and/or to exclude from embedding." lists of SVG files to include in and/or to exclude from embedding."
(and (not (org-element-contents link)) (and (not (org-element-contents link))
(let ((case-fold-search t)) (let ((case-fold-search t))
(string-match-p ".svg\\'" (org-element-property :path link))) (string-match-p ".svg\\'" (org-element-property :path link)))
(or (and (plist-get info :with-html-svg-embedding) (or (and (plist-get info :with-html-svg-embedding)
(not (member path (plist-get info :html-exclude-embed-svgs)))) (not (member path (plist-get info :html-embed-svg-excludes))))
(and (not (plist-get info :with-html-svg-embedding)) (and (not (plist-get info :with-html-svg-embedding))
(member path (plist-get info :html-select-embed-svgs)))))) (member path (plist-get info :html-embed-svg-includes))))))
(defun org--my-html-svg-contents (path) (defun org-my-html-svg-contents (path)
"Return the SVG contents of the file named PATH." "Return the SVG contents of the file named PATH."
;; https://emacs.stackexchange.com/a/57433 ;; https://emacs.stackexchange.com/a/57433
(with-temp-buffer (with-temp-buffer
@ -130,6 +127,11 @@ lists of SVG files to select for and/or to exclude from embedding."
(delete-region (point-min) (match-beginning 0)) (delete-region (point-min) (match-beginning 0))
(buffer-string))) (buffer-string)))
;;; Transcode Functions
;;;; Link
(defun org-my-html-link (link desc info) (defun org-my-html-link (link desc info)
"Transcode a LINK object from Org to HTML. "Transcode a LINK object from Org to HTML.
DESC is the description part of the link, or the empty string. DESC is the description part of the link, or the empty string.
@ -210,8 +212,8 @@ contrary to `org-html-link' which can only link such images."
;; Link type is handled by a special function. ;; Link type is handled by a special function.
((org-export-custom-protocol-maybe link desc 'html info)) ((org-export-custom-protocol-maybe link desc 'html info))
;; Embed SVG. ;; Embed SVG.
((org--my-html-embed-svg-p link path info) ((org-my-html--embed-svg-p link path info)
(org--my-html-svg-contents path)) (org-my-html-svg-contents path))
;; Image file. ;; Image file.
((and (plist-get info :html-inline-images) ((and (plist-get info :html-inline-images)
(org-export-inline-image-p (org-export-inline-image-p