Show More
@@ -93,12 +93,17 b' from IPython.utils.contexts import NoOpContext' | |||
|
93 | 93 | try: |
|
94 | 94 | import docrepr.sphinxify as sphx |
|
95 | 95 | |
|
96 |
def sphinxify( |
|
|
96 | def sphinxify(oinfo): | |
|
97 | wrapped_docstring = sphx.wrap_main_docstring(oinfo) | |
|
98 | ||
|
99 | def sphinxify_docstring(docstring): | |
|
97 | 100 | with TemporaryDirectory() as dirname: |
|
98 | 101 | return { |
|
99 |
|
|
|
100 |
|
|
|
102 | "text/html": sphx.sphinxify(wrapped_docstring, dirname), | |
|
103 | "text/plain": docstring, | |
|
101 | 104 | } |
|
105 | ||
|
106 | return sphinxify_docstring | |
|
102 | 107 | except ImportError: |
|
103 | 108 | sphinxify = None |
|
104 | 109 | |
@@ -1765,7 +1770,9 b' class InteractiveShell(SingletonConfigurable):' | |||
|
1765 | 1770 | This function is meant to be called by pdef, pdoc & friends. |
|
1766 | 1771 | """ |
|
1767 | 1772 | info = self._object_find(oname, namespaces) |
|
1768 | docformat = sphinxify if self.sphinxify_docstring else None | |
|
1773 | docformat = ( | |
|
1774 | sphinxify(self.object_inspect(oname)) if self.sphinxify_docstring else None | |
|
1775 | ) | |
|
1769 | 1776 | if info.found: |
|
1770 | 1777 | pmethod = getattr(self.inspector, meth) |
|
1771 | 1778 | # TODO: only apply format_screen to the plain/text repr of the mime |
@@ -1812,7 +1819,11 b' class InteractiveShell(SingletonConfigurable):' | |||
|
1812 | 1819 | with self.builtin_trap: |
|
1813 | 1820 | info = self._object_find(oname) |
|
1814 | 1821 | if info.found: |
|
1815 | docformat = sphinxify if self.sphinxify_docstring else None | |
|
1822 | docformat = ( | |
|
1823 | sphinxify(self.object_inspect(oname)) | |
|
1824 | if self.sphinxify_docstring | |
|
1825 | else None | |
|
1826 | ) | |
|
1816 | 1827 | return self.inspector._get_info( |
|
1817 | 1828 | info.obj, |
|
1818 | 1829 | oname, |
General Comments 0
You need to be logged in to leave comments.
Login now