dynamically built fam

This commit is contained in:
gwen 2026-01-23 16:54:36 +01:00
parent ed09bfd4ae
commit 9a78088cc6
2 changed files with 34 additions and 17 deletions

View file

@ -1,7 +1,7 @@
.. _dynfam:
A dynamic family
================
A dynamically built family
==========================
.. objectives:: Objectives
@ -49,10 +49,10 @@ in one shot?
The interesting point here is that they are very similar in our firefox's
configuration and that we can do batch processing.
.. index:: dynamic family
.. index:: dynamically built family
Family: a dynamic family
----------------------------
Family: A dynamically built family
-------------------------------------
With Rougail, it is possible to create some kind of a model of family.
Kind of a generic family declaration.
@ -139,7 +139,7 @@ that allow us to define dynamically family names.
identifier
In the :ref:`dynamic family creation field <dynfam>` we call an identifier
In the :ref:`dynamically built family creation field <dynfam>` we call an identifier
an item that defines a family name. An item is a variable on which an iteration
on keywords will be carried out.
@ -172,7 +172,7 @@ This identifier is a parameter that enables us to create two families named `htt
that will be dynamically created has not been declared before in some other
YAML structure file.
If you define a dynamic family with the `https` item that will
If you define a dynamically built family with the `https` item that will
build a `https_proxy` family and if this familiy already exists,
then rougail will raise a family/variable override warning.
@ -181,11 +181,11 @@ This identifier is a parameter that enables us to create two families named `htt
- rougail will put it in lowercase
- only ASCII and underscore ("`_`") characters are allowed.
Here is our dynamic familiy in situation in the :file:`firefox/20-manual.yml` structure file.
Here is our dynamically built familiy in situation in the :file:`firefox/20-manual.yml` structure file.
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_060/firefox/20-manual.yml
:language: yaml
:caption: The :file:`firefox/20-manual.yml` structure file with the dynamic families declaration
:caption: The :file:`firefox/20-manual.yml` structure file with the dynamically built families
..
%YAML 1.2
@ -269,7 +269,7 @@ The Rougail CLI outputs this:
┣━━ 📓 SOCKS address: ...
┗━━ 📓 SOCKS port: ...
We can see that the dynamic families have been created:
We can see that the dynamically built families that have been created:
- an `HTTPS Proxy` family
- a `SOCKS Proxy` family
@ -394,7 +394,7 @@ The Rougail CLI outputs this:
.. keypoints:: Key points
- We now know how to build a dynamic family is, with setting its identifier.
- We now know how to declare a dynamically built family, with setting its identifier.
- we have a new use case for the `disabled` property.
We know how to disable conditionaly a dynamic family.
We know how to disable a dynamically built family based on its identifier.

View file

@ -1,5 +1,5 @@
Calculation with a jinja type
===============================
Playing with Jinja
====================
.. objectives:: Objectives
@ -8,11 +8,28 @@ Calculation with a jinja type
Up to now, our only way of dynamically (that is, during the runtime) calculating
a value is to point on another variable's value. But this is not the only way.
.. todo:: on peut aussi faire un exercice de ce genre pour la propriété mandatory
.. prerequisites:: Prerequisites
- We assume that Rougail's library is :ref:`installed <installation>` on your computer.
A jinja calculated variable's hidden property
------------------------------------------------
- It is possible to retrieve the current state of the various Rougail files manipulated in this tutorial step
by checking out the corresponding tag of the `rougail-tutorials` git repository.
Each tag corresponds to a stage of progress in the tutorial.
Of course, you can also decide to copy/paste or download the tutorial files contents while following the tutorial steps.
If you want to follow this tutorial with the help of the corresponding :tutorial:`rougail-tutorials git repository <src/branch/1.1>`,
this workshop page corresponds to the tags :tutorial:`v1.1_070 <src/tag/v1.1_070>` to :tutorial:`v1.1_072 <src/tag/v1.1_072>`
in the repository.
::
git clone https://forge.cloud.silique.fr/stove/rougail-tutorials.git
git switch --detach v1.1_070
A conditional hidden family with Jinja
---------------------------------------
GWEN
We can hide or disable some variables or families with other techniques than
pointing on a variable's value.