Show More
@@ -90,12 +90,17 b' sphinxify: Optional[Callable]' | |||||
90 | try: |
|
90 | try: | |
91 | import docrepr.sphinxify as sphx |
|
91 | import docrepr.sphinxify as sphx | |
92 |
|
92 | |||
93 |
def sphinxify( |
|
93 | def sphinxify(oinfo): | |
94 | with TemporaryDirectory() as dirname: |
|
94 | wrapped_docstring = sphx.wrap_main_docstring(oinfo) | |
95 | return { |
|
95 | ||
96 | 'text/html': sphx.sphinxify(doc, dirname), |
|
96 | def sphinxify_docstring(docstring): | |
97 | 'text/plain': doc |
|
97 | with TemporaryDirectory() as dirname: | |
98 |
|
|
98 | return { | |
|
99 | "text/html": sphx.sphinxify(wrapped_docstring, dirname), | |||
|
100 | "text/plain": docstring, | |||
|
101 | } | |||
|
102 | ||||
|
103 | return sphinxify_docstring | |||
99 | except ImportError: |
|
104 | except ImportError: | |
100 | sphinxify = None |
|
105 | sphinxify = None | |
101 |
|
106 | |||
@@ -772,7 +777,7 b' class InteractiveShell(SingletonConfigurable):' | |||||
772 | while p.is_symlink(): |
|
777 | while p.is_symlink(): | |
773 | p = Path(os.readlink(p)) |
|
778 | p = Path(os.readlink(p)) | |
774 | paths.append(p.resolve()) |
|
779 | paths.append(p.resolve()) | |
775 |
|
780 | |||
776 | # In Cygwin paths like "c:\..." and '\cygdrive\c\...' are possible |
|
781 | # In Cygwin paths like "c:\..." and '\cygdrive\c\...' are possible | |
777 | if p_venv.parts[1] == "cygdrive": |
|
782 | if p_venv.parts[1] == "cygdrive": | |
778 | drive_name = p_venv.parts[2] |
|
783 | drive_name = p_venv.parts[2] | |
@@ -1621,7 +1626,9 b' class InteractiveShell(SingletonConfigurable):' | |||||
1621 | This function is meant to be called by pdef, pdoc & friends. |
|
1626 | This function is meant to be called by pdef, pdoc & friends. | |
1622 | """ |
|
1627 | """ | |
1623 | info = self._object_find(oname, namespaces) |
|
1628 | info = self._object_find(oname, namespaces) | |
1624 | docformat = sphinxify if self.sphinxify_docstring else None |
|
1629 | docformat = ( | |
|
1630 | sphinxify(self.object_inspect(oname)) if self.sphinxify_docstring else None | |||
|
1631 | ) | |||
1625 | if info.found: |
|
1632 | if info.found: | |
1626 | pmethod = getattr(self.inspector, meth) |
|
1633 | pmethod = getattr(self.inspector, meth) | |
1627 | # TODO: only apply format_screen to the plain/text repr of the mime |
|
1634 | # TODO: only apply format_screen to the plain/text repr of the mime | |
@@ -1668,7 +1675,11 b' class InteractiveShell(SingletonConfigurable):' | |||||
1668 | with self.builtin_trap: |
|
1675 | with self.builtin_trap: | |
1669 | info = self._object_find(oname) |
|
1676 | info = self._object_find(oname) | |
1670 | if info.found: |
|
1677 | if info.found: | |
1671 | docformat = sphinxify if self.sphinxify_docstring else None |
|
1678 | docformat = ( | |
|
1679 | sphinxify(self.object_inspect(oname)) | |||
|
1680 | if self.sphinxify_docstring | |||
|
1681 | else None | |||
|
1682 | ) | |||
1672 | return self.inspector._get_info( |
|
1683 | return self.inspector._get_info( | |
1673 | info.obj, |
|
1684 | info.obj, | |
1674 | oname, |
|
1685 | oname, |
General Comments 0
You need to be logged in to leave comments.
Login now