[英]Commenting Python code in Sphinx
我正在为一些Python代码编写文档,但无法在其中正确插入注释。 我在.rst文件中编写的内容与在生成的html中显示的内容之间存在问题。 看起来像这样:
.rst文件:
.. sourcecode:: python
class Foo( argument_1, argument_2 ): # argument_1 is blabla, arg2 is..
def bar(): # method bar does ...
print 'foo' # another comment
def foo_bar(): # foo_bar method explanation
print 'foo_bar body' # ....
并且在生成的.html文件中,看起来很不错,只是注释未对齐:
.html文件:
class Foo( argument_1, argument_2 ): # argument_1 is blabla, arg2 is..
def bar(): # method bar does ...
print 'foo' # another comment
def foo_bar(): # foo_bar method explanation
print 'foo_bar body' # ....
有什么办法可以解决? 我在Ubuntu 11.04上使用gedit编写此文档。 我一直在尝试使用制表符的宽度,用空格替换制表符,但这没有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.