[tutorial v1.1_080] A conditional disabled variable with type web_address (config and doc)

This commit is contained in:
egarette@silique.fr 2026-01-08 20:22:44 +01:00
parent 702db56582
commit c0a68227ae
10 changed files with 127 additions and 108 deletions

161
README.md
View file

@ -1,11 +1,11 @@
- [Summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/branch/1.1/README.md)
- [[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))
- [[tutorial v1.1_072] Jinja with a parameter](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_072/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_072~1..v1.1_072))
# [tutorial v1.1_072] Jinja with a parameter
# [tutorial v1.1_080] A conditional disabled variable with type web_address
[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_072~1..v1.1_072)
[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_080~1..v1.1_080)
[Read the documentation](https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/calculation.html#jinja-with-a-parameter)
[Read the documentation](https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/calculation.html#a-conditional-disabled-variable-with-type-web_address)
## Screenshot
@ -31,7 +31,7 @@ pip install rougail-cli rougail-output-exporter rougail-output-doc rougail-user-
Then switch to the tutorial page:
```shell
git switch --detach v1.1_072
git switch --detach v1.1_080
```
## Structure
@ -39,58 +39,27 @@ git switch --detach v1.1_072
<p>
<a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_072/./">.</a><br/>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_072/./firefox/">firefox</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_072/./firefox/00-proxy.yml">00-proxy.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_072/./firefox/10-manual.yml">10-manual.yml</a><br/>
    └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_072/./firefox/20-manual.yml">20-manual.yml</a><br/>
<a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_080/./">.</a><br/>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_080/./firefox/">firefox</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_080/./firefox/00-proxy.yml">00-proxy.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_080/./firefox/10-manual.yml">10-manual.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_080/./firefox/20-manual.yml">20-manual.yml</a><br/>
    └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_080/./firefox/30-auto.yml">30-auto.yml</a><br/>
<br/><br/></p>
Contents of the firefox/20-manual.yml file
Contents of the firefox/30-auto.yml file
```yml
%YAML 1.2
---
version: 1.1
manual:
use_for_https: true # Also use this proxy for HTTPS
'{{ identifier }}_proxy':
description: '{{ identifier }} Proxy'
hidden:
jinja: |-
{% if my_identifier == 'HTTPS' and _.use_for_https %}
HTTPS is same has HTTP
{% endif %}
description: in HTTPS case if "_.use_for_https" is set to "true"
params:
my_identifier:
type: identifier
dynamic:
- HTTPS
- SOCKS
address:
description: '{{ identifier }} address'
default:
variable: __.http_proxy.address
port:
description: '{{ identifier }} port'
default:
variable: __.http_proxy.port
version:
description: SOCKS host version used by proxy
choices:
- v4
- v5
default: v5
disabled:
type: identifier
when: HTTPS
auto:
description: Automatic proxy configuration URL
type: web_address
disabled:
variable: _.proxy_mode
when_not: Automatic proxy configuration URL
...
```
@ -148,6 +117,23 @@ rougail -m firefox/ -o doc
| **<a id="manual.:::identifier:::_proxy.port" name="manual.:::identifier:::_proxy.port">manual.*https*_proxy.port</a>**<br/>**manual.*socks*_proxy.port**<br/>[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | *HTTPS* or *SOCKS* port.<br/>**Validators**: <br/>&nbsp;well-known ports (1 to 1023) are allowed<br/>&nbsp;registred ports (1024 to 49151) are allowed<br/>&nbsp;private ports (greater than 49152) are allowed<br/>**Default**: the value of the variable "[HTTP Port](#manual.http_proxy.port)" |
| **<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" |
| Variable | Description |
|------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **<a id="auto" name="auto">auto</a>**<br/>[`web address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` *`disabled`* | Automatic proxy configuration URL.<br/>**Validators**: <br/>&nbsp;well-known ports (1 to 1023) are allowed<br/>&nbsp;registred ports (1024 to 49151) are allowed<br/>&nbsp;type domainname<br/>&nbsp;the domain name can be a hostname<br/>**Disabled**: when the variable "[Configure Proxy Access to the Internet](#proxy_mode)" hasn't the value "Automatic proxy configuration URL" |
***
### Let's generate the changelog
```shell
rougail -m firefox/ -o doc --doc.contents changelog
```
#### New variable
| Variable | Description |
|------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **<a id="auto" name="auto">auto</a>**<br/>[`web address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` *`disabled`* | Automatic proxy configuration URL.<br/>**Validators**: <br/>&nbsp;well-known ports (1 to 1023) are allowed<br/>&nbsp;registred ports (1024 to 49151) are allowed<br/>&nbsp;type domainname<br/>&nbsp;the domain name can be a hostname<br/>**Disabled**: when the variable "[Configure Proxy Access to the Internet](#proxy_mode)" hasn't the value "Automatic proxy configuration URL" |
***
## User datas
@ -159,14 +145,7 @@ rougail -m firefox/ -o doc
```yml
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: http.proxy.net
port: 3128
use_for_https: false
https_proxy:
address: https.proxy.net
auto: https://auto.proxy.net/wpad.dat
```
***
@ -175,30 +154,70 @@ manual:
```shell
rougail -m firefox/ -u yaml -yf config/01/config.yml
```
> [!WARNING]
>
> - auto (Automatic proxy configuration URL): :bell: <span style="color: #EFBF04">variable has property disabled, it will be ignored when loading from the YAML file "config/01/config.yml"</span>
> [!NOTE]
>
> **Caption:**
> - Variable
> - <span style="color: #B8860B">Default value</span>
Variables:
- :notebook: proxy_mode (Configure Proxy Access to the Internet): <span style="color: #B8860B">No proxy</span>
***
### Example 2
#### config/02/config.yml
```yml
---
proxy_mode: Automatic proxy configuration URL
```
***
#### Output
```shell
rougail -m firefox/ -u yaml -yf config/02/config.yml
```
> [!CAUTION]
>
> - auto (Automatic proxy configuration URL): :stop_sign: <span style="color: #C23636">mandatory variable but has no value</span>
***
### Example 3
#### config/03/config.yml
```yml
---
proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat
```
***
#### Output
```shell
rougail -m firefox/ -u yaml -yf config/03/config.yml
```
> [!NOTE]
>
> **Caption:**
> - Variable
> - <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/01/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/01/config.yml"
- :notebook: port (HTTP Port): <span style="color: #006400">3128</span> ← loaded from the YAML file "config/01/config.yml" (:hourglass_flowing_sand: 8080)
- :notebook: use_for_https (Also use this proxy for HTTPS): <span style="color: #006400">false</span> ← loaded from the YAML file "config/01/config.yml" (:hourglass_flowing_sand: true)
- :open_file_folder: https_proxy (HTTPS Proxy)
- :notebook: address (HTTPS address): <span style="color: #006400">https.proxy.net</span> ← 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>
- :open_file_folder: socks_proxy (SOCKS Proxy)
- :notebook: address (SOCKS address): <span style="color: #B8860B">http.proxy.net</span>
- :notebook: port (SOCKS port): <span style="color: #B8860B">3128</span>
- :notebook: version (SOCKS host version used by proxy): <span style="color: #B8860B">v5</span>
- :notebook: proxy_mode (Configure Proxy Access to the Internet): <span style="color: #006400">Automatic proxy configuration URL</span> ← loaded from the YAML file "config/03/config.yml" (:hourglass_flowing_sand: No proxy)
- :notebook: auto (Automatic proxy configuration URL): <span style="color: #006400">https://auto.proxy.net/wpad.dat</span> ← loaded from the YAML file "config/03/config.yml"
***
- [[tutorial v1.1_080] A conditional disabled variable with type web_address](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_080/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_080~1..v1.1_080))
- [[tutorial v1.1_090] A conditional disabled variable with type domainname and parameters](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_090/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_090~1..v1.1_090))

View file

@ -1,9 +1,2 @@
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: http.proxy.net
port: 3128
use_for_https: false
https_proxy:
address: https.proxy.net
auto: https://auto.proxy.net/wpad.dat

View file

@ -1,26 +1,10 @@
<pre>╭────────────── Caption ───────────────╮
│ Variable <span style="color: #ffd700">Default value</span>
<span style="color: #00aa00">Modified value</span>
│ (⏳ Original default value) │
╰──────────────────────────────────────╯
<pre><span style="font-weight: bold; color: #ffff00">🔔 Warning</span>
<span style="color: #ffff00">┗━━ </span>auto (Automatic proxy configuration URL): <span style="color: #ffff00">🔔 variable has property disabled,</span>
<span style="color: #ffff00"> </span><span style="color: #ffff00">it will be ignored when loading from the YAML file "config/01/config.yml"</span>
╭─────── Caption ────────╮
│ Variable <span style="color: #ffd700">Default value</span>
╰────────────────────────╯
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/01/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/01/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/01/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">false</span> ◀ loaded from
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span>the YAML file "config/01/config.yml" (⏳ true)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📂 https_proxy (HTTPS Proxy)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┣━━ </span>📓 address (HTTPS address): <span style="color: #00aa00">https.proxy.net</span> ◀ loaded from the YAML
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff"></span>file "config/01/config.yml" (⏳ http.proxy.net)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┗━━ </span>📓 port (HTTPS port): <span style="color: #ffd700">3128</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📂 socks_proxy (SOCKS Proxy)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 address (SOCKS address): <span style="color: #ffd700">http.proxy.net</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 port (SOCKS port): <span style="color: #ffd700">3128</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📓 version (SOCKS host version used by proxy): <span style="color: #ffd700">v5</span>
<span style="color: #5c5cff">┗━━ </span>📓 proxy_mode (Configure Proxy Access to the Internet): <span style="color: #ffd700">No proxy</span>
</pre>

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

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

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

@ -0,0 +1,2 @@
---
proxy_mode: Automatic proxy configuration URL

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

@ -0,0 +1,4 @@
<pre><span style="font-weight: bold; color: #ff0000">🛑 Caution</span>
<span style="color: #ff0000">┗━━ </span>auto (Automatic proxy configuration URL): <span style="color: #ff0000">🛑 mandatory variable but has no </span>
<span style="color: #ff0000"> </span><span style="color: #ff0000">value</span>
</pre>

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

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

3
config/03/config.yml Normal file
View file

@ -0,0 +1,3 @@
---
proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat

11
config/03/output_ro.html Normal file
View file

@ -0,0 +1,11 @@
<pre>╭────────────── Caption ───────────────╮
│ Variable <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">Automatic proxy </span>
<span style="color: #5c5cff"></span><span style="color: #00aa00">configuration URL</span> ◀ loaded from the YAML file "config/03/config.yml" (⏳ No
<span style="color: #5c5cff"></span>proxy)
<span style="color: #5c5cff">┗━━ </span>📓 auto (Automatic proxy configuration URL): <span style="color: #00aa00">https://auto.proxy.net/wpad.dat</span>
<span style="color: #5c5cff"> </span>◀ loaded from the YAML file "config/03/config.yml"
</pre>

View file

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