From 7b5c7b80ecfec57b4d84277ede1412faa9e40bed Mon Sep 17 00:00:00 2001 From: gwen Date: Sun, 22 Feb 2026 11:46:47 +0100 Subject: [PATCH] end jinja --- docs/tutorial/jinja.rst | 103 +++++++++++++++------------------------- 1 file changed, 38 insertions(+), 65 deletions(-) diff --git a/docs/tutorial/jinja.rst b/docs/tutorial/jinja.rst index aab50bdc7..653b22d49 100644 --- a/docs/tutorial/jinja.rst +++ b/docs/tutorial/jinja.rst @@ -185,9 +185,10 @@ then we have a warning: What is interesting here is to launch the Rougail CLI in the :term:`read write mode`: -:: - - rougail -m firefox/ --cli.root manual.https_proxy -u yaml environment \ +.. code-block:: bash + :class: terminal + + rougail -m firefox/ --cli.root manual.https_proxy -u yaml \ -yf config/01/config.yml --cli.read_write Then we have an error: @@ -345,9 +346,6 @@ As for the `https_proxy` with the `hidden` property, we have this: We can see that the hidden explanation for the `manual.https_proxy` family is the `hidden` property's description. - - - Jinja with a parameter --------------------------- @@ -432,78 +430,53 @@ that is only in the case where the identifier is `HTTPS`. In this Jinja code, we can understand that only the `https_proxy` dynamic family will be hidden when the `_.use_for_https` variable is set to `true`. -FIXME +Let's set the `_.use_for_https` variable to `true`. +We have a warning: -:: - - rougail -m firefox/ -u yaml -yf config/01/config.yml - ╭────────────── Caption ───────────────╮ - │ Variable Default value │ - │ Modified value │ - │ (⏳ Original default value) │ - ╰──────────────────────────────────────╯ - Variables: - ┣━━ 📓 Configure Proxy Access to the Internet: Manual proxy configuration ◀ loaded from the YAML - ┃ file "config/01/config.yml" (⏳ No proxy) - ┗━━ 📂 Manual proxy configuration - ┣━━ 📂 HTTP Proxy - ┃ ┣━━ 📓 HTTP address: http.proxy.net ◀ loaded from the YAML file "config/01/config.yml" - ┃ ┗━━ 📓 HTTP Port: 3128 ◀ loaded from the YAML file "config/01/config.yml" (⏳ 8080) - ┣━━ 📓 Also use this proxy for HTTPS: false ◀ loaded from the YAML file "config/01/config.yml" - ┃ (⏳ true) - ┣━━ 📂 HTTPS Proxy - ┃ ┣━━ 📓 HTTPS address: https.proxy.net ◀ loaded from the YAML file "config/01/config.yml" (⏳ - ┃ ┃ http.proxy.net) - ┃ ┗━━ 📓 HTTPS port: 3128 - ┗━━ 📂 SOCKS Proxy - ┣━━ 📓 SOCKS address: http.proxy.net - ┣━━ 📓 SOCKS port: 3128 - ┗━━ 📓 SOCKS host version used by proxy: v5 - -si on met à true, on a un warning : - -:: +.. code-block:: text 🔔 Warning ┗━━ Manual proxy configuration ┗━━ HTTPS Proxy - ┗━━ HTTPS address: 🔔 family "HTTPS Proxy" has property hidden, so cannot access to "HTTPS - address", it will be ignored when loading from the YAML file "config/01/config.yml" + ┗━━ HTTPS address: 🔔 family "HTTPS Proxy" has property hidden, + so cannot access to "HTTPS address", it will be ignored + when loading from the YAML file "config/01/config.yml" - ╭───────────────────── Caption ─────────────────────╮ - │ Variable Default value │ - │ Unmodifiable variable Modified value │ - │ (⏳ Original default value) │ - ╰───────────────────────────────────────────────────╯ - Variables: - ┣━━ 📓 Configure Proxy Access to the Internet: Manual proxy configuration ◀ loaded from the YAML - ┃ file "config/01/config.yml" (⏳ No proxy) - ┗━━ 📂 Manual proxy configuration - ┣━━ 📂 HTTP Proxy - ┃ ┣━━ 📓 HTTP address: http.proxy.net ◀ loaded from the YAML file "config/01/config.yml" - ┃ ┗━━ 📓 HTTP Port: 3128 ◀ loaded from the YAML file "config/01/config.yml" (⏳ 8080) - ┣━━ 📓 Also use this proxy for HTTPS: true ◀ loaded from the YAML file "config/01/config.yml" - ┃ (⏳ true) - ┣━━ 📂 HTTPS Proxy - ┃ ┣━━ 📓 HTTPS address: http.proxy.net - ┃ ┗━━ 📓 HTTPS port: 3128 - ┗━━ 📂 SOCKS Proxy - ┣━━ 📓 SOCKS address: http.proxy.net - ┣━━ 📓 SOCKS port: 3128 - ┗━━ 📓 SOCKS host version used by proxy: v5 +It's helpful to run this command in read/write mode: +.. code-block:: bash + :class: terminal + rougail -m firefox/ --cli.root manual.https_proxy -u yaml \ + -yf config/01/config.yml --cli.read_write + +because at that moment we get an error: + +.. code-block:: bash + :class: output + + ERROR: cannot access to optiondescription "HTTPS Proxy" + because has property "hidden" (HTTPS is same has HTTP) + +So the Jinja code worked well since the `https_proxy` family is hidden only when +the `use_for_https` variable is set to `true` and the identifier is HTTPS +(the `socks_proxy` family, however, is not hidden). .. keypoints:: Key points - **keywords** - - - calculation with a jinja type calculation - - calculation with a `when` or `when_not` parameter - - defining a jinja internal variable in a jinja calculation - **progress** + + - calculation with a jinja type calculation: we can hide a family + - we know how to describe a calcuation + - we know how to output some documentation (in markdown or in html) of the :term:`configuration` + - we can calculate with a dynamic family identifer + **keywords** + + - jinja type calcuation for a hidden property + - jinja calcuation's description + - identifier type parameter + Here we have come to the possibility of making any kind of calculations based on the state of the :term:`configuration`. This is an important feature to manage the stateful aspect of a configuration.