使Sphinx检测对辅助配置/模板文件的更改 [英] Making Sphinx detect changes to auxiliary configuration/template files

查看:97
本文介绍了使Sphinx检测对辅助配置/模板文件的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Sphinx(v1.4.9,在Windows 7(64位)上使用Python 3.5.1)编写启用了MathJax的文档集。我想定义自定义LaTeX命令来清理源代码,因此我实现了通过添加 _templates\layout.html

I'm using Sphinx (v1.4.9, with Python 3.5.1 on Windows 7, 64-bit) to write a document set with MathJax enabled. I wanted to define custom LaTeX commands to clean up my source, so I implemented this approach by adding _templates\layout.html:

{% extends "!layout.html" %}
{% set script_files = script_files + ["_static/mjconf.js"] %}

并在 _static\mjconf.js 中定义我的自定义命令:

and defining my custom commands in _static\mjconf.js:

MathJax.Hub.Config({
  TeX: {
    Macros: {
      dsetarr: ['{\\small \\textsf{#1 Array } \\mathsf{(#2)} }', 2],
      dsettype: ['{\\small \\textsf{#1}}', 1],
      mtt: ['{\\texttt{#1}}' ,1],
      sgn: ['{\\mathrm{sgn}#1}', 1]
    }
  }
});

这一切都很好。

但是 ,每当我编辑 mjconf.js 以添加新命令或修改现有命令时,Sphinx都不会认识到配置已更改,因此简单的 make html 不会像编辑 conf.py 。我必须在 make html 之前 make clean 才能查看这些自定义MathJax命令的更改所产生的影响。

However, whenever I edit mjconf.js to add a new command or revise an existing one, Sphinx doesn't recognize that the configuration has changed and so a simple make html doesn't rebuild the docs like it does after an edit to conf.py. I have to make clean before the make html in order to see the effects of the changes to these custom MathJax commands.

如何通过重建整个文档集来配置Sphinx对编辑后的 mjconf.js 做出反应,就像修改后的 conf.py 一样吗?

How can I configure Sphinx to react to an edited mjconf.js by rebuilding the entire documentation set, just like it does for an edited conf.py?

推荐答案

make html -a ,但这不会反映文档中对交叉引用的更新。但是,如果您没有交叉引用更新,这将是最快的选择。

There's make html -a, but that will not reflect updates to cross-references in your documentation. This would be the fastest option, though, if you have no cross-reference updates.

还有 制作html -E

最后是 make clean html ,它会删除(清除)构建目录(如果您的makefile有),然后再次构建HTML。

Finally there is make clean html, which deletes (cleans) the build directory, if your makefile has it, then builds HTML again.

这篇关于使Sphinx检测对辅助配置/模板文件的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆