doc(typo): YAML sphinx coding standards
This commit is contained in:
parent
42d5762a5f
commit
6a87c23e2b
5 changed files with 57 additions and 6 deletions
|
|
@ -31,7 +31,7 @@ release = '1.0'
|
||||||
|
|
||||||
extensions = [
|
extensions = [
|
||||||
'sphinx.ext.extlinks', 'sphinx_lesson', 'sphinx.ext.todo',
|
'sphinx.ext.extlinks', 'sphinx_lesson', 'sphinx.ext.todo',
|
||||||
'sphinx.ext.extlinks', 'ext.xref', 'ext.extinclude'
|
'ext.xref', 'ext.extinclude'
|
||||||
]
|
]
|
||||||
|
|
||||||
#---- xref links ----
|
#---- xref links ----
|
||||||
|
|
@ -48,6 +48,7 @@ links = {
|
||||||
'tiramisu library': ('Tiramisu library homepage', 'https://forge.cloud.silique.fr/stove/tiramisu'),
|
'tiramisu library': ('Tiramisu library homepage', 'https://forge.cloud.silique.fr/stove/tiramisu'),
|
||||||
}
|
}
|
||||||
xref_links.update(links)
|
xref_links.update(links)
|
||||||
|
|
||||||
#---- ext links ----
|
#---- ext links ----
|
||||||
# **extlinks** 'sphinx.ext.extlinks',
|
# **extlinks** 'sphinx.ext.extlinks',
|
||||||
# enables syntax like
|
# enables syntax like
|
||||||
|
|
@ -55,7 +56,9 @@ xref_links.update(links)
|
||||||
extlinks = {'source': ('https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/%s',
|
extlinks = {'source': ('https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/%s',
|
||||||
'source: %s'),
|
'source: %s'),
|
||||||
'tiramisu': ('https://tiramisu.readthedocs.io/en/latest/%s', 'tiramisu: %s'),
|
'tiramisu': ('https://tiramisu.readthedocs.io/en/latest/%s', 'tiramisu: %s'),
|
||||||
|
'tutorial': ('https://forge.cloud.silique.fr/stove/rougail-tutorials/%s', 'tutorial %s'),
|
||||||
}
|
}
|
||||||
|
|
||||||
#---- options for HTML output ----
|
#---- options for HTML output ----
|
||||||
default_role = "code"
|
default_role = "code"
|
||||||
html_theme = "sphinx_rtd_theme"
|
html_theme = "sphinx_rtd_theme"
|
||||||
|
|
|
||||||
42
docs/documentation.rst
Normal file
42
docs/documentation.rst
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
Documentation standards
|
||||||
|
==========================
|
||||||
|
|
||||||
|
|
||||||
|
YAML bloc code
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
If you have some YAML
|
||||||
|
The rougail YAML follows the YAML 1.2 conventions,
|
||||||
|
you might encounter a warning like this one::
|
||||||
|
|
||||||
|
WARNING: Le lexème du bloc_littéral ' %YAML 1.2\n ---\n version: 1.1\n\n ...'
|
||||||
|
en tant que "yaml" a entraîné une erreur au niveau du jeton : '%'.
|
||||||
|
Réessayer en mode relaxé.
|
||||||
|
|
||||||
|
.. code-block:: rst
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
:caption: the :file:`dist/00-base.yml` file content
|
||||||
|
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
my_variable: my_value_extra # a simple variable
|
||||||
|
...
|
||||||
|
|
||||||
|
Because the sphinx-doc tool is not YAML 1.2 ready yet.
|
||||||
|
The solution is simple, just escape the `%` like this:
|
||||||
|
|
||||||
|
.. code-block:: rst
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
:caption: the :file:`dist/00-base.yml` file content
|
||||||
|
|
||||||
|
\%YAML 1.2
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
my_variable: my_value_extra # a simple variable
|
||||||
|
...
|
||||||
|
|
||||||
|
|
@ -86,7 +86,8 @@ Explained differently, Rougail allows you to easily implement an integration of
|
||||||
:caption: Notes
|
:caption: Notes
|
||||||
|
|
||||||
developer
|
developer
|
||||||
|
documentation
|
||||||
|
|
||||||
.. rubric:: Index page
|
.. rubric:: Index page
|
||||||
|
|
||||||
- :ref:`genindex`
|
- :ref:`genindex`
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,10 @@
|
||||||
Rougail is a configuration management library that allows you to load variables in a simple and convenient way.
|
Rougail is a configuration management library that allows you to load variables in a simple and convenient way.
|
||||||
|
|
||||||
In the following examples, we will use a specific configuration of Rougail.
|
In the following examples, we will use a specific configuration of Rougail.
|
||||||
You will find all the configuraiton options in :doc:`configuration`.
|
|
||||||
|
|
||||||
|
.. FIXME: You will find all the configuration options in doc:`configuration`
|
||||||
|
find a document with all the configuration options
|
||||||
|
|
||||||
To load the configuration you must import the `RougailConfig` class and set the `main_structural_directories` values:
|
To load the configuration you must import the `RougailConfig` class and set the `main_structural_directories` values:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ Then let's create an structual file:term:`structure file` :file:`dist/00-base.ym
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
:caption: the :file:`dist/00-base.yml` file content
|
:caption: the :file:`dist/00-base.yml` file content
|
||||||
|
|
||||||
%YAML 1.2
|
\%YAML 1.2
|
||||||
---
|
---
|
||||||
version: 1.1
|
version: 1.1
|
||||||
|
|
||||||
|
|
@ -66,7 +66,8 @@ Let's execute `script.py`:
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ python3 script.py
|
$ python3 script.py
|
||||||
ERROR: option "Directories where structural files are placed" is mandatory but hasn't value
|
|
||||||
|
ERROR: option "Directories where structural files are placed" is mandatory but has no value
|
||||||
|
|
||||||
As expected, the .rougailcli.yml file is not loaded because it is specific to the command line.
|
As expected, the .rougailcli.yml file is not loaded because it is specific to the command line.
|
||||||
|
|
||||||
|
|
@ -147,7 +148,7 @@ To reproduce this:
|
||||||
Do this script:
|
Do this script:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
:caption: the :file:`script.py` file content
|
:caption: the :file:`script.py` file content
|
||||||
|
|
||||||
from rougail import Rougail, RougailConfig
|
from rougail import Rougail, RougailConfig
|
||||||
from rougail.cli.rougailconfig import load
|
from rougail.cli.rougailconfig import load
|
||||||
|
|
@ -161,5 +162,6 @@ Do this script:
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ python3 script.py --main_structural_directories dist/ --step.output json --main_namespace=new_test
|
$ python3 script.py --main_structural_directories dist/ --step.output json --main_namespace=new_test
|
||||||
{<TiramisuOption path="new_test">: {<TiramisuOption path="new_test.my_variable">: 'my_value_extra'}
|
{<TiramisuOption path="new_test">: {<TiramisuOption path="new_test.my_variable">: 'my_value_extra'}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue