[tutorial v1.1_070] A conditional hidden family with Jinja (config and doc)

This commit is contained in:
egarette@silique.fr 2026-02-17 12:49:05 +01:00
parent bb393bed47
commit bca5d818e1
11 changed files with 170 additions and 31 deletions

126
README.md
View file

@ -1,11 +1,11 @@
- [Summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/branch/1.1/README.md) - [Summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/branch/1.1/README.md)
- [[tutorial v1.1_060] A dynamically built family](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_060/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_060~1..v1.1_060)) - [[tutorial v1.1_061] A conditional disabled variable with dynamic identifier](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_061/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_061~1..v1.1_061))
# [tutorial v1.1_061] A conditional disabled variable with dynamic identifier # [tutorial v1.1_070] A conditional hidden family with Jinja
[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_061~1..v1.1_061) [View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_070~1..v1.1_070)
[Read the documentation](https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/dynfam.html#a-conditional-disabled-variable-with-dynamic-identifier) [Read the documentation](https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/jinja.html#a-conditional-hidden-family-with-jinja)
## Screenshot ## Screenshot
@ -31,7 +31,7 @@ pip install rougail-cli rougail-output-exporter rougail-output-doc rougail-user-
Then switch to the tutorial page: Then switch to the tutorial page:
```shell ```shell
git switch --detach v1.1_061 git switch --detach v1.1_070
``` ```
## Structure ## Structure
@ -39,11 +39,11 @@ git switch --detach v1.1_061
<p> <p>
<a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_061/./">.</a><br/> <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_070/./">.</a><br/>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_061/./firefox/">firefox</a><br/> └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_070/./firefox/">firefox</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_061/./firefox/00-proxy.yml">00-proxy.yml</a><br/>     ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_070/./firefox/00-proxy.yml">00-proxy.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_061/./firefox/10-manual.yml">10-manual.yml</a><br/>     ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_070/./firefox/10-manual.yml">10-manual.yml</a><br/>
    └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_061/./firefox/20-manual.yml">20-manual.yml</a><br/>     └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_070/./firefox/20-manual.yml">20-manual.yml</a><br/>
<br/><br/></p> <br/><br/></p>
Contents of the firefox/20-manual.yml file Contents of the firefox/20-manual.yml file
@ -60,7 +60,10 @@ manual:
'{{ identifier }}_proxy': '{{ identifier }}_proxy':
description: '{{ identifier }} Proxy' description: '{{ identifier }} Proxy'
hidden: hidden:
variable: _.use_for_https jinja: |-
{% if _.use_for_https %}
HTTPS is same has HTTP
{% endif %}
dynamic: dynamic:
- HTTPS - HTTPS
- SOCKS - SOCKS
@ -130,7 +133,7 @@ rougail -m firefox/ -o doc
> - manual.*https*_proxy > - manual.*https*_proxy
> - manual.*socks*_proxy\ > - manual.*socks*_proxy\
> *`hidden`*\ > *`hidden`*\
> **Hidden**: when the variable "[Also use this proxy for HTTPS](#manual.use_for_https)" has the value "true"\ > **Hidden**: depends on a calculation\
> **Identifiers**: > **Identifiers**:
> - HTTPS > - HTTPS
> - SOCKS > - SOCKS
@ -142,19 +145,6 @@ rougail -m firefox/ -o doc
| **<a id="manual.:::identifier:::_proxy.version" name="manual.:::identifier:::_proxy.version">manual.*https*_proxy.version</a>**<br/>**manual.*socks*_proxy.version**<br/>[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` *`disabled`* | SOCKS host version used by proxy.<br/>**Choices**: <br/>&nbsp;v4<br/>&nbsp;v5 **← (default)**<br/>**Disabled**: when the identifier is "HTTPS" | | **<a id="manual.:::identifier:::_proxy.version" name="manual.:::identifier:::_proxy.version">manual.*https*_proxy.version</a>**<br/>**manual.*socks*_proxy.version**<br/>[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` *`disabled`* | SOCKS host version used by proxy.<br/>**Choices**: <br/>&nbsp;v4<br/>&nbsp;v5 **← (default)**<br/>**Disabled**: when the identifier is "HTTPS" |
***
### Let's generate the changelog
```shell
rougail -m firefox/ -o doc --doc.contents changelog
```
#### New variable
| Variable | Description |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
| **<a id="manual.:::identifier:::_proxy.version" name="manual.:::identifier:::_proxy.version">manual.*https*_proxy.version</a>**<br/>**manual.*socks*_proxy.version**<br/>[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` *`disabled`* | SOCKS host version used by proxy.<br/>**Choices**: <br/>&nbsp;v4<br/>&nbsp;v5 **← (default)**<br/>**Disabled**: when the identifier is "HTTPS" |
*** ***
## User datas ## User datas
@ -205,6 +195,90 @@ Variables:
- :notebook: version (SOCKS host version used by proxy): <span style="color: #B8860B">v5</span> - :notebook: version (SOCKS host version used by proxy): <span style="color: #B8860B">v5</span>
*** ***
#### Output for "manual.https_proxy"
```shell
rougail -m firefox/ -u yaml -yf config/01/config.yml --cli.root manual.https_proxy
```
> [!NOTE]
>
> **Caption:**
> - Variable
> - <span style="color: #B8860B">Default value</span>
> - <span style="color: #006400">Modified value</span>
> - (:hourglass_flowing_sand: Original default value)
Variables:
- :notebook: address (HTTPS address): <span style="color: #006400">https.proxy.net</span> ← loaded from the YAML file "config/01/config.yml" (:hourglass_flowing_sand: https.proxy.net ← loaded from the YAML file "config/01/config.yml" :hourglass_flowing_sand: http.proxy.net)
- :notebook: port (HTTPS port): <span style="color: #B8860B">3128</span>
***
### Example 2
#### config/02/config.yml
- [[tutorial v1.1_070] A conditional hidden family with Jinja](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_070/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_070~1..v1.1_070)) ```yml
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: http.proxy.net
port: 3128
use_for_https: true
https_proxy:
address: https.proxy.net
```
***
#### Output
```shell
rougail -m firefox/ -u yaml -yf config/02/config.yml
```
> [!WARNING]
>
> - manual (Manual proxy configuration)
> - https_proxy (HTTPS Proxy)
> - address (HTTPS address): :bell: <span style="color: #EFBF04">family "https_proxy" (HTTPS Proxy) has property hidden, so cannot access to "address" (HTTPS address), it will be ignored when loading from the YAML file "config/02/config.yml"</span>
> [!NOTE]
>
> **Caption:**
> - Variable
> - <span style="color: #A52A2A">Unmodifiable variable</span>
> - <span style="color: #B8860B">Default value</span>
> - <span style="color: #006400">Modified value</span>
> - (:hourglass_flowing_sand: Original default value)
Variables:
- :notebook: proxy_mode (Configure Proxy Access to the Internet): <span style="color: #006400">Manual proxy configuration</span> ← loaded from the YAML file "config/02/config.yml" (:hourglass_flowing_sand: No proxy)
- :open_file_folder: manual (Manual proxy configuration)
- :open_file_folder: http_proxy (HTTP Proxy)
- :notebook: address (HTTP address): <span style="color: #006400">http.proxy.net</span> ← loaded from the YAML file "config/02/config.yml"
- :notebook: port (HTTP Port): <span style="color: #006400">3128</span> ← loaded from the YAML file "config/02/config.yml" (:hourglass_flowing_sand: 8080)
- :notebook: use_for_https (Also use this proxy for HTTPS): <span style="color: #006400">true</span> ← loaded from the YAML file "config/02/config.yml" (:hourglass_flowing_sand: true)
- :open_file_folder: <span style="color: #A52A2A">https_proxy (HTTPS Proxy)</span>
- :notebook: <span style="color: #A52A2A">address (HTTPS address)</span>: <span style="color: #B8860B">http.proxy.net</span>
- :notebook: <span style="color: #A52A2A">port (HTTPS port)</span>: <span style="color: #B8860B">3128</span>
- :open_file_folder: <span style="color: #A52A2A">socks_proxy (SOCKS Proxy)</span>
- :notebook: <span style="color: #A52A2A">address (SOCKS address)</span>: <span style="color: #B8860B">http.proxy.net</span>
- :notebook: <span style="color: #A52A2A">port (SOCKS port)</span>: <span style="color: #B8860B">3128</span>
- :notebook: <span style="color: #A52A2A">version (SOCKS host version used by proxy)</span>: <span style="color: #B8860B">v5</span>
***
#### Output for "manual.https_proxy"
```shell
rougail -m firefox/ -u yaml -yf config/02/config.yml --cli.root manual.https_proxy
```
> [!CAUTION]
>
> - manual (Manual proxy configuration)
> - https_proxy (HTTPS Proxy)
> - address (HTTPS address): :stop_sign: <span style="color: #C23636">family "https_proxy" (HTTPS Proxy) has property hidden, so cannot access to "address" (HTTPS address), it has been loading from the YAML file "config/02/config.yml"</span>
***
- [[tutorial v1.1_071] Jinja with a description](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_071/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_071~1..v1.1_071))

1
config/01/cmd_root.txt Normal file
View file

@ -0,0 +1 @@
rougail -m firefox/ -u yaml -yf config/01/config.yml --cli.root manual.https_proxy

View file

@ -0,0 +1,11 @@
<pre>╭────────────── Caption ───────────────╮
│ Variable <span style="color: #ffd700">Default value</span>
<span style="color: #00aa00">Modified value</span>
│ (⏳ Original default value) │
╰──────────────────────────────────────╯
Variables:
<span style="color: #5c5cff">┣━━ </span>📓 address (HTTPS address): <span style="color: #00aa00">https.proxy.net</span> ◀ loaded from the YAML file
<span style="color: #5c5cff"></span>"config/01/config.yml" (⏳ https.proxy.net ◀ loaded from the YAML file
<span style="color: #5c5cff"></span>"config/01/config.yml" ⏳ http.proxy.net)
<span style="color: #5c5cff">┗━━ </span>📓 port (HTTPS port): <span style="color: #ffd700">3128</span>
</pre>

1
config/01/root Normal file
View file

@ -0,0 +1 @@
manual.https_proxy

1
config/02/cmd_ro.txt Normal file
View file

@ -0,0 +1 @@
rougail -m firefox/ -u yaml -yf config/02/config.yml

1
config/02/cmd_root.txt Normal file
View file

@ -0,0 +1 @@
rougail -m firefox/ -u yaml -yf config/02/config.yml --cli.root manual.https_proxy

9
config/02/config.yml Normal file
View file

@ -0,0 +1,9 @@
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: http.proxy.net
port: 3128
use_for_https: true
https_proxy:
address: https.proxy.net

33
config/02/output_ro.html Normal file
View file

@ -0,0 +1,33 @@
<pre><span style="font-weight: bold; color: #ffff00">🔔 Warning</span>
<span style="color: #ffff00">┗━━ </span>manual (Manual proxy configuration)
<span style="color: #ffff00"> </span><span style="color: #ffff00">┗━━ </span>https_proxy (HTTPS Proxy)
<span style="color: #ffff00"> </span><span style="color: #ffff00"> </span><span style="color: #ffff00">┗━━ </span>address (HTTPS address): <span style="color: #ffff00">🔔 family "https_proxy" (HTTPS Proxy) has </span>
<span style="color: #ffff00"> </span><span style="color: #ffff00"> </span><span style="color: #ffff00"> </span><span style="color: #ffff00">property hidden, so cannot access to "address" (HTTPS address), it </span>
<span style="color: #ffff00"> </span><span style="color: #ffff00"> </span><span style="color: #ffff00"> </span><span style="color: #ffff00">will be ignored when loading from the YAML file </span>
<span style="color: #ffff00"> </span><span style="color: #ffff00"> </span><span style="color: #ffff00"> </span><span style="color: #ffff00">"config/02/config.yml"</span>
╭───────────────────── Caption ─────────────────────╮
│ Variable <span style="color: #ffd700">Default value</span>
<span style="color: #ffaf00">Unmodifiable variable</span> <span style="color: #00aa00">Modified value</span>
│ (⏳ Original default value) │
╰───────────────────────────────────────────────────╯
Variables:
<span style="color: #5c5cff">┣━━ </span>📓 proxy_mode (Configure Proxy Access to the Internet): <span style="color: #00aa00">Manual proxy </span>
<span style="color: #5c5cff"></span><span style="color: #00aa00">configuration</span> ◀ loaded from the YAML file "config/02/config.yml" (⏳ No
<span style="color: #5c5cff"></span>proxy)
<span style="color: #5c5cff">┗━━ </span>📂 manual (Manual proxy configuration)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📂 http_proxy (HTTP Proxy)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┣━━ </span>📓 address (HTTP address): <span style="color: #00aa00">http.proxy.net</span> ◀ loaded from the YAML
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff"></span>file "config/02/config.yml"
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┗━━ </span>📓 port (HTTP Port): <span style="color: #00aa00">3128</span> ◀ loaded from the YAML file
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff"> </span>"config/02/config.yml" (⏳ 8080)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 use_for_https (Also use this proxy for HTTPS): <span style="color: #00aa00">true</span> ◀ loaded from the
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span>YAML file "config/02/config.yml" (⏳ true)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📂 <span style="color: #ffaf00">https_proxy (HTTPS Proxy)</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┣━━ </span>📓 <span style="color: #ffaf00">address (HTTPS address)</span>: <span style="color: #ffd700">http.proxy.net</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┗━━ </span>📓 <span style="color: #ffaf00">port (HTTPS port)</span>: <span style="color: #ffd700">3128</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📂 <span style="color: #ffaf00">socks_proxy (SOCKS Proxy)</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 <span style="color: #ffaf00">address (SOCKS address)</span>: <span style="color: #ffd700">http.proxy.net</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 <span style="color: #ffaf00">port (SOCKS port)</span>: <span style="color: #ffd700">3128</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📓 <span style="color: #ffaf00">version (SOCKS host version used by proxy)</span>: <span style="color: #ffd700">v5</span>
</pre>

View file

@ -0,0 +1,7 @@
<pre><span style="font-weight: bold; color: #ff0000">🛑 Caution</span>
<span style="color: #ff0000">┗━━ </span>manual (Manual proxy configuration)
<span style="color: #ff0000"> </span><span style="color: #ff0000">┗━━ </span>https_proxy (HTTPS Proxy)
<span style="color: #ff0000"> </span><span style="color: #ff0000"> </span><span style="color: #ff0000">┗━━ </span>address (HTTPS address): <span style="color: #ff0000">🛑 family "https_proxy" (HTTPS Proxy) has </span>
<span style="color: #ff0000"> </span><span style="color: #ff0000"> </span><span style="color: #ff0000"> </span><span style="color: #ff0000">property hidden, so cannot access to "address" (HTTPS address), it </span>
<span style="color: #ff0000"> </span><span style="color: #ff0000"> </span><span style="color: #ff0000"> </span><span style="color: #ff0000">has been loading from the YAML file "config/02/config.yml"</span>
</pre>

1
config/02/root Normal file
View file

@ -0,0 +1 @@
manual.https_proxy

View file

@ -1,7 +1,7 @@
<p> <p>
<a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_061/./">.</a><br/> <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_070/./">.</a><br/>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_061/./firefox/">firefox</a><br/> └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_070/./firefox/">firefox</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_061/./firefox/00-proxy.yml">00-proxy.yml</a><br/>     ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_070/./firefox/00-proxy.yml">00-proxy.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_061/./firefox/10-manual.yml">10-manual.yml</a><br/>     ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_070/./firefox/10-manual.yml">10-manual.yml</a><br/>
    └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_061/./firefox/20-manual.yml">20-manual.yml</a><br/>     └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_070/./firefox/20-manual.yml">20-manual.yml</a><br/>
<br/><br/></p> <br/><br/></p>