Ticket #5654: tracpygments-options.diff
| File tracpygments-options.diff, 1.7 KB (added by , 18 years ago) |
|---|
-
__init__.py
60 60 to override the default quality ratio used by the 61 61 Pygments render.""") 62 62 63 64 65 66 67 68 69 70 71 72 63 73 expand_tabs = True 64 74 returns_source = True 65 75 … … 218 228 Mimeview(self.env).configured_modes_mapping('pygments') 219 229 ) 220 230 231 232 233 234 235 236 237 238 239 240 221 241 def _highlight(self, language, content, annotate): 242 222 243 formatter = HtmlFormatter(cssclass=not annotate and 'code' or '') 223 html = pygments.highlight(content, get_lexer_by_name(language), 244 opts = self._options.get(language, {}) 245 opts['stripnl'] = False 246 lexer = get_lexer_by_name(language, **opts) 247 html = pygments.highlight(content, lexer, 224 248 formatter).rstrip('\n') 225 249 if annotate: 226 250 return html[len('<div><pre>'):-len('</pre></div>')].splitlines()
