Clean up documentation and comments

This commit is contained in:
Gerard Vermeulen 2023-06-05 08:44:01 +02:00
parent 8857f4c45a
commit 520b254c03
1 changed files with 11 additions and 8 deletions

View File

@ -26,8 +26,8 @@
;;; Commentary:
;; This library implements a HTML derived backend for Org export:
;; 1. The Org ox-beamer library shows how to code derived backends.
;; 2. The function org-my-html-link is an edited org-html-link copy.
;; 1. The function org-my-html-link is an edited org-html-link copy.
;; 2. The Org ox-beamer library shows how to code derived backends.
;; 3. It borrows code from https://emacs.stackexchange.com/a/57433 to
;; embed SVG images in exported HTML files.
@ -69,17 +69,17 @@
"Non-nil means embed SVG images into exported HTML pages,
otherwise link to SVG images from exported HTML pages.
This option can also be set with
This option can also be set in Org files with
#+OPTIONS: html-embed-svg:t
or
#+OPTIONS: html-embed-svg:nil
to enable or disable SVG embedding in Org files."
to enable or disable SVG embedding in exported HTML."
:group 'org-export-html
:version "30.0"
:type 'boolean)
(defcustom org-html-embed-svg-excludes nil
"List of SVG paths to exclude from SVG embedding.
"List of SVG files to exclude from SVG embedding.
This option overrules an `org-html-embed-svg' non-nil value.
@ -90,7 +90,7 @@ It can also be set with the HTML_EMBED_SVG_EXCLUDES keyword."
:safe (lambda (x) (and (listp x) (cl-every #'stringp x))))
(defcustom org-html-embed-svg-includes nil
"List of SVG paths to include in SVG embedding.
"List of SVG files to include in SVG embedding.
This option overrules an `org-html-embed-svg' nil value.
@ -119,10 +119,13 @@ lists of SVG files to include in and/or to exclude from embedding."
(with-temp-buffer
(insert-file-contents path)
;; Delete text preceding something starting as an SVG root element.
;; See https://emacs.stackexchange.com/a/57433 the for original code.
;; The intent is to remove XML declarations (and XML comments).
;; This breaks in case of a preceding XML comment with <svg inside
;; or a preceding XML element with an SVG element inside.
;; See https://emacs.stackexchange.com/a/57433 for the original code.
(let ((case-fold-search t))
(unless (search-forward "<svg" nil 'noerror)
(user-error "Can't find an SVG root element in file `%s'." path)))
(user-error "Can't find a root SVG start tag in file `%s'." path)))
(delete-region (point-min) (match-beginning 0))
(buffer-string)))