将napoleon/sphinx文档字符串转换为html的包装器。
napoleon2html的Python项目详细描述
拿破仑2html
此项目包含封装sphinx或 Napoleon文档字符串到HTML。
文件
有三个函数,可以使用:napoleon_to_sphinx()、sphinx_to_html()和napoleon_to_html()。
拿破仑到狮身人面像()
此函数可以获取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.
狮身人面像到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>
拿破仑到HTML()
最后一个函数是napoleon_to_html(),它将前两个函数包装起来。
更改日志
0.2.0
- Fixed bug in MANIFEST.in.
0.1.0
- Project created.