Thank you for replying. Unfortunately, it does not work.
I updated my Sphinx to 0.6.3 and Pygments to 1.1.1 (pygmentize -V).
Touched all my files, then added this to conf.py:
def setup(app):
from sphinx.highlighting import lexers
from pygments.lexers.compiled import JavaLexer
from pygments.filters import VisibleWhitespaceFilter
myLexer = JavaLexer()
myLexer.add_filter(VisibleWhitespaceFilter(spaces='!'));
app.add_lexer('java', myLexer);
This replaced all tabs in my Java code with eight "!" and all spaces
with "!" as expected.
When I tried option tabs='!', nothing changed.
When I tried option tabsize=4, nothing changed.
It seems like tabs have been replaced with spaces somewhere earlier in
the chain.
So, I tried to add this filter to other lexers (rest, none) [with
lexers['rest'].add_filter(...)], but none of that had any effect on
tabs or tabsize.
On Nov 8, 5:22 pm, Georg Brandl <[email protected]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Georg Brandl schrieb:
>
>
>
> > Zilupe schrieb:
> >> There are Java code snippets in my documentation. I indent code with
> >> tabs (not spaces). When I generate HTML output, it setstabwidth to 8
> >> characters which is annoying to me (i like 4). How do I change this
> >> value?
>
> >> I have found that there is a Pygments lexer option "tabsize", but I
> >> have no idea how to specify it for project-wide or snippet-specific
> >> use.
>
> > You can do something like this in your conf.py:
>
> > def setup(app):
> > from sphinx.highlighting import lexers
> > from pygments.lexers.compiled import JavaLexer
>
> > lexers['java'] = JavaLexer(tabsize=4)
>
> PS: While this is more or less a workaround, there is an issue (#207)
> which will eventually result in a proper API :)
>
> cheers,
> Georg
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.11 (GNU/Linux)
>
> iEYEARECAAYFAkr24kUACgkQN9GcIYhpnLAcwwCeMMcz0rMAS+l07pG1WvD/FsuI
> hsYAnjXpN9ezvA4mdxxZjR5MEnr9Zx+G
> =xWQv
> -----END PGP SIGNATURE-----
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---