123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- .. _configuration:
- =============
- Configuration
- =============
- ``sphinx-multiversion`` reads your Sphinx :file:`conf.py` file for configuration.
- As usual, you can also override certain options by using ``-D var=value`` on the command line.
- This is what the default configuration looks like:
- .. code-block:: python
-
- smv_tag_whitelist = r'^.*$'
-
- smv_branch_whitelist = r'^.*$'
-
- smv_remote_whitelist = None
-
- smv_released_pattern = r'^tags/.*$'
-
- smv_outputdir_format = '{ref.name}'
-
- smv_prefer_remote_refs = False
- You an override all of these values inside you :file:`conf.py`.
- .. note::
- You can check which tags/branches are matched by running ``sphinx-multiversion`` with the ``--dump-metadata`` flag.
- Tag/Branch/Remote whitelists
- ============================
- Tags, Branches and Remotes are included by `Regular Expressions <python_regex_>`_.
- Here are some examples:
- .. code-block:: python
- smv_tag_whitelist = r'^.*$'
- smv_tag_whitelist = r'^v\d+\.\d+$'
- smv_branch_whitelist = r'^.*$'
- smv_branch_whitelist = r'^(?!master).*$'
- smv_remote_whitelist = None
- smv_remote_whitelist = r'^.*$'
- smv_remote_whitelist = r'^(origin|upstream)$'
- .. note::
- To list values to match, you can use ``git branch``, ``git tag`` and ``git remote``.
- Release Pattern
- ===============
- A Regular Expression is used to determine if a version of the documentation has been released or if it's a development version.
- To allow more flexibility, the regex is evaluated over the full refname.
- Here are some examples:
- .. code-block:: python
- smv_released_pattern = r'^tags/.*$'
- smv_released_pattern = r'^heads/\d+\.\d+$'
- smv_released_pattern = r'^(tags/.*|heads/\d+\.\d+)$'
- smv_released_pattern = r'^(heads|remotes/[^/]+)/(?!:master).*$'
- .. note::
- To list all refnames , you can use:
- .. code-block:: bash
- git for-each-ref --format "%(refname)" | sed 's/^refs\///g'
- Output Directory Format
- =======================
- Each version will be built into a seperate subdirectory of the Sphinx output directory.
- The ``smv_outputdir_format`` setting determines the directory structure for the subdirectories. It is a new-style Python formatting string with two parameters - ``ref`` and ``config``.
- Here are some examples:
- .. code-block:: python
- smv_outputdir_format = '{ref.name}'
- smv_outputdir_format = '{ref.commit}'
- smv_outputdir_format = '{ref.commit:.7s}'
- smv_outputdir_format = '{ref.refname}'
- smv_outputdir_format = '{ref.source}/{ref.name}'
- smv_outputdir_format = 'versions/{config.release}'
- smv_outputdir_format = '{config.version}/{ref.name}'
- .. seealso::
- Have a look at `PyFormat <python_format_>`_ for information how to use new-stye Python formatting.
- .. _python_regex: https://docs.python.org/3/howto/regex.html
- .. _python_format: https://pyformat.info/
|