[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
custom function for org-babel src block export
From: |
David Bremner |
Subject: |
custom function for org-babel src block export |
Date: |
Mon, 25 Dec 2023 13:49:34 -0800 |
I am generating slides using org-beamer. I would like certain code
blocks to export as links containing URL-encoded content of the
block. As an example I would like the following block
#+begin_src stacker
(defvar x 1)
(deffun (f)
(defvar y 2)
(deffun (h)
(+ x y))
(h))
(f)
#+end_src
would be exported as something like
\href{https://www.example.com/stacker/?program=%28defvar%20x%201%29%0A%28deffun%20%28f%29%0A%20%20%28defvar%20y%202%29%0A%20%20%28deffun%20%28h%29%0A%20%20%20%20%28+%20x%20y%29%29%0A%20%20%28h%29%29%0A%28f%29}{execute
on stacker}
I can do the encoding easily enough (see end), but I did not see a way
of hooking that up to org-babel, while retaining the ability to also use
minted or listings for other blocks.
I need the ability to use noweb expansion, so using a custom block type
seems unattractive (at least at first glance).
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar stacker-base
"\href{https://www.example.com/stacker/?program=%}{execute on stacker}")
(defun db-stacker-link (prog)
(format stacker-base
(org-link-encode prog '(?? ? ?( ?) ?\n))))
- custom function for org-babel src block export,
David Bremner <=