This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: doc: better detection of python snippets for highliting
Type: Stage:
Components: Documentation, Documentation tools (Sphinx) Versions: Python 2.6
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, georg.brandl
Priority: normal Keywords: patch

Created on 2008-02-21 14:26 by amaury.forgeotdarc, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
doc_highlight.patch amaury.forgeotdarc, 2008-02-21 14:26
Messages (2)
msg62623 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-02-21 14:26
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.
msg62658 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-02-21 20:40
Committed as r60938 (python) and r60939 (sphinx). Thanks for the nice patch!
Date User Action Args
2022-04-11 14:56:31adminsetgithub: 46407
2008-02-21 20:40:14georg.brandlsetstatus: open -> closed
resolution: accepted
messages: + msg62658
2008-02-21 14:26:10amaury.forgeotdarccreate