Message158732
| Author |
taschini |
| Recipients |
docs@python, eric.araujo, ezio.melotti, georg.brandl, taschini |
| Date |
2012年04月19日.14:32:43 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1334845964.17.0.0394879643568.issue12947@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
As far as I can see, Sphinx has a global setting for trim_doctest_flags but lacks the possibility of locally disabling the trimming.
A quick workaround would be to have the following sphinx extension added:
class ProxyLexer(object):
def __init__(self, underlying):
self.__underlying = underlying
def __getattr__(self, attr):
return getattr(self.__underlying, attr)
def setup(app):
from sphinx.highlighting import lexers
if lexers is not None:
lexers['pycon-literal'] = ProxyLexer(lexers['pycon'])
lexers['pycon3-literal'] = ProxyLexer(lexers['pycon3'])
That would allow blocks marked as
.. code-block:: pycon-literal
or preceded by
.. highlight:: pycon-literal
to escape the trimming of doctest flags.
If that's of any interest I can submit a patch. |
|