diff --git a/docs/cli.rst b/docs/cli.rst index 4a5557f2c..c905cc9d6 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -73,6 +73,50 @@ CLI root โ”ฃโ”โ” ๐Ÿ““ HTTPS address: https.proxy.net โ—€ loaded from the YAML file "config/01/config.yml" (โณ https.proxy.net โ—€ loaded from the YAML file "config/01/config.yml" โณ http.proxy.net) โ”—โ”โ” ๐Ÿ““ HTTPS port: 3128 +--- + +sortie normale: + +sortie pour n'afficher qu'une family: + +:: + + rougail -m firefox/ -u yaml -yf config/01/config + +on a: + +:: + + 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 + + +sortie plus prรฉcise: + +:: + + rougail -m firefox/ -u yaml -yf config/01/config.yml --cli.root manual.https_proxy + +on a: + +:: + + Variables: + โ”ฃโ”โ” ๐Ÿ““ HTTPS address: https.proxy.net โ—€ loaded from the YAML file "config/01/config.yml" (โณ https.proxy.net โ—€ loaded from the YAML file "config/01/config.yml" โณ http.proxy.net) + โ”—โ”โ” ๐Ÿ““ HTTPS port: 3128 + Invalid user data error ----------------------------- diff --git a/docs/tutorial/jinja.rst b/docs/tutorial/jinja.rst index 9ca46c0e8..d88142ad9 100644 --- a/docs/tutorial/jinja.rst +++ b/docs/tutorial/jinja.rst @@ -32,10 +32,31 @@ Playing with Jinja git clone https://forge.cloud.silique.fr/stove/rougail-tutorials.git git switch --detach v1.1_070 +.. type-along:: Why the jinja templating engine ? + +We are going to embed some `jinja templating code `_ in our structure file. + +.. questions:: What about a `Jinja` calculation? + +The :term:`Jinja` templating language enables some complex calculation. +We can code more complex behavior that hiding or disabling a variable depending on the value of another variable, +as we saw before. + + +.. glossary:: + + Jinja + + `Jinja `_ is a template engine. + we are using Jinja in a classical way, that is, Jinja allows us to handle different cases, + for example with the `if` statement. + A conditional hidden family with Jinja --------------------------------------- -Let's show add some jinja code in our structure file: +Here we are going to use the Jinja conditional (testing) statement. + +Here is our structure file: .. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_070/firefox/20-manual.yml :language: yaml @@ -82,12 +103,25 @@ Let's show add some jinja code in our structure file: when: HTTPS ... +In this jinja code, we are testing the `use_for_https` variable: -If we set the `use_for_https` to `false`: +.. code-block:: jinja + + {% if _.use_for_https %} + HTTPS is same has HTTP + {% endif %} + +If this variable is set to `true`, the `"HTTPS is same has HTTP"` expression +will appear. + +.. note:: Have a look at the `jinja website's test section `_ + for a closer look about testing a variable. + +But first, let's set our `use_for_https` variable to `false`: .. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_070/config/01/config.yml :language: yaml - :caption: FIXME + :caption: The :file:`config/01/config.yml` user data file with the `use_for_https` set to `false` .. --- @@ -107,54 +141,11 @@ Nothing special appears when we launch the Rougail CLI: :class: terminal .. - rougail -m firefox/ -u yaml -yf config/01/config.The + rougail -m firefox/ -u yaml -yf config/01/config.yml ---- -.. - env ROUGAIL_MANUAL.USE_FOR_HTTPS=true +We have this output: -:: - - rougail -m firefox/ -u yaml -yf config/01/config.yml --cli.root manual.https_proxy - -we have a warning: - -:: - - ๐Ÿ”” 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" - - โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Caption โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ - โ”‚ Unmodifiable variable Default value โ”‚ - โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ - Variables: - โ”ฃโ”โ” ๐Ÿ““ HTTPS address: http.proxy.net - โ”—โ”โ” ๐Ÿ““ HTTPS port: 3128 - - -It is interesting here to launch the Rougail CLI in the :term:`read write mode`: - -.. - env ROUGAIL_MANUAL.USE_FOR_HTTPS=true - -:: - - rougail -m firefox/ --cli.root manual.https_proxy -u yaml environment -yf config/01/config.yml --cli.read_write - -.. code-block:: bash - - ERROR: cannot access to optiondescription "HTTPS Proxy" - because has property "hidden" - (HTTPS is same has HTTP) - - -yml standard output: - -.. raw:: html +.. raw:: html :url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_070/config/01/output_ro.html :class: output @@ -174,6 +165,40 @@ yml standard output: โ”ฃโ”โ” ๐Ÿ““ SOCKS port: 3128 โ”—โ”โ” ๐Ÿ““ SOCKS host version used by proxy: v5 +If we set the `use_for_https` to `true` in the :file:`config.yml` user data file, +then we launch again the Rougail CLI: + +.. raw:: html + :url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_070/config/01/cmd_ro.txt + :class: terminal + +then we have a warning: + +:: + + ๐Ÿ”” 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" + +It is interesting here to launch the Rougail CLI in the :term:`read write mode`: + +:: + + rougail -m firefox/ --cli.root manual.https_proxy -u yaml environment \ + -yf config/01/config.yml --cli.read_write + +Then we have an error: + +.. code-block:: bash + + ERROR: cannot access to optiondescription "HTTPS Proxy" + because has property "hidden" + (HTTPS is same has HTTP) + +FIXME We can hide or disable some variables or families with other techniques than pointing on a variable's value. @@ -287,25 +312,6 @@ Let's explain it more precisely. .. note:: The "the proxy mode is not manual" output is be used in the log outputs for example while -Why Jinja? ---------------- - -.. questions:: What about this `Jinja` type? - -If the :term:`Jinja` template returns some text, then the family will be `disabled`. Otherwise it is accessible. -Deactivating a family means that we will not be able to access it as well as the variables or families included in this family. - -.. note:: If the Jinja template does not return any text, the variable will be **enabled**. - Here we are using the Jinja condition statement. - -.. glossary:: - - Jinja - - `Jinja `_ is a template engine. - we are using Jinja in a classical way, that is, Jinja allows us to handle different cases, - for example with the `if` statement. - What can be calculated? ---------------------------