To increase modularisation of my emacs code blocks I'm attempting to factor out common functionality into separate function blocks. I'm running into difficulties with chaining
:post calls, and using
:stdin for the filter blocks. I've composed this minimal example showing the workaround I used for
stdin (and an unsuccessful attempt), and where I'd like to "chain" post-processing functions at will. Executing the first block results in a colored rendering of
ip route to HTML-Code.
#+Title: My Tower of Babel * Functions These functions need =grc= and =ansi2html= installed. ** Data Generation *** IP-Routes #+NAME: IP-Routes #+HEADER: :post GRC(cfg="ip", grcraw=*this*) #+BEGIN_SRC shell :wrap HTML :results verbatim ip route #+END_SRC ** Post-Processing *** ANSI2HTML #+NAME: ANSI-TO-HTML #+BEGIN_SRC shell :var ansiraw="[0m[44mdata[0m" :results verbatim echo -n "$ansiraw" | ansi2html -n -w #+END_SRC *** GRC #+NAME: GRC #+HEADER: :var cfg="df" :var grcraw="RAWDATA" :post ANSI-TO-HTML(ansiraw=*this*) #+BEGIN_SRC shell :results verbatim echo -n "$grcraw" | grcat conf.$cfg #+END_SRC *** columnator #+NAME: COLUMN #+HEADER: :var columnraw="a b c\n" #+HEADER: :prologue "echo \"$columnraw\" | " #+BEGIN_SRC shell column -t #+END_SRC
In the code above I use an ugly temporary variable to hold/transfer the contents of STDIN. How can I do without that? I attempted to use the
:prologueto get around that to no avail. Ideally, I'd like
*this*from the top block to just "flow" through.
With the above code I cannot use
GRCwithout rendering to HTML.
Now to add
COLUMNas additional "one-off" filter to
- Adding another
- Nesting them with various syntax attempts
- Adding another
So, in short, I'm misunderstanding something about chaining shell code blocks as a compose-able pipeline of post-processing filters for STDIN/STDOUT.