From: Matthias G. <mat...@gm...> - 2016-02-16 11:34:15
|
Hi Oleksandr. I don't know if that's what you're after, but I want to mention the Jupyter Notebook: http://jupyter.org/. It allows you to mix text, images, equations, code (and its output) in one "document". I supports R, Octave, Bash and many more languages: https://github.com/ipython/ipython/wiki/IPython-kernels-for-other-languages Jupyter notebooks can be included in Sphinx projects by means of the "nbsphinx" extension: http://nbsphinx.readthedocs.org/. With that, you can seamlessly mix your reST content and Jupyter notebooks. cheers, Matthias On Mon, Feb 15, 2016 at 11:31 PM, Oleksandr Gavenko wrote: > 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/ > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > _______________________________________________ > Docutils-users mailing list > Doc...@li... > https://lists.sourceforge.net/lists/listinfo/docutils-users > > Please use "Reply All" to reply to the list. |