操作文档

注入文档

inject-documentation 节点将文档插入到生成的文档中。该节点是 object-typevalue-typemodify-function 节点的子节点。

<value-type>
    <inject-documentation mode="append | prepend | replace" format="native | target"
                          file="[file]" snippet="[label]">
        // the documentation
    </inject-code>
</value-type>

mode 属性的默认值为 replace

format 属性指定文档注入何时发生,它接受以下值:

  • native: 在XML<->Backend转换发生之前,因此注入的代码必须是有效的XML。

  • 目标:在XML<->后端转换发生后,因此注入的代码必须是有效的后端格式。

可选的 file 属性指定了文件名 (参见 Using Snippets From External Files)。

可选的 snippet 属性指定了片段标签 (参见 使用外部文件中的片段)。

目前唯一支持的后端是Sphinx。

如果注入的文档包含一个Sphinx函数指令,则不会自动生成指令。这可以用于向添加的函数添加参数文档。

修改文档

modify-documentation 节点允许您更改自动生成的文档。此节点是 object-typevalue-typemodify-function 节点的子节点。API Extractor 将来自 qdoc(Qt 文档工具)的 XML 转换为 .rst 文件,以便稍后使用 Sphinx 进行处理。您可以在转换发生之前修改 XML。

<modify-documentation xpath="...">
    <!-- new documentation -->
</modify-documentation>

xpath 属性是您想要修改的节点的 XPath