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( |
|
|
97 | with TemporaryDirectory() as dirname: | |
|
98 | return { | |
|
99 | 'text/html': sphx.sphinxify(doc, dirname), | |
|
100 | 'text/plain': doc | |
|
101 |
|
|
|
96 | def sphinxify(oinfo): | |
|
97 | wrapped_docstring = sphx.wrap_main_docstring(oinfo) | |
|
98 | ||
|
99 | def sphinxify_docstring(docstring): | |
|
100 | with TemporaryDirectory() as dirname: | |
|
101 | return { | |
|
102 | "text/html": sphx.sphinxify(wrapped_docstring, dirname), | |
|
103 | "text/plain": docstring, | |
|
104 | } | |
|
105 | ||
|
106 | return sphinxify_docstring | |
|
102 | 107 | except ImportError: |
|
103 | 108 | sphinxify = None |
|
104 | 109 | |
@@ -919,7 +924,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
919 | 924 | while p.is_symlink(): |
|
920 | 925 | p = Path(os.readlink(p)) |
|
921 | 926 | paths.append(p.resolve()) |
|
922 | ||
|
927 | ||
|
923 | 928 | # In Cygwin paths like "c:\..." and '\cygdrive\c\...' are possible |
|
924 | 929 | if p_venv.parts[1] == "cygdrive": |
|
925 | 930 | drive_name = p_venv.parts[2] |
@@ -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