##// END OF EJS Templates
Merge pull request #13508 from meeseeksmachine/auto-backport-of-pr-13503-on-7.x...
Matthias Bussonnier -
r27498:c850cbc0 merge
parent child Browse files
Show More
@@ -93,12 +93,17 b' from IPython.utils.contexts import NoOpContext'
93 try:
93 try:
94 import docrepr.sphinxify as sphx
94 import docrepr.sphinxify as sphx
95
95
96 def sphinxify(doc):
96 def sphinxify(oinfo):
97 wrapped_docstring = sphx.wrap_main_docstring(oinfo)
98
99 def sphinxify_docstring(docstring):
97 with TemporaryDirectory() as dirname:
100 with TemporaryDirectory() as dirname:
98 return {
101 return {
99 'text/html': sphx.sphinxify(doc, dirname),
102 "text/html": sphx.sphinxify(wrapped_docstring, dirname),
100 'text/plain': doc
103 "text/plain": docstring,
101 }
104 }
105
106 return sphinxify_docstring
102 except ImportError:
107 except ImportError:
103 sphinxify = None
108 sphinxify = None
104
109
@@ -1765,7 +1770,9 b' class InteractiveShell(SingletonConfigurable):'
1765 This function is meant to be called by pdef, pdoc & friends.
1770 This function is meant to be called by pdef, pdoc & friends.
1766 """
1771 """
1767 info = self._object_find(oname, namespaces)
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 if info.found:
1776 if info.found:
1770 pmethod = getattr(self.inspector, meth)
1777 pmethod = getattr(self.inspector, meth)
1771 # TODO: only apply format_screen to the plain/text repr of the mime
1778 # TODO: only apply format_screen to the plain/text repr of the mime
@@ -1812,7 +1819,11 b' class InteractiveShell(SingletonConfigurable):'
1812 with self.builtin_trap:
1819 with self.builtin_trap:
1813 info = self._object_find(oname)
1820 info = self._object_find(oname)
1814 if info.found:
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 return self.inspector._get_info(
1827 return self.inspector._get_info(
1817 info.obj,
1828 info.obj,
1818 oname,
1829 oname,
General Comments 0
You need to be logged in to leave comments. Login now