emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: custom function for org-babel src block export


From: Rudolf Adamkovič
Subject: Re: custom function for org-babel src block export
Date: Tue, 26 Dec 2023 14:12:08 +0100

How about:

(defvar stacker-base
  "\href{https://www.example.com/stacker/?program=%s}{execute on stacker}")

(defun org-babel-execute:stacker (body params)
  (format stacker-base 
          (org-link-encode body '(?? ?  ?( ?) ?\n))))

It works with noweb too:

#+NAME: last
#+BEGIN_SRC stacker :eval no
(f)
#+END_SRC

#+BEGIN_SRC stacker :noweb yes
(defvar x 1)
(deffun (f)
  (defvar y 2)
  (deffun (h)
    (+ x y))
  (h))
<<last>>
#+END_SRC

#+RESULTS:
: 
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}

Rudy
-- 
"Genius is 1% inspiration and 99% perspiration."
--- Thomas Alva Edison, 1932

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



reply via email to

[Prev in Thread] Current Thread [Next in Thread]