Re: reStructuredText for notes, blogs, scientific articles and programming documentation?

Oleksandr Gavenko <[email protected]>
Newsgroups gmane.text.docutils.user
Organization Oleksandr Gavenko <[email protected]>, http://defun.work/
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.