[New-bugs-announce] [issue2154] doc: better detection of python snippets for highliting
Amaury Forgeot d'Arc
report at bugs.python.org
Thu Feb 21 15:26:45 CET 2008
New submission from Amaury Forgeot d'Arc:
The new doc framework highlights python code, and looks very nice.
However, some snippets are not parseable by the compiler, and are thus
left unhighlighted. For example:
The vast majority of misses is because of lines containing "...", which
is not a valid expression (except in slices).
The attached patch tries to recognize some common patterns, and replaces
"..." by some valid identifier; "... continue processing ..." is also
Note that the replacements are done only to get a better answer to "is
this block a python code"; pygment still works on the original string.
I checked that all new highlighted blocks are actually python snippets.
(actually, except one in configfile.rst; but others similar blocks on
the same page were already wrongly given to the python lexer)
The patch also corrects some easy syntax errors in samples.
components: Documentation, Documentation tools (Sphinx)
nosy: amaury.forgeotdarc, georg.brandl
title: doc: better detection of python snippets for highliting
versions: Python 2.6
Added file: http://bugs.python.org/file9480/doc_highlight.patch
Tracker <report at bugs.python.org>
More information about the New-bugs-announce