emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: wlharvey4 via Emacs-orgmode <emacs-orgmode@gnu.org>
To: emacs-orgmode@gnu.org
Subject: Inject value of macro into code using a variable
Date: Tue, 15 Oct 2019 09:37:18 -0700	[thread overview]
Message-ID: <C7438D69-71A9-4159-8690-4CE57ECD9F4B@mac.com> (raw)

Is it possible to inject the value of a macro into code using a variable?

I set a macro called ‘version’ with a version number at the top of my .org file.  I would like to do something like this:

#+macro:version Version 0.2.5

#+name:code-name
#+begin_src js :tangle some-file.js :var ver={{{version}}} :exports both :results output
const version = ver;
#+end_src

When this code is evaluated during export, there is an error:

org-babel-ref-resolve: Reference ‘{{{version}}}’ not found in this buffer

Regards,
Wesley

             reply	other threads:[~2019-10-15 16:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15 16:37 wlharvey4 via Emacs-orgmode [this message]
2019-10-15 19:42 ` Inject value of macro into code using a variable Nicolas Goaziou
2019-10-16  6:23 ` Fraga, Eric

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=C7438D69-71A9-4159-8690-4CE57ECD9F4B@mac.com \
    --to=emacs-orgmode@gnu.org \
    --cc=wlharvey4@mac.com \
    /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).