This commit is contained in:
gwen 2025-12-02 11:52:21 +01:00
parent be4983e524
commit 65d4440694
2 changed files with 59 additions and 8 deletions

View file

@ -1,4 +1,4 @@
A variable with type `domainname`
The `domainname` and `port` types
==================================
.. objectives:: Objectives
@ -25,7 +25,7 @@ A variable with type `domainname`
.. type-along:: let's recap how far we've come
We have an `http_proxy` family with an `address` variable
We have an `http_proxy` family with an `address` variable.
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_030/firefox/10-manual.yml
:language: yaml
@ -40,6 +40,9 @@ We have an `http_proxy` family with an `address` variable
:tutorial:`Download this file from the rougail-tutorials git repository <src/tag/v1.1_030/firefox/10-manual.yml>`
A variable with type `domainname`
-----------------------------------
And we have assigned a type to this variable:
.. code-block:: yaml
@ -178,7 +181,7 @@ we then have this output:
OK I agree with the `domainname` type, but what if I want to specify
an IP address as a user value for this `address` variable?
Because it is therefore simply impossible to do so.
Because it is therefore simply impossible to do so now.
Is there a way for my `address` variable to accept an IP address?
@ -220,15 +223,63 @@ The params allow the domain name `address` variable to be set with IPs.
parameter
A parameter is a property of a variable that can refine its behavior
A parameter is a property of a variable that can refine its behavior.
It is declared by adding the `params` attribute in the variable's
definition.
Now we will test with an IP address as the value for our `address` variable.
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_031` version::
git checkout v1.1_031
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_031/config/02/config.yml
:language: yaml
:caption: An IP address as a value
..
---
manual:
http_proxy:
address: 192.168.0.1
:tutorial:`Download this file from the rougail-tutorials git repository <src/tag/v1.1_031/config/02/config.yml>`
if we launch the rougail CLI on it:
.. raw:: html
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_031/config/02/cmd_ro.txt
:class: terminal
..
rougail -m firefox/ -u yaml -yf config/02/config.yml
We have this output:
.. raw:: html
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_030/config/01/output_ro.html
:class: output
We can see that the IP address value has been accepted.
A variable with type `port`
------------------------------
We will add, according to our use case, a variable of type `port`:
.. image:: images/firefox_port.png
.. keypoints:: let's review the key points
**Keywords**
- we can add :term:`parameter`\ s to variables to refine their behavior
- we can set a `domainname` type to a variable
- we can add :term:`parameter`\ s to variables to refine their typing behavior
**Progress**
FIXME

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB