Add export to HTML file and open functionality
This commit is contained in:
parent
dd95f7e65c
commit
e07bda2d39
@ -28,7 +28,7 @@
|
||||
;; 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.
|
||||
;; 3. It borrows code from https://emacs.stackexchange.com/a/57433 to
|
||||
;; embed SVG images in the HTML file.
|
||||
;; embed SVG images in exported HTML files.
|
||||
|
||||
;;; Code:
|
||||
|
||||
@ -45,8 +45,12 @@
|
||||
(org-export-define-derived-backend 'my-html 'html
|
||||
:menu-entry
|
||||
'(?h 1
|
||||
((?M "As MY-HTML buffer" org-my-html-export-as-html)
|
||||
(?m "As MY-HTML file" org-my-html-export-to-html)))
|
||||
((?M "As my-HTML buffer" org-my-html-export-as-html)
|
||||
(?m "As my-HTML file" org-my-html-export-to-html)
|
||||
(?O "As my-HTML file and open"
|
||||
(lambda (a 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)))))))
|
||||
:options-alist
|
||||
'((:my-html-embed-svg "HTML_EMBED_SVG" nil nil t))
|
||||
:translate-alist
|
||||
@ -58,11 +62,8 @@
|
||||
;;;; Links :: Embed SVG
|
||||
|
||||
(defcustom org-my-html-embed-svg t
|
||||
"Non-nil means embed SVG embed into exported MY-HTML pages.
|
||||
You can set this variable in Org files with
|
||||
#+HTML_EMBED_SVG: t
|
||||
orx
|
||||
#+OPTIONS: html-embed-svg:t."
|
||||
"Non-nil means embed SVG images into exported my-HTML pages,
|
||||
otherwise link to SVG images from exported my-HTML pages."
|
||||
:group 'org-export-html
|
||||
:version "30.0"
|
||||
:type 'boolean)
|
||||
@ -73,7 +74,6 @@ orx
|
||||
;;;; Link
|
||||
|
||||
(defun org--my-html-embed-svg-p (link)
|
||||
(message "Check SVG Path: %s" (org-element-property :path link))
|
||||
(and (not (org-element-contents link))
|
||||
(let ((case-fold-search t))
|
||||
(string-match-p ".svg\\'" (org-element-property :path link)))))
|
||||
@ -92,8 +92,8 @@ orx
|
||||
"Transcode a LINK object from Org to MY-HTML.
|
||||
DESC is the description part of the link, or the empty string.
|
||||
INFO is a plist holding contextual information. See
|
||||
`org-export-data'. This function can embed linked SVG images
|
||||
contrary to `org-html-link'."
|
||||
`org-export-data'. This function can embed or link SVG images
|
||||
contrary to `org-html-link' which can only link such images."
|
||||
(let* ((html-ext (plist-get info :html-extension))
|
||||
(dot (when (> (length html-ext) 0) "."))
|
||||
(link-org-files-as-html-maybe
|
||||
|
Loading…
x
Reference in New Issue
Block a user