version to tutorial:version:

This commit is contained in:
gwen 2026-05-07 17:49:58 +02:00
parent 820fb9c736
commit 7962c35628
11 changed files with 144 additions and 25 deletions

72
docs/helper_prerequisites.py Executable file
View file

@ -0,0 +1,72 @@
#!/usr/bin/env python3
"""
Génère une section de documentation "prerequisites" pour un tutoriel Rougail,
en utilisant une plage de versions (tags git) spécifiée en arguments.
Usage:
python helper_prerequisites.py <start_version> <end_version> <branch>
Arguments:
start_version (str) : La version de début (tag git) pour la plage de tags.
end_version (str) : La version de fin (tag git) pour la plage de tags.
branch (str) : La branche du dépôt git à mentionner dans la documentation.
Exemple:
./helper_prerequisites.py v1.1_080 v1.1_085 1.1
"""
import sys
def generate_prerequisites(start_version: str, end_version: str, branch: str) -> str:
"""
Génère une section de documentation "prerequisites" pour une plage de versions donnée.
Args:
start_version (str): La version de début (tag git) pour la plage.
end_version (str): La version de fin (tag git) pour la plage.
branch (str): La branche du dépôt git à mentionner.
Returns:
str: La section de documentation formatée.
"""
template = """.. 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.
If you want to follow this tutorial with the help of the corresponding :tutorial:`rougail-tutorials git repository <src/branch/{branch}>`,
this workshop page corresponds to the tags :tutorial:`{start_version} <src/tag/{start_version}/README.md>` to :tutorial:`{end_version} <src/tag/{end_version}/README.md>`
in the repository.
::
git clone https://forge.cloud.silique.fr/stove/rougail-tutorials.git
git switch --detach {start_version}
"""
return template.format(
start_version=start_version,
end_version=end_version,
branch=branch
)
def main() -> None:
"""Point d'entrée principal du script."""
if len(sys.argv) != 4:
print("Erreur : Trois arguments doivent être spécifiés : <start_version> <end_version> <branch>.")
print(f"Usage: {sys.argv[0]} <start_version> <end_version> <branch>")
sys.exit(1)
start_version = sys.argv[1]
end_version = sys.argv[2]
branch = sys.argv[3]
print(generate_prerequisites(start_version, end_version, branch))
if __name__ == "__main__":
main()

47
docs/helper_type_along.py Executable file
View file

@ -0,0 +1,47 @@
#!/usr/bin/env python3
"""
Génère une section de documentation "type-along" pour un tutoriel,
en utilisant une version spécifiée en argument.
Usage:
python generate_type_along.py <version>
Arguments:
version (str) : La version (tag git) à utiliser dans la documentation.
Exemple:
python generate_type_along.py v1.0.0
"""
import sys
def generate_type_along(version: str) -> str:
"""
Génère une section de documentation "type-along" pour une version donnée.
Args:
version (str): La version (tag git) à inclure dans la documentation.
Returns:
str: La section de documentation formatée.
"""
template = """.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the :tutorial:`{version} <src/tag/{version}/README.md>` version::
git switch --detach {version}
"""
return template.format(version=version)
def main() -> None:
"""Point d'entrée principal du script."""
if len(sys.argv) != 2:
print("Erreur : Une version doit être spécifiée en argument.")
print(f"Usage: {sys.argv[0]} <version>")
sys.exit(1)
version = sys.argv[1]
print(generate_type_along(version))
if __name__ == "__main__":
main()

View file

@ -17,7 +17,7 @@ Calculated default value for a variable
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_040 <src/tag/v1.1_040>` to :tutorial:`v1.1_041 <src/tag/v1.1_041>`
this workshop page corresponds to the tags :tutorial:`v1.1_040 <src/tag/v1.1_040/README.md>` to :tutorial:`v1.1_041 <src/tag/v1.1_041/README.md>`
in the repository.
::
@ -72,7 +72,7 @@ A default value calculated from another variable
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_041` version::
Now you need to checkout the :tutorial:`v1.1_041 <src/tag/v1.1_041/README.md>` version::
git switch --detach v1.1_041

View file

@ -15,7 +15,7 @@ A variable with possible 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/1.1>`,
this workshop page corresponds to the tag :tutorial:`v1.1_010 <src/tag/v1.1_010>` in the repository:
this workshop page corresponds to the tag :tutorial:`v1.1_010 <src/tag/v1.1_010/README.md>` in the repository:
::

View file

@ -16,7 +16,7 @@ Custom type
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_080 <src/tag/v1.1_080>` to :tutorial:`v1.1_085 <src/tag/v1.1_085>`
this workshop page corresponds to the tags :tutorial:`v1.1_080 <src/tag/v1.1_080/README.md>` to :tutorial:`v1.1_085 <src/tag/v1.1_085/README.md>`
in the repository.
::

View file

@ -20,7 +20,7 @@ A dynamically built family
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_060 <src/tag/v1.1_060>` to :tutorial:`v1.1_061 <src/tag/v1.1_061>`
this workshop page corresponds to the tags :tutorial:`v1.1_060 <src/tag/v1.1_060/README.md>` to :tutorial:`v1.1_061 <src/tag/v1.1_061/README.md>`
in the repository.
::
@ -280,7 +280,7 @@ A conditional disabled variable with dynamic identifier
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_061` version::
Now you need to checkout the :tutorial:`v1.1_061 <src/tag/v1.1_061/README.md>` version::
git switch --detach v1.1_061

View file

@ -19,7 +19,7 @@ Group variables inside families
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_020 <src/tag/v1.1_020>` to :tutorial:`v1.1_022 <src/tag/v1.1_022>`
this workshop page corresponds to the tags :tutorial:`v1.1_020 <src/tag/v1.1_020/README.md>` to :tutorial:`v1.1_022 <src/tag/v1.1_022/README.md>`
in the repository.
::
@ -107,7 +107,7 @@ Or a sub family
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_021` version::
Now you need to checkout the :tutorial:`v1.1_021 <src/tag/v1.1_021/README.md>` version::
git switch --detach v1.1_021
@ -151,7 +151,7 @@ Putting a variable inside of a family or a sub family
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_022` version::
Now you need to checkout the :tutorial:`v1.1_022 <src/tag/v1.1_022/README.md>` version::
git switch --detach v1.1_022

View file

@ -23,7 +23,7 @@ Playing with Jinja
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_073 <src/tag/v1.1_073>`
this workshop page corresponds to the tags :tutorial:`v1.1_070 <src/tag/v1.1_070/README.md>` to :tutorial:`v1.1_073 <src/tag/v1.1_073/README.md>`
in the repository.
::
@ -309,7 +309,7 @@ Jinja with a description
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_071` version::
Now you need to checkout the :tutorial:`v1.1_071 <src/tag/v1.1_071/README.md>` version::
git switch --detach v1.1_071
@ -392,7 +392,7 @@ Jinja with a parameter
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_072` version::
Now you need to checkout the :tutorial:`v1.1_072 <src/tag/v1.1_072/README.md>` version::
git switch --detach v1.1_072
@ -508,7 +508,7 @@ Jinja could returns a boolean
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_073` version::
Now you need to checkout the :tutorial:`v1.1_073 <src/tag/v1.1_073/README.md>` version::
git switch --detach v1.1_073

View file

@ -28,7 +28,7 @@ We'll learn in this tutorial how to set the values of the configuration options
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_000 <src/tag/v1.1_000>` to :tutorial:`v1.1_003 <src/tag/v1.1_003>`
this workshop page corresponds to the tags :tutorial:`v1.1_000 <src/tag/v1.1_000/README.md>` to :tutorial:`v1.1_003 <src/tag/v1.1_003/README.md>`
in the repository:
::
@ -73,7 +73,7 @@ Let's add our first variable
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_001` version::
Now you need to checkout the :tutorial:`v1.1_001 <src/tag/v1.1_001/README.md>` version::
git switch --detach v1.1_001
@ -142,7 +142,7 @@ Let's add a variable's description, which is not mandatory but which is usually
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_002` version::
Now you need to checkout the :tutorial:`v1.1_002 <src/tag/v1.1_002/README.md>` version::
git switch --detach v1.1_002
@ -205,7 +205,7 @@ Set a default value
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_003` version::
Now you need to checkout the :tutorial:`v1.1_003 <src/tag/v1.1_003/README.md>` version::
git switch --detach v1.1_003

View file

@ -25,7 +25,7 @@ Disabling and hiding are two families or variables properties.
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_050 <src/tag/v1.1_050>` to :tutorial:`v1.1_053 <src/tag/v1.1_053>`
this workshop page corresponds to the tags :tutorial:`v1.1_050 <src/tag/v1.1_050/README.md>` to :tutorial:`v1.1_053 <src/tag/v1.1_053/README.md>`
in the repository.
::
@ -219,7 +219,7 @@ Notice the `disabled: true` parameter set in the `manual` family:
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_051` version::
Now you need to checkout the :tutorial:`v1.1_051 <src/tag/v1.1_051/README.md>` version::
git switch --detach v1.1_051
@ -378,7 +378,7 @@ A hidden family
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_052` version::
Now you need to checkout the :tutorial:`v1.1_052 <src/tag/v1.1_052/README.md>` version::
git switch --detach v1.1_052
@ -593,7 +593,7 @@ A conditional hidden family
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_053` version::
Now you need to checkout the :tutorial:`v1.1_053 <src/tag/v1.1_053/README.md>` version::
git switch --detach v1.1_053

View file

@ -17,7 +17,7 @@ Some suitable types
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_030 <src/tag/v1.1_030>` to :tutorial:`v1.1_033 <src/tag/v1.1_033>`
this workshop page corresponds to the tags :tutorial:`v1.1_030 <src/tag/v1.1_030/README.md>` to :tutorial:`v1.1_033 <src/tag/v1.1_033/README.md>`
in the repository.
::
@ -204,7 +204,7 @@ This is where the ability to parameterize our variable comes in.
.. 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::
Now you need to checkout the :tutorial:`v1.1_031 <src/tag/v1.1_031/README.md>` version::
git switch --detach v1.1_031
@ -274,7 +274,7 @@ A variable with type `port`
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_032` version::
Now you need to checkout the :tutorial:`v1.1_032 <src/tag/v1.1_032/README.md>` version::
git switch --detach v1.1_032
@ -381,7 +381,7 @@ A variable with type `boolean`
.. type-along:: For those who follow the tutorial with the help of the git repository
Now you need to checkout the `v1.1_033` version::
Now you need to checkout the :tutorial:`v1.1_033 <src/tag/v1.1_033/README.md>` version::
git switch --detach v1.1_033