diff for dynamic family

This commit is contained in:
gwen 2025-11-05 09:47:42 +01:00
parent 5cc1e50669
commit e64a89990d

View file

@ -7,6 +7,9 @@ A dynamic family
In this section we will learn how to create a dynamically built family. In this section we will learn how to create a dynamically built family.
In a dynamically built family, instead of duplicating the definition of
identical variables in several families, they can be generated automatically.
.. prerequisites:: Reminder .. prerequisites:: Reminder
We handled the HTTPS mode in the previous section. But there's more modes to handle. We handled the HTTPS mode in the previous section. But there's more modes to handle.
@ -144,9 +147,6 @@ This identifier is a parameter that enables us to create two families named `htt
socks_proxy: socks_proxy:
description: "SOCKS Proxy" description: "SOCKS Proxy"
.. note:: The declaration syntax used is the :term:`Jinja <jinja>` templating syntax,
Jinja which is widely used in python.
.. attention:: Be careful when choosing your identifiers items: pay attention that the family .. attention:: Be careful when choosing your identifiers items: pay attention that the family
that will be dynamically created has not been declared before in some other that will be dynamically created has not been declared before in some other
YAML structure file. YAML structure file.
@ -155,6 +155,11 @@ This identifier is a parameter that enables us to create two families named `htt
build a `https_proxy` family and if this familiy already exists, build a `https_proxy` family and if this familiy already exists,
then rougail will raise a family/variable override warning. then rougail will raise a family/variable override warning.
When choosing a name,
- rougail will put it in lowercase
- only ASCII and `_` characters are allowed.
When we launch the rougail command line, we can have a look at the concrete families and variables that have appear: When we launch the rougail command line, we can have a look at the concrete families and variables that have appear:
.. code-block:: text .. code-block:: text
@ -186,6 +191,8 @@ We can see that the dynamic family has created:
as we wanted, containing an address and a port. as we wanted, containing an address and a port.
.. todo:: déplacer ce hidden dans une autre page
.. _conditional_hidden_family: .. _conditional_hidden_family:
A conditional hidden familiy A conditional hidden familiy
@ -248,7 +255,7 @@ it uses `use_for_https` variable:
.. keypoints:: Key points .. keypoints:: Key points
- We now know what a generic family is, with its identifier. - We now know what a dynamic family is, with its identifier.
- we now how to create default values for a variable that is calculated - we now how to create default values for a variable that is calculated
because it retrieves the value of another variable. because it retrieves the value of another variable.
- we know how to hide conditionaly a family with the same mechanism, - we know how to hide conditionaly a family with the same mechanism,