[Doc-SIG] directive for flexible literate programming support?

David Goodger goodger at python.org
Tue Dec 9 17:53:30 EST 2003

Frank Siebenlist wrote:
 > I'm currently using rst to write haskell literate programs.
 > The haskell interpreter will recognize the text as code if a line
 > starts with a ">".
 > To set the code apart, I use "Literal Blocks" for the code snippets.
 > Unfortunately, a literate block has to be indented, which doesn't
 > work well with the interpreter. So I use a one line script to change
 > the " >" into ">" to get rid of the space in the first column,
 > before feeding it to the interpreter.
 > This is not convenient and not very elegant...
 > Are there maybe other existing ways to make this easier?

This has come up before.  See the thread starting at
<http://thread.gmane.org/gmane.text.docutils.devel/777>, and
specifically the message at
<http://article.gmane.org/gmane.text.docutils.devel/790> which details
the issues involved.  I have no problem adding a generalized literal
block construct, providing those issues are properly addressed.  Of
course, the code has to be written too ;-).

Community participation is encouraged; without it, I doubt I'll get to
this any time soon.

 > If not, one option could be to introduce a directive that would
 > specify how to recognize literate blocks, like:
 > .. literate-block :: ">"
 > which would indicate that for rest of this file, a literate block
 > could also be identified with a block where the lines start with ">"
 > besides the normal whitespace indentation.

I don't think we need a parameterized approach.  I suspect a
generalized approach, as described in message 790 (link above) would
be more successful.

David Goodger    http://starship.python.net/~goodger
For hire: http://starship.python.net/~goodger/cv
Docutils: http://docutils.sourceforge.net/
(includes reStructuredText: http://docutils.sf.net/rst.html)

More information about the Doc-SIG mailing list