explicit link

This commit is contained in:
gwen 2024-01-23 14:16:25 +01:00
parent 75bf8c791e
commit a7b3a4aff0

View file

@ -3,7 +3,8 @@
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. You will find all the options to :doc:`customize the directories structure used <configuration>`. In the following examples, we will use a specific configuration of Rougail.
You will find all the configuraiton options in :doc:`configuration`.
To load the configuration you must import the `RougailConfig` class and set the `dictionaries_dir` values: To load the configuration you must import the `RougailConfig` class and set the `dictionaries_dir` values:
@ -31,16 +32,16 @@ Here is a first :file:`dict/00-base.yml` dictionary:
Then, let's create the :term:`Tiramisu` objects via the following script: Then, let's create the :term:`Tiramisu` objects via the following script:
.. code-block:: python .. code-block:: python
:caption: the `script.py` file content :caption: the `script.py` file content
from rougail import Rougail, RougailConfig from rougail import Rougail, RougailConfig
RougailConfig['dictionaries_dir'] = ['dict'] RougailConfig['dictionaries_dir'] = ['dict']
rougail = Rougail() rougail = Rougail()
config = rougail.get_config() config = rougail.get_config()
print(config.value.get()) print(config.value.get())
Let's execute `script.py`: Let's execute `script.py`:
.. code-block:: bash .. code-block:: bash
@ -76,9 +77,9 @@ Then let's create an extra :term:`dictionary` :file:`extras/00-base.yml`:
Then, let's create the :term:`Tiramisu` objects via the following :file:`script.py` script: Then, let's create the :term:`Tiramisu` objects via the following :file:`script.py` 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
RougailConfig['dictionaries_dir'] = ['dict'] RougailConfig['dictionaries_dir'] = ['dict']
@ -105,21 +106,21 @@ We create the complementary :term:`dictionary` named :file:`dict/01-function.yml
version: '1.0' version: '1.0'
my_variable_jinja: my_variable_jinja:
type: "string" type: "string"
default: default:
type: jinja type: jinja
jinja: "{{ return_no() }}" jinja: "{{ return_no() }}"
Then let's define the :func:`return_no` function in :file:`functions.py`: Then let's define the :func:`return_no` function in :file:`functions.py`:
.. code-block:: python .. code-block:: python
:caption: the :file:`functions.py` content :caption: the :file:`functions.py` content
def return_no(): def return_no():
return 'no' return 'no'
Then, let's create the :term:`Tiramisu` objects via the following script: Then, let's create the :term:`Tiramisu` objects via the following script:
.. code-block:: python .. code-block:: python
:caption: the `script.py` file content :caption: the `script.py` file content
from rougail import Rougail, RougailConfig from rougail import Rougail, RougailConfig