Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2830
| From | Hans Georg Schaathun <hg@schaathun.net> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Literate Programming |
| Date | 2011-04-08 10:01 +0100 |
| Organization | University of Bergen |
| Message-ID | <3hv278-be4.ln1@svn.schaathun.net> (permalink) |
| References | <r7b178-602.ln1@svn.schaathun.net> <mailman.123.1302211326.9059.python-list@python.org> |
On Thu, 07 Apr 2011 16:21:52 -0500, Robert Kern
<robert.kern@gmail.com> wrote:
: http://sphinx.pocoo.org/markup/code.html
:
: As far as I can tell, it just works. See here for an example:
:
: http://ipython.scipy.org/doc/nightly/html/interactive/reference.html
Maybe I did not express myself clearly. I don't have a problem with
highlighting or indentation within a single, complete and continuous
block of code.
I get trouble when I insert explaining text within nested blocks,
especially when I do it at different levels of indentation.
In the pages you cite, I cannot find a single example which tries to
do this.
So something like this is fine:
<code>
# This is a long and complex block::
if mytest():
for i in myList():
foobar(i)
else:
for i in yourList():
boofar(i)
</code>
If I do the following, sphinx cannot keep up ...
<code>
# This block should be explained step by step::
if mytest():
# Bla, blah blah...
#
# ::
for i in myList():
# The :func:`foobar` function is an interesting choice here ... blah
#
# ::
foobar(i)
# Otherwise, myList might not be defined, so we need yours::
else:
# More blah...
#
# ::
for i in yourList():
# And here we go again::
boofar(i)
</code>
Highlighting tends to break starting from `else', and indentation breaks
at the second or third level.
--
:-- Hans Georg
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
Literate Programming Hans Georg Schaathun <hg@schaathun.net> - 2011-04-07 19:09 +0100
Re: Literate Programming jkn <jkn_gg@nicorp.f9.co.uk> - 2011-04-07 12:31 -0700
Re: Literate Programming Robert Kern <robert.kern@gmail.com> - 2011-04-07 16:21 -0500
Re: Literate Programming Hans Georg Schaathun <hg@schaathun.net> - 2011-04-08 10:01 +0100
Re: Literate Programming Jim <jim.hefferon@gmail.com> - 2011-04-08 05:22 -0700
Re: Literate Programming Hans Georg Schaathun <hg@schaathun.net> - 2011-04-08 20:21 +0100
Re: Literate Programming Jim <jim.hefferon@gmail.com> - 2011-04-09 03:45 -0700
Re: Literate Programming Hans Georg Schaathun <hg@schaathun.net> - 2011-04-09 16:20 +0100
Re: Literate Programming "Tim Arnold" <tim.arnold@sas.com> - 2011-04-08 12:58 -0400
Re: Literate Programming Hans Georg Schaathun <hg@schaathun.net> - 2011-04-09 16:25 +0100
Re: Literate Programming "Tim Arnold" <tim.arnold@sas.com> - 2011-04-11 12:39 -0400
csiph-web