On Monday, September 17, 2012 5:17:58 PM UTC+2, Bryan wrote: > > If you make your highlight-language python3, then Sphinx won't perform > syntax checks before highlighting. > > That's what I found in sphinx documentation, but it is not true. I have looked in the sphinx.highlight module and there is in sphinx.highlight.PygmentsBridge.highlight_block method, somewhere in the middle check like this: ... elif lang in ('python3', 'py3') and source.startswith('>>>'):
# for py3, recognize interactive sessions, but do not try parsing... lexer = lexers['pycon3'] elif lang == 'guess': ... So it is just that sphinx want check interactive session in python3. Where really comes check is at the end of this method: # highlight via Pygments try: formatter = self.get_formatter(**kwargs) hlsource = highlight(source, lexer, formatter) if self.dest == 'html': return hlsource else: return hlsource.translate(tex_hl_escape_map_new) except ErrorToken: # this is most probably not the selected language, # so let it pass unhighlighted return self.unhighlighted(source) ie if there is any ErrorToken the whole block won't be highlighted. I am not sure but I think that it wouldn't check if the method add_filter('raiseonerror') of lexer was not called a few lines before this part of method. Besides, I want my code block written (mostly) in actionscript3 to be highlighted as such not as python3 ;-) Vitalije -- You received this message because you are subscribed to the Google Groups "sphinx-dev" group. To view this discussion on the web visit https://groups.google.com/d/msg/sphinx-dev/-/Gz5cKTM80twJ. To post to this group, send email to sphinx-dev@googlegroups.com. To unsubscribe from this group, send email to sphinx-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.