fix: update rougailconfig parameters
This commit is contained in:
parent
961cee372e
commit
96975461d0
1 changed files with 19 additions and 14 deletions
|
|
@ -6,13 +6,13 @@ Rougail is a configuration management library that allows you to load variables
|
|||
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 `main_structural_directories` values:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from rougail import RougailConfig
|
||||
|
||||
RougailConfig['dictionaries_dir'] = ['dict']
|
||||
RougailConfig['main_structural_directories'] = ['dict']
|
||||
|
||||
Let's convert a structure file
|
||||
-------------------------------
|
||||
|
|
@ -25,10 +25,13 @@ Here is a first :file:`dict/00-base.yml` structure file:
|
|||
|
||||
.. code-block:: yaml
|
||||
|
||||
%YAML 1.2
|
||||
---
|
||||
version: '1.1'
|
||||
version: 1.1
|
||||
|
||||
my_variable:
|
||||
default: my_value
|
||||
...
|
||||
|
||||
Then, let's create the :term:`Tiramisu` objects via the following script:
|
||||
|
||||
|
|
@ -37,7 +40,7 @@ Then, let's create the :term:`Tiramisu` objects via the following script:
|
|||
|
||||
from rougail import Rougail, RougailConfig
|
||||
|
||||
RougailConfig['dictionaries_dir'] = ['dict']
|
||||
RougailConfig['main_structural_directories'] = ['dict']
|
||||
rougail = Rougail()
|
||||
config = rougail.get_config()
|
||||
print(config.value.get())
|
||||
|
|
@ -83,7 +86,7 @@ For example, here's how to add an `example` namespace:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
RougailConfig['extra_dictionaries']['example'] = ['extras/']
|
||||
RougailConfig['extra_namespaces']['example'] = ['extras/']
|
||||
|
||||
Then let's create an extra :term:`structure file` :file:`extras/00-base.yml`:
|
||||
|
||||
|
|
@ -101,8 +104,8 @@ Then, let's create the :term:`Tiramisu` objects via the following :file:`script.
|
|||
|
||||
from rougail import Rougail, RougailConfig
|
||||
|
||||
RougailConfig['dictionaries_dir'] = ['dict']
|
||||
RougailConfig['extra_dictionaries']['example'] = ['extras/']
|
||||
RougailConfig['main_structural_directories'] = ['dict']
|
||||
RougailConfig['extra_namespaces']['example'] = ['extras/']
|
||||
rougail = Rougail()
|
||||
config = rougail.get_config()
|
||||
print(config.value.dict())
|
||||
|
|
@ -121,13 +124,15 @@ We create the complementary :term:`structure file` named :file:`dict/01-function
|
|||
|
||||
.. code-block:: yaml
|
||||
|
||||
%YAML 1.2
|
||||
---
|
||||
version: '1.1'
|
||||
version: 1.1
|
||||
|
||||
my_variable_jinja:
|
||||
type: "string"
|
||||
default:
|
||||
type: jinja
|
||||
jinja: "{{ return_no() }}"
|
||||
...
|
||||
|
||||
Then let's define the :func:`return_no` function in :file:`functions.py`:
|
||||
|
||||
|
|
@ -144,8 +149,8 @@ Then, let's create the :term:`Tiramisu` objects via the following script:
|
|||
|
||||
from rougail import Rougail, RougailConfig
|
||||
|
||||
RougailConfig['dictionaries_dir'] = ['dict']
|
||||
RougailConfig['extra_dictionaries']['example'] = ['extras/']
|
||||
RougailConfig['main_structural_directories'] = ['dict']
|
||||
RougailConfig['extra_namespaces']['example'] = ['extras/']
|
||||
RougailConfig['functions_file'] = 'functions.py'
|
||||
rougail = Rougail()
|
||||
config = rougail.get_config()
|
||||
|
|
@ -191,7 +196,7 @@ To add the new lipogram type in Rougail:
|
|||
.. code-block:: python
|
||||
|
||||
>>> from rougail import Rougail, RougailConfig
|
||||
>>> RougailConfig['dictionaries_dir'] = ['dict']
|
||||
>>> RougailConfig['main_structural_directories'] = ['dict']
|
||||
>>> RougailConfig['custom_types']['lipogram'] = LipogramOption
|
||||
|
||||
Now, we can use lipogram type.
|
||||
|
|
@ -224,7 +229,7 @@ We create a term:`structure file` named :file:`dict/01-upgrade.yml` with version
|
|||
.. code-block:: yaml
|
||||
|
||||
---
|
||||
version: '1.1'
|
||||
version: '1.0'
|
||||
my_variable:
|
||||
multi: true
|
||||
my_dyn_family:
|
||||
|
|
@ -236,7 +241,7 @@ We create a term:`structure file` named :file:`dict/01-upgrade.yml` with version
|
|||
.. code-block:: python
|
||||
|
||||
>>> from rougail import RougailUpgrade, RougailConfig
|
||||
>>> RougailConfig['dictionaries_dir'] = ['dict']
|
||||
>>> RougailConfig['main_structural_directories'] = ['dict']
|
||||
>>> upgrade = RougailUpgrade()
|
||||
>>> upgrade.load_dictionaries('dict_converted')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue