Show More
@@ -83,6 +83,18 b' from warnings import warn' | |||
|
83 | 83 | from logging import error |
|
84 | 84 | import IPython.core.hooks |
|
85 | 85 | |
|
86 | try: | |
|
87 | import docrepr.sphinxify as sphx | |
|
88 | ||
|
89 | def docformat(doc): | |
|
90 | dirname = tempfile.mkdtemp(prefix='ipython_sphinxify_') | |
|
91 | return { | |
|
92 | 'text/html': sphx.sphinxify(doc, dirname), | |
|
93 | 'text/plain': doc | |
|
94 | } | |
|
95 | except: | |
|
96 | docformat = None | |
|
97 | ||
|
86 | 98 | #----------------------------------------------------------------------------- |
|
87 | 99 | # Globals |
|
88 | 100 | #----------------------------------------------------------------------------- |
@@ -1528,7 +1540,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
1528 | 1540 | info = self._object_find(oname, namespaces) |
|
1529 | 1541 | if info.found: |
|
1530 | 1542 | pmethod = getattr(self.inspector, meth) |
|
1531 |
formatter = format_screen if info.ismagic else |
|
|
1543 | formatter = format_screen if info.ismagic else docformat | |
|
1532 | 1544 | if meth == 'pdoc': |
|
1533 | 1545 | pmethod(info.obj, oname, formatter) |
|
1534 | 1546 | elif meth == 'pinfo': |
@@ -546,11 +546,16 b' class Inspector(Colorable):' | |||
|
546 | 546 | title = header((title+":").ljust(title_width)) |
|
547 | 547 | out.append(cast_unicode(title) + cast_unicode(content)) |
|
548 | 548 | return "\n".join(out) |
|
549 | ||
|
549 | ||
|
550 | 550 | def _format_info(self, obj, oname='', formatter=None, info=None, detail_level=0): |
|
551 | 551 | """Format an info dict as text""" |
|
552 | info = self.info(obj, oname=oname, formatter=formatter, | |
|
552 | ||
|
553 | # hack docstring rendering | |
|
554 | info = self.info(obj, oname=oname, formatter=None, | |
|
553 | 555 | info=info, detail_level=detail_level) |
|
556 | if formatter: | |
|
557 | return formatter(info["docstring"]) | |
|
558 | ||
|
554 | 559 | displayfields = [] |
|
555 | 560 | def add_fields(fields): |
|
556 | 561 | for title, key in fields: |
General Comments 0
You need to be logged in to leave comments.
Login now