Skip to content
Advertisement

adding xml content to sphinx generated doc

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’ 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.

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.

Any help would be appreciated.

Regards, Bogdan

Advertisement

Answer

Looking at the documentation, it seems that literalinclude might be what you’re looking for:

.. literalinclude:: functions.xml
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement