Sphinx extension for collecting external data for Sphinx build.
Project description
Complete documentation: http://sphinx-collections.readthedocs.io/en/latest/
Sphinx-Collections
Sphinx-Collections is a Sphinx extension to collect and generate additional files from different sources before Sphinx starts the overall build.
All collected and generated files get registered to the Sphinx Env and are therefore available during a Sphinx build.
It was created to support the following use cases:
Grab additional .rst or md files from outside the docs source folder.
Merge multiple Sphinx projects into one project
Generate .rst and .md files based on data on json files.
Internally Sphinx-Collections is based on a set of drivers, which support different use cases. Feel free to extend the list of available drivers by creating a PR in our github project.
Introduction
Sphinx-Collections gets completely configured by variables inside the conf.py file of your Sphinx project:
collections = { 'my_files': { 'driver': 'copy', 'source': '../../extra_files/' } }
The driver copy allows to copy local files into your Sphinx project. There are other drivers available, which support different use cases and and files locations.
By default all files get copied to _collections/ + collection_name, so in this example the complete path inside your documentation folder would be _collections/my_files/. The location can be set specific for each collection by using target option.
Then you can reference the copied files by using a toctree:
.. toctree:: _collections/my_files/index
Please see the documentation of the needed Driver to know which options are available and necessary.
Tag based collections
Use Sphinx tags to collect and integrate only needed data:
collections = { 'my_files': { 'driver': 'copy', 'source': '../../extra_files/' 'tags': ['user_manual'], # gets active, if "user_manual" is set as tag 'active': False, # by default, collection shall not be executed } }
Then run sphinx-build with -t option:
sphinx-build -b html -t user_manual . _build/html
Collection based content
Use if-collection to add content to a page only, if a specified collections has been executed successfully.
.. if-collection:: my_test, my_data
My Test & Data chapter
----------------------
.. toctree::
/_collections/my_test/index
/_collections/my_data/index
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sphinx-collections-0.0.1a1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d39182ab7460e8f32486b9dd4eaa704e2e8da14f168e4e1bc756c76737dc596f |
|
MD5 | 0276c77d8c62630783951edbc585fd8f |
|
BLAKE2b-256 | 8421303a5a69bfddf6537836f4988ef394ba2ffb60ca5ac2846cb217a8873721 |
Hashes for sphinx_collections-0.0.1a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2eda3de9be1960afe492758d0d8ce0f86c22d76a6ced311e4b9551721753031d |
|
MD5 | b9de8a7eea80051ef02e99df91daba94 |
|
BLAKE2b-256 | b9649120721bff1f3fe8bd4c763b3512b199d872c7cbd9d37ad5412d83f0b96e |