Yes, do send it in. In the Jython chapter I've got Java code and it would be
nice to pygment-ize that.
On Fri, Oct 17, 2008 at 1:00 PM, Gabriel Gellner <[EMAIL PROTECTED]>wrote:
>
> On Fri, Oct 17, 2008 at 10:27:44AM -0700, Glenn Hutchings wrote:
> >
> > Hi there. I posted this to comp.lang.python recently; no answers so
> > far. Then I spotted this group...
> >
> > I'm writing Sphinx documentation for a non-Python program. The program
> > has an input file syntax suitable for highlighting using Pygments but,
> > obviously, Pygments knows nothing about it. I've created a Pygments
> > lexer which should highlight things, but how do I tell Pygments about
> > the new lexer, short of manually adding the Python source to the
> > Pygments "lexers" directory (clearly the Wrong Thing)?
> >
> > I've scoured Sphinx, Pygments and setuptools documentation, and
> > seemingly the only way is to register a setuptools 'entry point' in
> > the setup() function -- but that seems to imply I'm installing a
> > Python package, which I'm not. Do I have to create one, or is there
> > another way?
> >
> You can register an extension in the Sphinx conf.py file, say you have a
> pygments extension called foo_highlighting (which is an importable module
> or
> package . . .). Then add the lines:
>
> # If your extensions are in another directory, add it here.
> sys.path.append('sphinxext')
>
> # Import support for foo syntax highlighting (lives
> # in the sphinxext directory defined above)
> import foo_highlighting
>
> # General configuration
> # ---------------------
>
> # Add any Sphinx extension module names here, as strings. They can be
> # extensions
> # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
> extensions = ['foo_highlighting']
>
> And you should be good to go (if your lexer is useful send it to the
> Pygments
> guys so we can all use it :-)
>
> Gabriel
>
> >
>
--
Bruce Eckel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sphinx-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sphinx-dev?hl=en
-~----------~----~----~----~------~----~------~--~---