[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Exporting images to different output formats
From: |
Michael Welle |
Subject: |
Exporting images to different output formats |
Date: |
Sat, 29 Oct 2022 13:52:20 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hello,
I want to export to different output formats. Trouble is the way ox-gfm
exports images. So I thought, hm, why not utilise macros to abstract away
the differences. Well, that escalated quickly:
#+macro: img_gfm (eval (concat "#+begin_export md\n![img](" $1 " \"" $2
"\")\n*Abb.: " $2 "* (Quelle: " $3 ")\n#+end_export"))
#+macro: img_latex (eval "foobar")
# Image export for Github flavoured markdown
# $1 path to image
# $2 caption
# $3 source
#+macro: img (eval (cl-case org-export-current-backend ('gfm (concat
"{{{img_gfm(" $1 "," $2 "," $3")}}}")) ('latex "{{{img_latex}}}") (t "barfoo")))
{{{img(./foo, foo, barfoo)}}}
That kind of works (and breaks if I want commas in the caption), but is
ugly as... and doesn't get better if I implement the other output formats.
Maybe syntax like @@latex: ...@@ would help. But no, I think that is
defined in the specific backends, not as a general mechanism.
So, how can I do it better?
All the best,
hmw
- Exporting images to different output formats,
Michael Welle <=