On Wed, Jan 12, 2011 at 2:30 AM, Georg Brandl <ge...@python.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Am 12.01.2011 07:43, schrieb Kevin H: > > On Jan 12, 12:37 am, Kevin Horn <kevin.h...@gmail.com> wrote: > >> here is a page of output from a sphinx project: > http://twistedsphinx.funsize.net/projects/web/howto/resource-template... > >> > >> here is the source of that page: > http://twistedsphinx.funsize.net/_sources/projects/web/howto/resource... > >> > >> Near the end is a file included using the literalinclude directive. As > you > >> can see it is not being highlighted, though I think it should be. > >> It's just getting stuck in a <pre> tag. > >> > >> Every other literalinclude-ed file in this project works just fine. > >> > >> Things I have tried: > >> > >> * renaming the file from 'webquote.rtl' to webquote.py -- no change > >> * using the ':language: python' option on the literalinclude directive > -- no > >> change > >> * messing around with line endings -- no luck > >> * messing around with html entity escaping -- no luck > >> > >> I can highlight this code with no problem using pygments' 'pygmentize' > >> command line tool, so I don't think it's a problem with pygments. > >> > >> ??? > >> > >> Kevin Horn > > > > NEVERMIND! > > > > Apparently the process of writing my previous mail jogged my brain, > > because as soon as I'd sent it I found the problem. > > > > The code snippet is from the PTL template language (which comes with > > the Quixote web framework), which is almost (but not quite) valid > > Python. > > > > The problem is that PTL uses the keyword "template" rather than "def" > > when defining "functions". > > I tried replacing the template keyword with def, and bang zoom, we > > have syntax highlighting. > > > > So now my question is: > > > > Why will Pygments highlight this from the command line app, but not in > > Sphinx? > > Python code is syntax-checked before highlighting, since it's the default > highlight language, and this way you can put other code blocks in between > without having to mark them as not-Python. > > For your case, try "py3" as a highlighting language; it is not > syntax-checked. > > cheers, > Georg > Thanks Georg, that did the trick! Kevin Horn -- You received this message because you are subscribed to the Google Groups "sphinx-dev" group. To post to this group, send email to sphinx-...@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.