From: Kaushal Modi <kaushal.modi@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>
Subject: Question about using #+call to insert Org mode snippet with different noweb refs
Date: Fri, 10 May 2019 13:32:51 -0400 [thread overview]
Message-ID: <CAFyQvY2w_t0BU5Yw8QZbiYMHMJQ044txckATytnqNUvwPaCCPg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2076 bytes --]
Hello,
I recently came across this awesome tool call wavedrom and was taking my
notes as I was following its tutorial: https://wavedrom.com/tutorial.html.
In order to prevent copy/pasting the same "wavedrom snippet" in the src
text block and the begin_export html block, I did the below. It works.. but
I wonder if this can be made more concise by using #+call.
If it's possible, what would be "called" org source block look like so that
I can pass it the noweb reference string?
Or .. what would be a concise way to write the below?
Thanks!
=====
*** Step {{{n(,1)}}}. The Signal
#+begin_src text :noweb-ref wavedrom-eg-1
{ signal: [{ name: "Alfa", wave: "01.zx=ud.23.45" }] }
#+end_src
#+begin_src org :noweb yes :exports results :results output replace
,#+begin_export html
<script type="WaveDrom">
<<wavedrom-eg-1>>
</script>
,#+end_export
#+end_src
#+RESULTS:
#+begin_export html
<script type="WaveDrom">
{ signal: [{ name: "Alfa", wave: "01.zx=ud.23.45" }] }
</script>
#+end_export
*** Step {{{n}}}. Adding Clock
#+begin_src text :noweb-ref wavedrom-eg-2
{ signal: [
{ name: "pclk", wave: 'p.......' },
{ name: "Pclk", wave: 'P.......' },
{ name: "nclk", wave: 'n.......' },
{ name: "Nclk", wave: 'N.......' },
{},
{ name: 'clk0', wave: 'phnlPHNL' },
{ name: 'clk1', wave: 'xhlhLHl.' },
{ name: 'clk2', wave: 'hpHplnLn' },
{ name: 'clk3', wave: 'nhNhplPl' },
{ name: 'clk4', wave: 'xlh.L.Hx' },
]}
#+end_src
#+begin_src org :noweb yes :exports results :results output replace
,#+begin_export html
<script type="WaveDrom">
<<wavedrom-eg-2>>
</script>
,#+end_export
#+end_src
#+RESULTS:
#+begin_export html
<script type="WaveDrom">
{ signal: [
{ name: "pclk", wave: 'p.......' },
{ name: "Pclk", wave: 'P.......' },
{ name: "nclk", wave: 'n.......' },
{ name: "Nclk", wave: 'N.......' },
{},
{ name: 'clk0', wave: 'phnlPHNL' },
{ name: 'clk1', wave: 'xhlhLHl.' },
{ name: 'clk2', wave: 'hpHplnLn' },
{ name: 'clk3', wave: 'nhNhplPl' },
{ name: 'clk4', wave: 'xlh.L.Hx' },
]}
</script>
#+end_export
=====
--
Kaushal Modi
[-- Attachment #2: Type: text/html, Size: 3270 bytes --]
reply other threads:[~2019-05-10 17:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=CAFyQvY2w_t0BU5Yw8QZbiYMHMJQ044txckATytnqNUvwPaCCPg@mail.gmail.com \
--to=kaushal.modi@gmail.com \
--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).