Skip to content

Commit

Permalink
Pass `#+ATTR_*' tags to pandoc to allow resizing of images.
Browse files Browse the repository at this point in the history
As per jgm/pandoc#1906 and
jgm/pandoc#2927 pandoc now supports the use of
`#+ATTR_HTML' tags to specify attributes (e.g., :width, :height) for
images when exporting from org-mode documents.

By default, `ox-pandoc' was parsing the document elements using
`org-org-indentity' (inherited from the 'org export backend), which
removes all #+ATTR_* tags from the output. This change puts them back in.

NOTE: seems to be undocumented, but #+ATTR_* tags appear to be classed
under the `paragraph' type in org-mode's export system.
  • Loading branch information
Lixin Chin committed Oct 31, 2016
1 parent a66a06f commit 8194136
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ox-pandoc.el
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@
:type 'list)

(org-export-define-derived-backend 'pandoc 'org
:translate-alist '((template . org-pandoc-template))
:translate-alist '((template . org-pandoc-template)
(paragraph . org-pandoc-identity))
;; :export-block "PANDOC"
:menu-entry
`(?p "export via pandoc"
Expand Down Expand Up @@ -1296,6 +1297,14 @@ Option table is created in this stage."
(funcall org-template contents info)
contents)))

(defun org-pandoc-identity (blob contents info)
"Transcode BLOB element or object back into Org syntax.
CONTENTS is its contents, as a string or nil. INFO is ignored.
Like `org-org-identity', but also preserves #+ATTR_* tags in the
output."
(ignore info)
(org-export-expand blob contents t))

(defun org-pandoc-put-options (options)
"Put alist OPTIONS to `org-pandoc-option-table'."
(dolist (option options)
Expand Down

0 comments on commit 8194136

Please sign in to comment.