for t, v in _strip_trailing_whitespace(HtmlFormatter._format_lines(self, iter(buf))):
yield t, v
+class PopupLatexFormatter(LatexFormatter):
+ def _filter_tokens(self, tokensource):
+ for ttype, value in apply_filters(tokensource, [StripDocTestFilter()]):
+ if ttype in Token.Sql:
+ if ttype is not Token.Sql.Link and ttype is not Token.Sql.Open:
+ yield Token.Literal, re.sub(r'(?:[{stop}|\n]*)$', '', value)
+ else:
+ continue
+ else:
+ yield ttype, value
+
+ def format(self, tokensource, outfile):
+ LatexFormatter.format(self, self._filter_tokens(tokensource), outfile)
+
def setup(app):
app.add_lexer('pycon+sql', PyConWithSQLLexer())
app.add_lexer('python+sql', PythonWithSQLLexer())
PygmentsBridge.html_formatter = PopupSQLFormatter
- #PygmentsBridge.latex_formatter = LatexFormatter
+ PygmentsBridge.latex_formatter = PopupLatexFormatter
\ No newline at end of file
used as the keys by default. Unset or false attributes are omitted
from the final dictionary.
- :param \**kw: Optional, alternate key names for url
- attributes::
+ :param \**kw: Optional, alternate key names for url attributes::
- # return 'username' as 'user'
- username='user'
+ # return 'username' as 'user'
+ username='user'
- # omit 'database'
- database=None
+ # omit 'database'
+ database=None
:param names: Deprecated. Same purpose as the keyword-based alternate names,
but correlates the name to the original positionally.