def setup(app): return 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('python', myLexer);
def analyse_text(text): rv = JavaLexer.analyse_text(text) - 0.01 if looks_like_xml(text): rv += 0.4 if '<%' in text and '%>' in text: rv += 0.1 return rv
def analyse_text(text): rv = JavaLexer.analyse_text(text) - 0.01 if looks_like_xml(text): rv += 0.4 if "<%" in text and "%>" in text: rv += 0.1 return rv