Issue 14503: docs: "yield from" breaks Pygments syntax coloring in doc examples (original) (raw)

Created on 2012-04-05 08:04 by Ramchandra Apte, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
screenshot.png berker.peksag,2012-04-05 13:07
Messages (10)
msg157551 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2012-04-05 08:04
In http://docs.python.org/dev/whatsnew/3.3.html#pep-380-syntax-for-delegating-to-a-subgenerator , two code samples
msg157552 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2012-04-05 08:04
Whoops - In http://docs.python.org/dev/whatsnew/3.3.html#pep-380-syntax-for-delegating-to-a-subgenerator , two code samples are not highlighted.
msg157579 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-05 12:59
I'm not seeing any unhighlighted examples in that section.
msg157584 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2012-04-05 13:07
I can reproduce. See screenshot.png.
msg157587 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-05 13:47
Berker: you can reproduce the bug, or the fact that they are highlighted? The png looks like they are highlighted, so I assume the latter.
msg157589 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2012-04-05 13:56
> they are highlighted No. Keywords normally appear in bold font, and with another color. This is not the case in these blocks. Probably because the language detection does not work with the new "yield from" construct. Sphinx should always use the latest Python...
msg157593 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-05 14:11
Ah, you mean they are not *syntax* highlighted. Now I understand. Sorry for missing that. My understanding is that Sphinx does not use Python directly to parse the code and highlight it, it uses pygments, which uses regexes. So this basically amounts to a feature request for pygments.
msg157595 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2012-04-05 14:32
Not exactly. Sphinx first tries to see if the block is a Python script, and to do so it uses the Python compiler: https://bitbucket.org/birkenfeld/sphinx/src/164f59b2d946/sphinx/highlighting.py#cl-117 In case of SyntaxError, it treats the whole block as plain text and does not try to use pygmentq at all.
msg157596 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-05 14:44
Huh. Well, in another issue Georg said it was now possible to upgrade the doc build toolchain to Python3.
msg171647 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-09-30 16:15
I've updated the version of Pygments used by 3.3 and 3.4 branches, which fixes this and the "raise from" issue.
History
Date User Action Args
2022-04-11 14:57:28 admin set github: 58708
2012-09-30 16:15:01 georg.brandl set status: open -> closedversions: + Python 3.4, - Python 2.7, Python 3.2nosy: + georg.brandlmessages: + resolution: fixed
2012-09-29 17:40:13 chris.jerdonek set title: docs: 2 code examples not Pygmented (syntax color coded) -> docs: "yield from" breaks Pygments syntax coloring in doc examples
2012-09-29 17:32:31 chris.jerdonek link issue16084 superseder
2012-04-06 21:47:50 terry.reedy set title: docs:Code not highlighted -> docs: 2 code examples not Pygmented (syntax color coded)stage: needs patchtype: behaviorversions: + Python 2.7, Python 3.2, Python 3.3
2012-04-05 14:44:58 r.david.murray set messages: +
2012-04-05 14:32:18 amaury.forgeotdarc set messages: +
2012-04-05 14:11:24 r.david.murray set messages: +
2012-04-05 13:56:59 amaury.forgeotdarc set nosy: + amaury.forgeotdarcmessages: +
2012-04-05 13:47:42 r.david.murray set messages: +
2012-04-05 13:07:31 berker.peksag set files: + screenshot.pngnosy: + berker.peksagmessages: +
2012-04-05 12:59:13 r.david.murray set nosy: + r.david.murraymessages: +
2012-04-05 08:04:49 Ramchandra Apte set messages: +
2012-04-05 08:04:13 Ramchandra Apte create