docs(v1.1_13*): practice

This commit is contained in:
egarette@silique.fr 2026-05-27 11:46:05 +02:00
parent 88b7d46f60
commit b349ac5b1e
2 changed files with 115 additions and 5 deletions

View file

@ -16,13 +16,13 @@ Variable with multiple values
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/v1.1>`,
this workshop page corresponds to the tags :tutorial:`v1.1_100 <src/tag/v1.1_100/README.md>` to :tutorial:`v1.1_111 <src/tag/v1.1_111/README.md>`
this workshop page corresponds to the tags :tutorial:`v1.1_110 <src/tag/v1.1_110/README.md>` to :tutorial:`v1.1_111 <src/tag/v1.1_111/README.md>`
in the repository.
::
git clone https://forge.cloud.silique.fr/stove/rougail-tutorials.git
git switch --detach v1.1_100
git switch --detach v1.1_110
.. type-along:: A web_address variable
@ -34,7 +34,7 @@ It is related to the automatic proxy configuration :term:`situation <configurati
Let's put it in the new :file:`firefox/30-auto.yml` :term:`structure file`.
Note that this variable has a :term:`disabled` property defined:
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_100/firefox/30-auto.yml
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_110/firefox/30-auto.yml
:language: yaml
:caption: The :file:`firefox/30-auto.yml` structure definition file with the `auto` variable
@ -56,7 +56,7 @@ It is :term:`disabled` otherwise.
Let's launch the Rougail CLI on this :term:`user data file <user data>`:
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_100/config/03/config.yml
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_110/config/03/config.yml
:language: yaml
:caption: The :file:`config/03/config.yml` user data file
@ -68,7 +68,7 @@ Let's launch the Rougail CLI on this :term:`user data file <user data>`:
we have this output:
.. raw:: html
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_100/config/03/output_ro.html
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_110/config/03/output_ro.html
:class: output
..

110
docs/tutorial/practice1.rst Normal file
View file

@ -0,0 +1,110 @@
Practice
================================
.. objectives:: Objectives
There is nothing new in the two next Firefox variables. So it is the time to practice what we loarn until now.
This page will divided in two part for each variable:
- Explain what we want to implement
- Propose to you a solution
The best for you is to do this job on your own and compare to our propositions.
Here are the two variables highlighted as describe in Firefox:
.. FIXME comment gérer l'image au mieux ??
.. image:: https://forge.cloud.silique.fr/stove/rougail-tutorials/media/commit/v1.1_130/firefox.png
.. prerequisites:: Prerequisites
- We assume that Rougail's library is :ref:`installed <installation>` on your computer.
- 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.
This workshop page corresponds to the tags :tutorial:`v1.1_130 <src/tag/v1.1_130/README.md>` to :tutorial:`v1.1_131 <src/tag/v1.1_131/README.md>`
A conditional disabled boolean variable
-------------------------------------------------------------
What do we want implement
'''''''''''''''''''''''''''''''
- choice a file name that respect the :ref:`file naming and organizing convention <namingconvention>`
- define an appropriate variable name # FIXME pas de convention pour le nom des familles/variables ?
- the Firefox description is in negative mode, which is not a good practice for us, we rewrite it in positive mode
- the variable is a boolean with the default value `true` (the opposite of unchecked option)
- the variable is available for all proxy mode choice by user, so disable it only when the `proxy mode` is "No proxy".
Our solution
'''''''''''''''''''''''''''''''
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the :tutorial:`v1.1_130 <src/tag/v1.1_130/README.md>` version::
git switch --detach v1.1_130
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_130/firefox/50-prompt_authentication.yml
:language: yaml
:caption: The :file:`firefox/50-prompt_authentication.yml` a conditional disabled boolean variable
..
%YAML 1.2
---
version: 1.1
prompt_authentication:
description: Prompt for authentication if password is saved
default: true
disabled:
variable: _.proxy_mode
when: No proxy
...
A Jinja conditional disabled boolean variable
-------------------------------------------------
What do we want implement
'''''''''''''''''''''''''''''''
- choice a file name that respect the :ref:`file naming and organizing convention <namingconvention>`
- define an appropriate variable name # FIXME pas de convention pour le nom des familles/variables ?
- the description will be the Firefox description
- the variable is a boolean with the default value `false` (unchecked option)
- the variable is only available with the "Manual proxy configuration" proxy mode and when the proxy socks version is not v4.
Our solution
'''''''''''''''''''''''''''''''
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the :tutorial:`v1.1_131 <src/tag/v1.1_131/README.md>` version::
git switch --detach v1.1_131
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_131/firefox/55-proxy_dns_socks5.yml
:language: yaml
:caption: The :file:`firefox/55-proxy_dns_socks5.yml` a Jinja conditional disabled boolean variable
..
%YAML 1.2
---
version: 1.1
proxy_dns_socks5:
description: Use proxy DNS when using SOCKS v5
default: false
disabled:
jinja: |-
{{ _.proxy_mode != "Manual proxy configuration" or _.manual.socks_proxy.version == 'v4' }}
return_type: boolean
description: |-
if "_.proxy_mode" is not "Manual proxy configuration"
or "_.manual.socks_proxy.version" is "v4"
...