将Napoleon/Sphinx文档字符串转换为HTML的包装器。
项目描述
napoleon2html
此项目包含封装Sphinx或Napoleon文档字符串到HTML的函数。
文档
有三个函数可以使用:napoleon_to_sphinx()、sphinx_to_html()和napoleon_to_html()。
napoleon_to_sphinx()
此函数可以接受Napoleon格式的文档并将其转换为Sphinx。
用法
napoleon2html.napoleon_to_sphinx(""" Description of function Args: argument (str): Description of argument. Returns: int: Description of return. """)
输出
Description of function :Parameters: **argument** (*str*) -- Description of argument. :returns: *int* -- Description of return.
sphinx_to_html()
然后是sphinx_to_html(),它将Sphinx格式的字符串转换为HTML
napoleon2html.sphinx_to_html(""" Description of function :Parameters: **argument** (*str*) -- Description of argument. :returns: *int* -- Description of return. """)
输出
<blockquote> <p>Description of function</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><strong>argument</strong> (<em>str</em>) -- Description of argument.</td> </tr> <tr class="field"><th class="field-name">returns:</th><td class="field-body"><em>int</em> -- Description of return.</td> </tr> </tbody> </table> </blockquote>
napoleon_to_html()
最后一个函数是napoleon_to_html(),它封装了前两个。
变更日志
0.2.0
修复了MANIFEST.in中的错误。
0.1.0
项目创建。