emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Rudolf Adamkovič" <salutis@me.com>
To: David Bremner <david@tethera.net>, emacs-orgmode@gnu.org
Subject: Re: custom function for org-babel src block export
Date: Tue, 26 Dec 2023 14:12:08 +0100	[thread overview]
Message-ID: <m2h6k585w7.fsf@me.com> (raw)
In-Reply-To: <87r0jagdg1.fsf@tethera.net>

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


  parent reply	other threads:[~2023-12-26 13:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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č [this message]
2023-12-26 14:36   ` David Bremner

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=m2h6k585w7.fsf@me.com \
    --to=salutis@me.com \
    --cc=david@tethera.net \
    --cc=emacs-orgmode@gnu.org \
    /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).