python的sphinx-build重新格式化了第一个文件

时间:2014-11-03 20:06:59

标签: python python-sphinx

sphinx-build修改了我的RST文件的格式,我无法弄清楚如何让它停止。它只发生在我运行make html之后,我的IDE(PyCharm)没有进行格式化。

make html之前:

General use plots
-----------------

.. autosummary::
    :toctree: generated/

    Study.plot_gene
    Study.plot_event

make html之后:

General use plots
-----------------

.. autosummary::
:toctree: generated/

        Study.plot_gene
        Study.plot_event

这是我的make html命令(与sphinx-quickstart相同):

html:
    $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
    @echo
    @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

完整的前/后,加上我的conf.py位于:https://gist.github.com/olgabot/d8bb75b9d88bed19cb18

1 个答案:

答案 0 :(得分:1)

如果你的意思是文件正在被编辑,那么这是非常令人惊讶的 - 并且 - 一种疯狂的猜测 - 可能是因为extensions = [...]列表中列出的一个非标准Sphinx扩展。要发现哪一个,您可以尝试使用以下命令从.rst文件中删除写入权限:

chmod a-w general_use_plots.rst

除非尝试修改的模块非常聪明,否则它将尝试写入,甚至不首先检查权限位,并且当它尝试以写入模式打开文件时将被异常杀死。然后,您可以查看堆栈跟踪并(希望)了解哪个扩展程序的代码错误地尝试触摸您的来源。

如果您确实获得了堆栈跟踪,则可以将其添加到问题文本中。