Search code examples
pythonpython-sphinxrestructuredtextconfluence

How to build multiple pages in confluence using sphinx documentation


I am testing two python scripts plants.py and interpolate.py. Both the scripts are getting printed on the same page.

How to get these two scripts documented in two pages in confluence.

Currently, both the script documentation is getting saved in page name "plants".

index.rst file:

.. spectRRa documentation master file, created by
   sphinx-quickstart on Fri Apr 24 11:55:57 2020.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.


Plants
******************************
.. toctree::
   :maxdepth: 2
   :caption: Contents:


plants
=================

.. automodule:: plants
         :members:

interpolate
******************
.. toctree::
      :maxdepth: 2
      :caption: Contents:

interpolate
=================

.. automodule:: interpolate
            :members:

conf.py:

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.intersphinx',
    'sphinx.ext.ifconfig',
    'sphinx.ext.viewcode',
    'sphinx.ext.githubpages',
    'sphinxcontrib.confluencebuilder'
]

confluence_publish = True
confluence_space_name = 'DOCS'
confluence_server_url = '<>'
confluence_server_user = '<>'
confluence_server_pass = '<>'
#confluence_parent_page = 'Plants APIs'

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
    'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
    'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
    'preamble': '',
# Latex figure (float) alignment
    'figure_align': 'htbp',
}
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []

Solution

  • I got it, how to build multiple pages in confluence along with TOC page.

    The structure of index.rst should be below in cd docs/sources directory, where assets, plant,Site, pipeline are the name of the python script

    .. spectRRa documentation master file, created by
       sphinx-quickstart on Fri Apr 24 11:55:57 2020.
       You can adapt this file completely to your liking, but it should at least
       contain the root `toctree` directive.
    
    **API Docs**
    ***************
    .. toctree::
       assets
       plants
       pipelines
       sites

    Also create all individual rst file in cd docs/sources/ directory.

    Ex-For assets.py script,the assets.rst file will be below.

    .. spectRRa documentation master file, created by
     sphinx-quickstart on Fri Apr 24 11:55:57 2020.
     You can adapt this file completely to your liking, but it should at least
     contain the root `toctree` directive.
    
     .. toctree::
           :maxdepth: 2
           :caption: Contents:
    
    **Assets**
    =================
    
    .. automodule:: assets
        :members:

    Note-Pls don't change indentation otherwise, it won't work.

    Ref Link-Sphinx Documentation