From: "Berry, Charles" <ccberry@ucsd.edu>
To: "Michaël Cadilhac" <michael@cadilhac.name>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: HTML export with LaTeX babel blocks
Date: Thu, 29 Aug 2019 18:13:27 +0000 [thread overview]
Message-ID: <ED4A78F8-4C26-4412-94B7-8A8C71364889@ucsd.edu> (raw)
In-Reply-To: <CADt3fpNNwaUp-buQELofbUYvXExtaijZi9FW2tn7BXDNx4bEJA@mail.gmail.com>
> On Aug 28, 2019, at 5:59 PM, Michaël Cadilhac <michael@cadilhac.name> wrote:
>
> My goal is to export SVG files of TikZ drawings in HTML. Now, what follows is a bit of a rant on `org-babel-execute:latex`; let's go through the options:
>
> -
[snip]
Well you can try to continue on your path, but it can get `interesting'.
An alternative is to do something like this:
Define an export backend that derives from 'html.
Flesh out the function `org-tikz-html-export-block' to process the content of `tikz' export blocks to render the derived SVG. Use existing functions in `ox-latex.el' as helpers if that works.
#+begin_src emacs-lisp
(org-export-define-derived-backend 'tikz-html 'html
:translate-alist '((export-block . org-tikz-html-export-block)))
(defun org-tikz-html-export-block (export-block contents info)
"Transcoder to TikZ in html exports."
(when (string= (org-element-property :type export-block) "TIKZ")
(let ((tikz-code
(org-remove-indentation
(org-element-property :value export-block))))
;; process TikZ code to SVG
;; produce a suitable link to include the SVG as the result
)))
#+end_src
Then blocks like
#+begin_export tikz
% tikz code goes here
#+end_export
should render when you run
#+begin_src emacs-lisp
(org-export-to-file 'tikz-html "file-name.html")
#+end_src
You might adapt `org-html-export-to-html' if the features it offers are needed and add a :menu-entry to enable running from the export dispatcher under the html choices.
HTH,
Chuck
prev parent reply other threads:[~2019-08-29 18:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-29 0:59 HTML export with LaTeX babel blocks Michaël Cadilhac
2019-08-29 18:13 ` Berry, Charles [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ED4A78F8-4C26-4412-94B7-8A8C71364889@ucsd.edu \
--to=ccberry@ucsd.edu \
--cc=emacs-orgmode@gnu.org \
--cc=michael@cadilhac.name \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).