Show More
@@ -365,6 +365,13 b' def find_source_lines(obj):' | |||||
365 |
|
365 | |||
366 | return lineno |
|
366 | return lineno | |
367 |
|
367 | |||
|
368 | from pygments import highlight | |||
|
369 | from pygments.lexers import PythonLexer | |||
|
370 | from pygments.formatters import HtmlFormatter | |||
|
371 | ||||
|
372 | def pylight(code): | |||
|
373 | return highlight(code, PythonLexer(), HtmlFormatter(noclasses=True)) | |||
|
374 | ||||
368 |
|
375 | |||
369 | class Inspector(Colorable): |
|
376 | class Inspector(Colorable): | |
370 |
|
377 | |||
@@ -470,7 +477,7 b' class Inspector(Colorable):' | |||||
470 | lines = [] |
|
477 | lines = [] | |
471 | ds = getdoc(obj) |
|
478 | ds = getdoc(obj) | |
472 | if formatter: |
|
479 | if formatter: | |
473 | ds = formatter(ds) |
|
480 | ds = formatter(ds).get('plain/text', ds) | |
474 | if ds: |
|
481 | if ds: | |
475 | lines.append(head("Class docstring:")) |
|
482 | lines.append(head("Class docstring:")) | |
476 | lines.append(indent(ds)) |
|
483 | lines.append(indent(ds)) | |
@@ -607,7 +614,7 b' class Inspector(Colorable):' | |||||
607 | def code_formatter(text): |
|
614 | def code_formatter(text): | |
608 | return { |
|
615 | return { | |
609 | 'text/plain': self.format(text), |
|
616 | 'text/plain': self.format(text), | |
610 |
'text/html': |
|
617 | 'text/html': pylight(text) | |
611 | } |
|
618 | } | |
612 |
|
619 | |||
613 | if info['isalias']: |
|
620 | if info['isalias']: |
General Comments 0
You need to be logged in to leave comments.
Login now