将XML内容添加到Sphinx生成的文档 [英] adding xml content to sphinx generated doc
问题描述
这是我的问题.我正在尝试使用sphinx为我的项目生成文档,并设法获得基本工作,例如添加模块和图像.因此基本的index.rst看起来像:
So here is my problem. I'm trying to generate documentation for my project using sphinx and managed to get the basic working, like adding modules and images. So a basic index.rst would look like:
.. |tvb| replace:: `The Project`
.. _tvb: http://www.myproject.org
.. |logo| image:: img/evil_tvb_logo_transparent.svg
:alt: The Project
:align: top
:height: 148
:target: tvb_
|logo|
*******
My Modules
=========================
.. toctree::
:maxdepth: 6
tvb
'tvb'此处包含顶级模块以及子包等的链接.这似乎工作正常,并且相应地生成了html文档.
'tvb' here contains top level modules and links to sub-packages and so on. This seems to work fine and the html documentation is generated accordingly.
但是,我在项目的一部分中使用了一些xml定义的方法来调用一些matlab函数,并且我想使该内容也可用于sphinx,即使是纯文本或实际的xml也是如此. .我似乎找不到解决办法.因此,基本上,我将需要能够在例如pck1.pck2程序包中(如果我具有functions.xml),以便在该级别的目录中添加指向html的链接,该html将显示该xml中的内容.
However I have a couple of xml-defined methods that are used in part of the project to call some matlab functions, and I would like to make that content also available for sphinx, even if just as pure text or the actual xml. I can't seem to find a way to do this. So basically I would need to be able to for example in package: pck1.pck2 if i have functions.xml, to add in the toc at that level a link to a html that will display the content from that xml.
任何帮助将不胜感激.
关于, 博格丹
推荐答案
Looking at the documentation, it seems that literalinclude might be what you're looking for:
.. literalinclude:: functions.xml
这篇关于将XML内容添加到Sphinx生成的文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!