def html_markup(s): try: from sagenb.misc.sphinxify import sphinxify, is_sphinx_markup except ImportError: # sphinx not available def is_sphinx_markup(s): return False if is_sphinx_markup(s): try: return sphinxify(s) except: pass # Not in ReST format, so use docutils # to process the preamble ("**File:**" etc.) and put # everything else in a <pre> block. i = s.find("**Docstring:**") if i != -1: preamble = s[:i + 14] from docutils.core import publish_parts preamble = publish_parts(s[:i + 14], writer_name='html')['body'] s = s[i + 14:] else: preamble = "" return '<div class="docstring">' + preamble + '<pre>' + s + '</pre></div>'
def html_markup(s): from sagenb.misc.sphinxify import sphinxify, is_sphinx_markup if is_sphinx_markup(s): try: return sphinxify(s) except: pass # Not in ReST format, so use docutils # to process the preamble ("**File:**" etc.) and put # everything else in a <pre> block. i = s.find("**Docstring:**") if i != -1: preamble = s[:i+14] from docutils.core import publish_parts preamble = publish_parts(s[:i+14], writer_name='html')['body'] s = s[i+14:] else: preamble = "" return '<div class="docstring">' + preamble + '<pre>' + s + '</pre></div>'
s += sageinspect.sage_getdoc(obj, obj_name) s = s.rstrip() return html_markup(s.decode('utf-8')) def html_markup(s): try: from sagenb.misc.sphinxify import sphinxify, is_sphinx_markup except ImportError, msg: # sphinx not available def is_sphinx_markup(s): return False if is_sphinx_markup(s): try: return sphinxify(s) except: pass # Not in ReST format, so use docutils # to process the preamble ("**File:**" etc.) and put # everything else in a <pre> block. i = s.find("**Docstring:**") if i != -1: preamble = s[:i + 14] from docutils.core import publish_parts preamble = publish_parts(s[:i + 14], writer_name='html')['body'] s = s[i + 14:] else: preamble = "" return '<div class="docstring">' + preamble + '<pre>' + s + '</pre></div>'
s += '**Docstring:**' s += newline s += sageinspect.sage_getdoc(obj, obj_name) s = s.rstrip() return html_markup(s) def html_markup(s): try: from sagenb.misc.sphinxify import sphinxify, is_sphinx_markup except ImportError, msg: # sphinx not available def is_sphinx_markup(s): return False if is_sphinx_markup(s): try: return sphinxify(s) except: pass # Not in ReST format, so use docutils # to process the preamble ("**File:**" etc.) and put # everything else in a <pre> block. i = s.find("**Docstring:**") if i != -1: preamble = s[:i+14] from docutils.core import publish_parts preamble = publish_parts(s[:i+14], writer_name='html')['body'] s = s[i+14:] else: preamble = "" return '<div class="docstring">' + preamble + '<pre>' + s + '</pre></div>'
def html_markup(s): try: from sagenb.misc.sphinxify import sphinxify return sphinxify(s) except ImportError, msg: pass