all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* custom function for org-babel src block export
@ 2023-12-25 21:49 David Bremner
  2023-12-25 21:57 ` Ihor Radchenko
  2023-12-26 13:12 ` Rudolf Adamkovič
  0 siblings, 2 replies; 6+ messages in thread
From: David Bremner @ 2023-12-25 21:49 UTC (permalink / raw)
  To: emacs-orgmode


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))))



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-12-26 14:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-25 21:49 custom function for org-babel src block export David Bremner
2023-12-25 21:57 ` Ihor Radchenko
2023-12-26  2:26   ` David Bremner
2023-12-26  6:31     ` David Bremner
2023-12-26 13:12 ` Rudolf Adamkovič
2023-12-26 14:36   ` David Bremner

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.