emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Question about using #+call to insert Org mode snippet with different noweb refs
@ 2019-05-10 17:32 Kaushal Modi
  0 siblings, 0 replies; only message in thread
From: Kaushal Modi @ 2019-05-10 17:32 UTC (permalink / raw)
  To: emacs-org list

[-- 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 --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-05-10 17:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-10 17:32 Question about using #+call to insert Org mode snippet with different noweb refs Kaushal Modi

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