覆盖 sphinx/docutils 中的默认字段名称限制 [英] Overriding the default field name limit in sphinx/docutils
问题描述
我正在使用 sphinx 为项目生成 html 文档.我广泛使用字段列表.
I am using sphinx for generating html documentation for a project. I make extensive use of field lists.
在生成 html 时,如果标签的长度最多为 14 个字符,则每个标签/值对将呈现为具有两个单元格的单个表格行.
When generating html, each label/value pair is rendered as a single table row with two cells if the lenght of the label is at most 14 characters.
如果一对标签的长度超过 14 个字符,标签/值将呈现为两个表格行.
If the label of one pair is longer than 14 characters, the label/values are rendered as two table rows.
我想将包装限制增加到更大的值(例如 40).我发现限制是由 docutils 的 --field-name-limit
选项控制的.但是,我找不到如何通过 sphinx 设置此值.
I want to increase the wrapping limit to a larger value (e.g. 40). I have found that the limit is controlled by the --field-name-limit
option of docutils. However, I can't find how to set this value through sphinx.
我在文档根目录中创建了一个 docutils.conf
文件,其内容如下:
I have created a docutils.conf
file in the documentation root with the following contents:
[general]
dump_settings: 1
dump_internals: 1
[html4css1 writer]
field_name_limit: 40
文件在我运行 sphinx 时被读取.由于 [general]
部分中的值,设置和内部结构被打印出来.在打印的值中,field_name_limit
打印的值为 40
.尽管如此,我描述的包装仍然出现在 html 输出中.
The file is read when I run sphinx. The settings and internals are printed - because of the values in the [general]
section. Among the printed values, field_name_limit
is printed to have value 40
. Despite all that, the wrapping I described still occurs in the html output.
如何设置 field_name_limit
的值以便获得所需的输出?
How do I set the value of field_name_limit
so that I get the desired output?
推荐答案
Sphinx-1.2 将支持 docutils.conf for html writer 如果没有异议.https://bitbucket.org/birkenfeld/sphinx/commits/67682aca
Sphinx-1.2 will support docutils.conf for html writer if no objection. https://bitbucket.org/birkenfeld/sphinx/commits/67682aca
这篇关于覆盖 sphinx/docutils 中的默认字段名称限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!