ram*_*gal 5 restructuredtext documentation-generation python-sphinx
使用Sphinx 1.1.3时,如何创建.. glossary::未显示在自动生成的索引中的条目?
我:noindex:在四个地方尝试过:
词汇表前后会使词汇表消失。
.. :noindex: glossary::
`term`
definition
.. glossary:: :noindex:
`term`
definition
Run Code Online (Sandbox Code Playgroud)
加上该字词会使该字词可点击并显示:noindex:。
.. glossary::
:noindex: `term`
definition
.. glossary::
`term` :noindex:
definition
Run Code Online (Sandbox Code Playgroud)
我的学期有特殊字符,所以我故意用反引号将其括起来。
据我了解,该glossary指令为每个术语创建了挂钩,可以从文档中的任何位置轻松引用这些术语;这将最终出现在某个地方的索引中,至少在构建时内部如此。
要解决此问题,您可以使用标准定义列表:
term_1
definition for term_1
term_2
definition for term_2
Run Code Online (Sandbox Code Playgroud)
这些定义将仅写入本地,不会出现在主索引中。有关语法的更多详细信息,请参阅reST 文档。
如果您想在此类列表中明确包含某些术语,您可以使用该:index:角色。
:index:`term_3`
definition for an indexed term
Run Code Online (Sandbox Code Playgroud)
这些术语现在将出现在索引中。然而,除非术语非常少,否则这是一种笨拙的方式来实现术语表的功能。并失去了使用交叉引用的能力(使用语法:term:`term_1`)。