Python-Sphinx:如何为 qthelp builder 填写关键字字段

Python-Sphinx: how to fill the keyword fields for qthelp builder

我正在使用 Sphinx 生成我的应用程序的文档,以便使用 QtHelpEngine. Hence I'm using the qthelp 构建器查看。

我不明白如何从用作源的 reStructuredText 正确创建 qhp 文件的关键字部分。

默认情况下 sphinx 创建一个空标签:

<keywords>

</keywords>

然后 linksForIdentifier()linksForKeyword() return 一个空 QMap.

Sphinx 使用它在文档项目索引中使用的相同内容填充关键字。您会找到有关如何创建索引生成标记的概述 here in the Sphinx documentation (Steve Piercy's 假设是正确的)。

例如,如果我们有一个文件 this/is/an/example.rst,其中包含此 Python 域指令:

.. py:function:: lorem(ispsum)

   Lorems the provided ipsum.

,我们在 .qhp 文件中的 keywords 标签包含以下关键字:

<keyword name="lorem() (built-in function)" ref="this/is/an/example.html#lorem"/>

显式创建的索引条目的示例是:

.. index::
   single: lorem

,创建以下关键字(让我们再次假设文件是​​ this/is/an/example.rst):

<keyword name="lorem" ref="this/is/an/example.html#index-0"/>