emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Using a code block as input to another code block


From: Berry, Charles
Subject: Re: Using a code block as input to another code block
Date: Sun, 22 Nov 2020 17:26:08 +0000

Inline.

> On Nov 21, 2020, at 2:30 PM, Magnus Therning <magnus@therning.org> wrote:
> 
> I know I can use an example block (literal example) as input to a code
> block, but I haven't found a way to fontify examples. Since my input is
> code (JSON, and various programming languages) I would really like to
> have that, as well as the language's mode when editing by using
> ~org-edit-source-code~.
> 
> A code block gives me fontification, but I haven't found a way to pass a
> code block as is to another code block.
> 
> For instance, something like this:
> 
> #+name: code-input
> #+begin_src C
> #include <foo.h>
> #+end_src
> 
> #+begin_src bash :var input=input :results verbatim
> cat <<EOF | cpp
> ${input}
> EOF
> #+end_src


Sounds like you want the :noweb header and code chunks, viz.
 
#+begin_src bash :noweb yes :results verbatim
cat <<EOF | cpp
<<code-input>>
EOF
#+end_src

HTH,

Chuck

[deleted]




reply via email to

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