diff --git a/docs/helper_prerequisites.py b/docs/helper_prerequisites.py new file mode 100755 index 000000000..bdd341067 --- /dev/null +++ b/docs/helper_prerequisites.py @@ -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 + +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 ` 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 `, + this workshop page corresponds to the tags :tutorial:`{start_version} ` to :tutorial:`{end_version} ` + 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 : .") + print(f"Usage: {sys.argv[0]} ") + 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() + diff --git a/docs/helper_type_along.py b/docs/helper_type_along.py new file mode 100755 index 000000000..20a45ccd5 --- /dev/null +++ b/docs/helper_type_along.py @@ -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 + +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} ` 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]} ") + sys.exit(1) + + version = sys.argv[1] + print(generate_type_along(version)) + +if __name__ == "__main__": + main() diff --git a/docs/tutorial/calculated.rst b/docs/tutorial/calculated.rst index c6f082723..0e002292a 100644 --- a/docs/tutorial/calculated.rst +++ b/docs/tutorial/calculated.rst @@ -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 `, - this workshop page corresponds to the tags :tutorial:`v1.1_040 ` to :tutorial:`v1.1_041 ` + this workshop page corresponds to the tags :tutorial:`v1.1_040 ` to :tutorial:`v1.1_041 ` 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 ` version:: git switch --detach v1.1_041 diff --git a/docs/tutorial/choice.rst b/docs/tutorial/choice.rst index b7cfe40f3..aac3134b8 100644 --- a/docs/tutorial/choice.rst +++ b/docs/tutorial/choice.rst @@ -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 `, - this workshop page corresponds to the tag :tutorial:`v1.1_010 ` in the repository: + this workshop page corresponds to the tag :tutorial:`v1.1_010 ` in the repository: :: diff --git a/docs/tutorial/customtype.rst b/docs/tutorial/customtype.rst index c7a71b0d3..74363c239 100644 --- a/docs/tutorial/customtype.rst +++ b/docs/tutorial/customtype.rst @@ -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 `, - this workshop page corresponds to the tags :tutorial:`v1.1_080 ` to :tutorial:`v1.1_085 ` + this workshop page corresponds to the tags :tutorial:`v1.1_080 ` to :tutorial:`v1.1_085 ` in the repository. :: diff --git a/docs/tutorial/dynfam.rst b/docs/tutorial/dynfam.rst index beb6e1272..9495a6901 100644 --- a/docs/tutorial/dynfam.rst +++ b/docs/tutorial/dynfam.rst @@ -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 `, - this workshop page corresponds to the tags :tutorial:`v1.1_060 ` to :tutorial:`v1.1_061 ` + this workshop page corresponds to the tags :tutorial:`v1.1_060 ` to :tutorial:`v1.1_061 ` 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 ` version:: git switch --detach v1.1_061 diff --git a/docs/tutorial/family.rst b/docs/tutorial/family.rst index 806e987b4..e93860581 100644 --- a/docs/tutorial/family.rst +++ b/docs/tutorial/family.rst @@ -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 `, - this workshop page corresponds to the tags :tutorial:`v1.1_020 ` to :tutorial:`v1.1_022 ` + this workshop page corresponds to the tags :tutorial:`v1.1_020 ` to :tutorial:`v1.1_022 ` 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 ` 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 ` version:: git switch --detach v1.1_022 diff --git a/docs/tutorial/jinja.rst b/docs/tutorial/jinja.rst index 90c605249..7fe99fc10 100644 --- a/docs/tutorial/jinja.rst +++ b/docs/tutorial/jinja.rst @@ -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 `, - this workshop page corresponds to the tags :tutorial:`v1.1_070 ` to :tutorial:`v1.1_073 ` + this workshop page corresponds to the tags :tutorial:`v1.1_070 ` to :tutorial:`v1.1_073 ` 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 ` 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 ` 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 ` version:: git switch --detach v1.1_073 diff --git a/docs/tutorial/preliminary.rst b/docs/tutorial/preliminary.rst index c980e5674..608f02f59 100644 --- a/docs/tutorial/preliminary.rst +++ b/docs/tutorial/preliminary.rst @@ -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 `, - this workshop page corresponds to the tags :tutorial:`v1.1_000 ` to :tutorial:`v1.1_003 ` + this workshop page corresponds to the tags :tutorial:`v1.1_000 ` to :tutorial:`v1.1_003 ` 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 ` 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 ` 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 ` version:: git switch --detach v1.1_003 diff --git a/docs/tutorial/properties.rst b/docs/tutorial/properties.rst index f69515e1b..d3b09d1b2 100644 --- a/docs/tutorial/properties.rst +++ b/docs/tutorial/properties.rst @@ -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 `, - this workshop page corresponds to the tags :tutorial:`v1.1_050 ` to :tutorial:`v1.1_053 ` + this workshop page corresponds to the tags :tutorial:`v1.1_050 ` to :tutorial:`v1.1_053 ` 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 ` 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 ` 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 ` version:: git switch --detach v1.1_053 diff --git a/docs/tutorial/types.rst b/docs/tutorial/types.rst index 6ff901a1e..40c8e3e25 100644 --- a/docs/tutorial/types.rst +++ b/docs/tutorial/types.rst @@ -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 `, - this workshop page corresponds to the tags :tutorial:`v1.1_030 ` to :tutorial:`v1.1_033 ` + this workshop page corresponds to the tags :tutorial:`v1.1_030 ` to :tutorial:`v1.1_033 ` 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 ` 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 ` 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 ` version:: git switch --detach v1.1_033