Fixed images, latex and first real blog.
This commit is contained in:
parent
8caab7b2be
commit
79efd70089
8 changed files with 240 additions and 32 deletions
|
@ -198,18 +198,37 @@
|
|||
(file-name-sans-extension
|
||||
(org-element-property :path link)))))
|
||||
|
||||
(let ((exported-link (org-export-custom-protocol-maybe link contents 'html info)))
|
||||
(cond
|
||||
(exported-link exported-link)
|
||||
((equal contents nil)
|
||||
(format "<a href=\"%s\">%s</a>"
|
||||
(org-element-property :raw-link link)
|
||||
(org-element-property :raw-link link)))
|
||||
((string-prefix-p "/" (org-element-property :raw-link link))
|
||||
(format "<a href=\"%s\">%s</a>"
|
||||
(org-element-property :raw-link link)
|
||||
contents))
|
||||
(t (org-export-with-backend 'html link contents info)))))
|
||||
;; (let ((exported-link (org-export-custom-protocol-maybe link contents 'html info)))
|
||||
;; (cond
|
||||
;; (exported-link exported-link)
|
||||
;; ((equal contents nil)
|
||||
;; (format "<a href=\"%s\">%s</a>"
|
||||
;; (org-element-property :raw-link link)
|
||||
;; (org-element-property :raw-link link)))
|
||||
;; ((string-prefix-p "/" (org-element-property :raw-link link))
|
||||
;; (format "<a href=\"%s\">%s</a>"
|
||||
;; (org-element-property :raw-link link)
|
||||
;; contents))
|
||||
;; (t (org-export-with-backend 'html link contents info))))
|
||||
(let ((exported-link (org-export-custom-protocol-maybe link contents 'html info)))
|
||||
(cond
|
||||
(exported-link exported-link)
|
||||
((equal contents nil)
|
||||
(format "<a href=\"%s\">%s</a>"
|
||||
(org-element-property :raw-link link)
|
||||
(org-element-property :raw-link link)))
|
||||
((string-prefix-p "/" (org-element-property :raw-link link))
|
||||
(format "<a href=\"%s\">%s</a>"
|
||||
(org-element-property :raw-link link)
|
||||
contents))
|
||||
((and (string-match-p (concat "\\." (regexp-opt '("jpg" "jpeg" "png" "gif")))
|
||||
(org-element-property :raw-link link))
|
||||
(not (equal contents nil)))
|
||||
(format "<img src=\"%s\" alt=\"%s\" style=\"max-width: 100%%; height: auto;\">"
|
||||
(org-element-property :raw-link link)
|
||||
contents))
|
||||
(t (org-export-with-backend 'html link contents info))))
|
||||
)
|
||||
|
||||
|
||||
(defun my/make-heading-anchor-name (headline-text)
|
||||
|
@ -256,25 +275,25 @@
|
|||
(code (org-html-format-code src-block info)))
|
||||
(format "<pre>%s</pre>" (string-trim code))))
|
||||
|
||||
(defun my/org-html-special-block (special-block contents info)
|
||||
"Transcode a SPECIAL-BLOCK element from Org to HTML.
|
||||
CONTENTS holds the contents of the block. INFO is a plist
|
||||
holding contextual information."
|
||||
(let* ((block-type (org-element-property :type special-block))
|
||||
(attributes (org-export-read-attribute :attr_html special-block)))
|
||||
(format "<div class=\"%s center\">\n%s\n</div>"
|
||||
block-type
|
||||
(or contents
|
||||
(if (string= block-type "cta")
|
||||
"If you find this guide helpful, please consider supporting System Crafters via the links on the <a href=\"/how-to-help/#support-my-work\">How to Help</a> page!"
|
||||
"")))))
|
||||
;; (defun my/org-html-special-block (special-block contents info)
|
||||
;; "Transcode a SPECIAL-BLOCK element from Org to HTML.
|
||||
;; CONTENTS holds the contents of the block. INFO is a plist
|
||||
;; holding contextual information."
|
||||
;; (let* ((block-type (org-element-property :type special-block))
|
||||
;; (attributes (org-export-read-attribute :attr_html special-block)))
|
||||
;; (format "<div class=\"%s center\">\n%s\n</div>"
|
||||
;; block-type
|
||||
;; (or contents
|
||||
;; (if (string= block-type "cta")
|
||||
;; "If you find this guide helpful, please consider supporting System Crafters via the links on the <a href=\"/how-to-help/#support-my-work\">How to Help</a> page!"
|
||||
;; "")))))
|
||||
|
||||
(org-export-define-derived-backend 'site-html 'html
|
||||
:translate-alist
|
||||
'((template . my/org-html-template)
|
||||
(link . my/org-html-link)
|
||||
(src-block . my/org-html-src-block)
|
||||
(special-block . my/org-html-special-block)
|
||||
;; (special-block . my/org-html-special-block)
|
||||
(headline . my/org-html-headline))
|
||||
:options-alist
|
||||
'((:video "VIDEO" nil nil)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue