From: Oleksandr G. <gav...@gm...> - 2016-02-15 22:31:50
|
On 2016-02-13, Guenter Milde wrote: >> Can arbitrary code be run during document generation? > >> Recently I see books/cources/sci reports like: > >> https://github.com/bcaffo/courses > >> which uses "R Markdown": > >> http://rmarkdown.rstudio.com/ > >> So final document have result of running R language on pages. > >> I would like to run Bash example. > >> Or instead of afraid to make mistake place bc, octave-cli or R code and/or >> values in resulted document in place. > > With standard docutils, you can use a Makefile to run/update examples that > generate files to include in rST. > > There are contributed extensions/pre-processors/frameworks for some > other input format inclusions. Ok. I see: http://docutils.sourceforge.net/docs/dev/rst/alternatives.html#code-execution It's too dangerous (or too complicated in the case of "eval"). We do not want to have such things in the core. With include directive and build scripts that would be easy:: http://docutils.sourceforge.net/docs/ref/rst/directives.html#including-an-external-document-fragment $ python example.py >example.out .. include:: example.py :code: python .. include:: example.out :code: python For placing example.py inside RST document and rendering both text and result of run I think I should add support for custom directive. -- http://defun.work/ |