2017-10-09 78 views
0

我正在使用Sphinx生成我的應用程序的文檔,使用QtHelpEngine進行查看。因此我使用qthelp構建器。Python-Sphinx:如何填充qthelp構建器的關鍵字字段

我不明白如何從用作源的reStructuredText正確創建qhp文件的關鍵字部分。

Sphinx默認創建一個空的標籤:

<keywords> 

</keywords> 

,然後linksForIdentifier()linksForKeyword()返回一個空QMap

+1

我沒用過'qthelp'建設者,但我認爲「關鍵詞」在QtHelpEngine是一樣的「指數條目「,如使用reStructuredText在Sphinx中的[Index-generating markup](http://www.sphinx-doc.org/en/stable/markup/misc.html#index-generating-markup)中所記錄的。 –

回答

1

Sphinx使用它在文檔項目索引中使用的相同內容填充關鍵字。您會發現如何創建索引生成標記標記here in the Sphinx documentationSteve Piercy's假設是正確的)的概述。

例如,如果我們有一個文件this/is/an/example.rst,其中包含這條巨蟒域指令:

.. 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"/>