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

This commit is contained in:
egarette@silique.fr 2025-12-02 16:18:53 +01:00
parent 79b1619466
commit 8110098a15
10 changed files with 118 additions and 114 deletions

159
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
...
```
@ -146,6 +115,22 @@ 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
### Example 1
@ -155,45 +140,65 @@ 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
```
#### Output
```shell
rougail -m firefox/ -u yaml -yf config/01/config.yml
```
<pre><span style="font-weight: bold; color: #ffff00">🔔 WARNINGS</span>
<span style="color: #ffff00">┗━━ </span>variable "auto" (Automatic proxy configuration URL) is disabled, it will be
<span style="color: #ffff00"> </span>ignored when loading from the YAML file "config/01/config.yml"
╭──────────────────── Caption ─────────────────────╮
<span style="color: #ff0000">Undocumented but modified variable</span> <span style="color: #ffd700">Default value</span>
╰──────────────────────────────────────────────────╯
Variables:
<span style="color: #5c5cff">┗━━ </span>📓 <span style="color: #ff0000">Configure Proxy Access to the Internet</span>: <span style="color: #ffd700">No proxy</span>
</pre>
### 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
```
<pre><span style="font-weight: bold; color: #ff0000">🛑 ERRORS</span>
<span style="color: #ff0000">┗━━ </span>The following variables are mandatory but have no value:
<span style="color: #ff0000"> </span><span style="color: #ff0000">┗━━ </span>Automatic proxy configuration URL
</pre>
### 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
```
<pre>╭─────────────────────────── Caption ────────────────────────────╮
│ Variable <span style="color: #ffd700">Default value</span>
<span style="color: #ff0000">Undocumented but modified variable</span> <span style="color: #00aa00">Modified value</span>
│ (⏳ Original default value) │
╰────────────────────────────────────────────────────────────────╯
Variables:
<span style="color: #5c5cff">┣━━ </span>📓 <span style="color: #ff0000">Configure Proxy Access to the Internet</span>: <span style="color: #00aa00">Manual proxy configuration</span>
<span style="color: #5c5cff"></span>loaded from the YAML file "config/01/config.yml" (⏳ No proxy)
<span style="color: #5c5cff">┗━━ </span>📂 Manual proxy configuration
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📂 HTTP Proxy
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┣━━ </span>📓 <span style="color: #ff0000">HTTP address</span>: <span style="color: #00aa00">http.proxy.net</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"
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┗━━ </span>📓 <span style="color: #ff0000">HTTP Port</span>: <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>📓 <span style="color: #ff0000">Also use this proxy for HTTPS</span>: <span style="color: #00aa00">false</span> ◀ loaded from the YAML file
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span>"config/01/config.yml" (⏳ true)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📂 HTTPS Proxy
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┣━━ </span>📓 <span style="color: #ff0000">HTTPS address</span>: <span style="color: #00aa00">https.proxy.net</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" (⏳ http.proxy.net)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┗━━ </span>📓 <span style="color: #ff0000">HTTPS port</span>: <span style="color: #ffd700">3128</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📂 SOCKS Proxy
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 <span style="color: #ff0000">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: #ff0000">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: #ff0000">SOCKS host version used by proxy</span>: <span style="color: #ffd700">v5</span>
<span style="color: #5c5cff">┣━━ </span>📓 <span style="color: #ff0000">Configure Proxy Access to the Internet</span>: <span style="color: #00aa00">Automatic proxy configuration URL</span>
<span style="color: #5c5cff"></span>◀ loaded from the YAML file "config/03/config.yml" (⏳ No proxy)
<span style="color: #5c5cff">┗━━ </span>📓 <span style="color: #ff0000">Automatic proxy configuration URL</span>: <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>
- [[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,25 +1,9 @@
<pre>╭─────────────────────────── Caption ────────────────────────────╮
│ Variable <span style="color: #ffd700">Default value</span>
<span style="color: #ff0000">Undocumented but modified variable</span> <span style="color: #00aa00">Modified value</span>
│ (⏳ Original default value) │
╰────────────────────────────────────────────────────────────────╯
<pre><span style="font-weight: bold; color: #ffff00">🔔 WARNINGS</span>
<span style="color: #ffff00">┗━━ </span>variable "auto" (Automatic proxy configuration URL) is disabled, it will be
<span style="color: #ffff00"> </span>ignored when loading from the YAML file "config/01/config.yml"
╭──────────────────── Caption ─────────────────────╮
<span style="color: #ff0000">Undocumented but modified variable</span> <span style="color: #ffd700">Default value</span>
╰──────────────────────────────────────────────────╯
Variables:
<span style="color: #5c5cff">┣━━ </span>📓 <span style="color: #ff0000">Configure Proxy Access to the Internet</span>: <span style="color: #00aa00">Manual proxy configuration</span>
<span style="color: #5c5cff"></span>loaded from the YAML file "config/01/config.yml" (⏳ No proxy)
<span style="color: #5c5cff">┗━━ </span>📂 Manual proxy configuration
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📂 HTTP Proxy
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┣━━ </span>📓 <span style="color: #ff0000">HTTP address</span>: <span style="color: #00aa00">http.proxy.net</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"
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┗━━ </span>📓 <span style="color: #ff0000">HTTP Port</span>: <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>📓 <span style="color: #ff0000">Also use this proxy for HTTPS</span>: <span style="color: #00aa00">false</span> ◀ loaded from the YAML file
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span>"config/01/config.yml" (⏳ true)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📂 HTTPS Proxy
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┣━━ </span>📓 <span style="color: #ff0000">HTTPS address</span>: <span style="color: #00aa00">https.proxy.net</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" (⏳ http.proxy.net)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┗━━ </span>📓 <span style="color: #ff0000">HTTPS port</span>: <span style="color: #ffd700">3128</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📂 SOCKS Proxy
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 <span style="color: #ff0000">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: #ff0000">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: #ff0000">SOCKS host version used by proxy</span>: <span style="color: #ffd700">v5</span>
<span style="color: #5c5cff">┗━━ </span>📓 <span style="color: #ff0000">Configure Proxy Access to the Internet</span>: <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">🛑 ERRORS</span>
<span style="color: #ff0000">┗━━ </span>The following variables are mandatory but have no value:
<span style="color: #ff0000"> </span><span style="color: #ff0000">┗━━ </span>Automatic proxy configuration URL
</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

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

@ -0,0 +1,10 @@
<pre>╭─────────────────────────── Caption ────────────────────────────╮
<span style="color: #ff0000">Undocumented but modified variable</span> <span style="color: #00aa00">Modified value</span>
│ (⏳ Original default value) │
╰────────────────────────────────────────────────────────────────╯
Variables:
<span style="color: #5c5cff">┣━━ </span>📓 <span style="color: #ff0000">Configure Proxy Access to the Internet</span>: <span style="color: #00aa00">Automatic proxy configuration URL</span>
<span style="color: #5c5cff"></span>◀ loaded from the YAML file "config/03/config.yml" (⏳ No proxy)
<span style="color: #5c5cff">┗━━ </span>📓 <span style="color: #ff0000">Automatic proxy configuration URL</span>: <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

@ -25,14 +25,15 @@
</head>
<body>
<h1>Directory Tree</h1><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>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_072/./firefox/00-proxy.yml">00-proxy.yml</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_072/./firefox/10-manual.yml">10-manual.yml</a><br>
&nbsp;&nbsp;&nbsp; └── <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>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_080/./firefox/00-proxy.yml">00-proxy.yml</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_080/./firefox/10-manual.yml">10-manual.yml</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_080/./firefox/20-manual.yml">20-manual.yml</a><br>
&nbsp;&nbsp;&nbsp; └── <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>
2 directories, 3 files
2 directories, 4 files
</p>
<hr>