windows – 如何从命令行设置Sphinx的`exclude_patterns`?
我在
Windows上使用Sphinx.
我的大多数文档都是针对普通用户的,但有一些子页面仅包含管理员的内容. 所以我想构建我的文档的两个版本:完整版本和排除“管理”页面的第二个版本. 我用了 exclude_patterns = ['**/*admin*'] 问题是我想运行一次构建以获得两个版本. 我现在要做的是运行make.bat两次,并在每次运行时提供不同的参数. 所以现在我有一个看起来像这样的build.bat: path=%path%;c:python27scripts rem BUILD ADMIN DOCS set SPHINXOPTS= set BUILDDIR=c:buildadmin call make clean call make html rem BUILD USER DOCS set SPHINXOPTS=-D exclude_patterns=['**/*admin*'] set BUILDDIR=c:builduser call make clean call make html pause 当我从sphinx生成的make.bat文件中删除行集BUILDDIR = build时,两个不同目录中的构建工作. 但是,排除模式不起作用. Making output directory... Running Sphinx v1.1.3 loading translations [de]... done loading pickled environment... not yet created Exception occurred: File "C:Python27libsite-packagessphinx-1.1.3-py2.7.eggsphinxenvironment. py",line 495,in find_files ['**/' + d for d in config.exclude_dirnames] + TypeError: coercing to Unicode: need string or buffer,list found The full traceback has been saved in c:usersmyusernameappdatalocaltempsphinx-err-kmihxk.log,if you want to report the issue to the developers. Please also report this if it was a user error,so that a better error message can be provided next time. Either send bugs to the mailing list at <http://groups.google.com/group/sphinx-dev/>,or report them in the tracker at <http://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks! 我究竟做错了什么? 解决方法
我的第一个想法是,这是一个引用问题,引用着名的难以在Windows命令行上运行.但是,我无法想出任何改变行为的引用组合. (问题很容易复制)
当然它可能仍然只是一些引用问题,我不够聪明,但我怀疑这是某种Sphinx漏洞,并希望你将它报告给Sphinx开发人员. 与此同时,这是另一种解决方案: 引自here:
这允许您基本上从命令行将标志传递到conf.py文件中,并且由于conf.py文件只是Python,因此您可以使用if语句根据传入的标记有条件地设置exclude_patterns的值. 例如,您可以传递Sphinx选项,例如:
传递“foradmins”标签,然后在conf.py中检查它,如下所示: exclude_patterns = blah if tags.has('foradmins'): exclude_patterns = [] 这应该可以让你做你想做的事.祝好运! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- windows – mklink的一些GUI?
- windows-mobile – 如何使用c#将复选框放在windows mobile
- windows下nginx的安装及使用
- windows – 使用Golang限制为可执行文件的单个实例
- windows-7 – SSD硬盘RAID-0效率?
- windows-server-2008-r2 – 为什么终端服务在防火墙中打开W
- windows – WFPSampler编译问题 – 找不到wfpcalloutsclass
- windows-server-2008 – 2008 Server R2经典视图控制面板?
- windows搭建solr8.1.1
- active-directory – (主要)Windows(AD)环境中的Linux服务器
- gdi – 在Windows 10中带有标题栏的模糊窗口? W
- 主流服务器虚拟化技术简单使用——Hyper-V(二)
- windows-server-2008-r2 – SAN重建后无法销毁Wi
- windows-server-2003 – Active Directory复制问
- 隐藏在WiX中选中的复选框上的文本框
- Windows Phone 7 – 如何在WP7应用程序中隐藏应用
- windows-8 – 在.cpp文件中使用实现声明C/C++X W
- winapi – Win32 API提供的数据结构?
- 是否可以在Windows中对互斥锁进行静态初始化?
- 在一个windows cmd行中运行两个命令,一个命令是S