[tutorial v1.1_181] Calculate a random color (config and doc)

This commit is contained in:
egarette@silique.fr 2026-03-12 08:11:13 +01:00
parent 0b15d1c914
commit 254e35af99
7 changed files with 108 additions and 49 deletions

View file

@ -1,9 +1,9 @@
- [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_170] A leadership family](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_170/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_180~1..v1.1_180)) - [[tutorial v1.1_180] Regexp type](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_181~1..v1.1_181))
# [tutorial v1.1_180] Regexp type # [tutorial v1.1_181] Calculate a random color
[Read the tutorial "Regexp type" in the documentation](https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/jinja.html#regexp-type) [Read the tutorial "Calculate a random color" in the documentation](https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/jinja.html#calculate-a-random-color)
## Screenshot ## Screenshot
@ -29,7 +29,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_180 git switch --detach v1.1_181
``` ```
## Structure ## Structure
@ -37,21 +37,21 @@ git switch --detach v1.1_180
<p> <p>
<a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./">.</a><br/> <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./">.</a><br/>
├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/">firefox</a><br/> ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/">firefox</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/00-proxy.yml">00-proxy.yml</a><br/> │   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/00-proxy.yml">00-proxy.yml</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/10-manual.yml">10-manual.yml</a><br/> │   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/10-manual.yml">10-manual.yml</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/20-manual.yml">20-manual.yml</a><br/> │   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/20-manual.yml">20-manual.yml</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/30-auto.yml">30-auto.yml</a><br/> │   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/30-auto.yml">30-auto.yml</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/40-no_proxy.yml">40-no_proxy.yml</a><br/> │   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/40-no_proxy.yml">40-no_proxy.yml</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/50-prompt_authentication.yml">50-prompt_authentication.yml</a><br/> │   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/50-prompt_authentication.yml">50-prompt_authentication.yml</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/55-proxy_dns_socks5.yml">55-proxy_dns_socks5.yml</a><br/> │   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/55-proxy_dns_socks5.yml">55-proxy_dns_socks5.yml</a><br/>
│   └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/60-dns_over_https.yml">60-dns_over_https.yml</a><br/> │   └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/60-dns_over_https.yml">60-dns_over_https.yml</a><br/>
├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./foxyproxy/">foxyproxy</a><br/> ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./foxyproxy/">foxyproxy</a><br/>
│   └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./foxyproxy/00-foxyproxy.yml">00-foxyproxy.yml</a><br/> │   └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./foxyproxy/00-foxyproxy.yml">00-foxyproxy.yml</a><br/>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./types/">types</a><br/> └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./types/">types</a><br/>
    └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./types/proxy/">proxy</a><br/>     └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./types/proxy/">proxy</a><br/>
        └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./types/proxy/00_type.yml">00_type.yml</a><br/>         └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./types/proxy/00_type.yml">00_type.yml</a><br/>
<br/><br/></p> <br/><br/></p>
Contents of the foxyproxy/00-foxyproxy.yml file Contents of the foxyproxy/00-foxyproxy.yml file
@ -72,6 +72,10 @@ proxies:
color: color:
description: Color description: Color
regexp: ^#(?:[0-9a-f]{3}){1,2}$ regexp: ^#(?:[0-9a-f]{3}){1,2}$
default:
jinja: >-
#{%- for i in range(6) -%}{{- '0123456789abcdef' | random -}}{%- endfor -%}
description: random color value
... ...
``` ```
@ -170,7 +174,7 @@ rougail -m firefox/ -s Firefox -xn FoxyProxy -xd 0 foxyproxy/ --types types/prox
> >
> This family is a namespace.\ > This family is a namespace.\
> **Path**: foxyproxy\ > **Path**: foxyproxy\
> `basic` > `standard`
##### Proxy configuration ##### Proxy configuration
@ -178,12 +182,12 @@ rougail -m firefox/ -s Firefox -xn FoxyProxy -xd 0 foxyproxy/ --types types/prox
> >
> This family contains lists of variable blocks.\ > This family contains lists of variable blocks.\
> **Path**: foxyproxy.proxies\ > **Path**: foxyproxy.proxies\
> `basic` > `standard`
| Variable | Description | | Variable | Description |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------| |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| **<a id="foxyproxy.proxies.title" name="foxyproxy.proxies.title">foxyproxy.proxies.title</a>**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `multiple` `standard` `unique` | Title or Description. | | **<a id="foxyproxy.proxies.title" name="foxyproxy.proxies.title">foxyproxy.proxies.title</a>**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `multiple` `standard` `unique` | Title or Description. |
| **<a id="foxyproxy.proxies.color" name="foxyproxy.proxies.color">foxyproxy.proxies.color</a>**<br/>[`regexp`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | Color.<br/>**Validator**: text based with regular expressions "^#(?:[0-9a-f]{3}){1,2}$" | | **<a id="foxyproxy.proxies.color" name="foxyproxy.proxies.color">foxyproxy.proxies.color</a>**<br/>[`regexp`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Color.<br/>**Validator**: text based with regular expressions "^#(?:[0-9a-f]{3}){1,2}$"<br/>**Default**: random color value |
*** ***
@ -195,8 +199,8 @@ rougail -m firefox/ -s Firefox -xn FoxyProxy -xd 0 foxyproxy/ --types types/prox
#### Modified variable #### Modified variable
| Variable | Description | | Variable | Description |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------| |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
| **<a id="foxyproxy.proxies.color" name="foxyproxy.proxies.color">foxyproxy.proxies.color</a>**<br/>[`regexp`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | Color.<br/>**Validator**: <ins>text based with regular expressions "^#(?:[0-9a-f]{3}){1,2}$"</ins> | | **<a id="foxyproxy.proxies.color" name="foxyproxy.proxies.color">foxyproxy.proxies.color</a>**<br/>~~`basic`~~ <ins>`standard`</ins> [`regexp`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Color.<br/>**Validator**: text based with regular expressions "^#(?:[0-9a-f]{3}){1,2}$"<br/>**Default**: <ins>random color value</ins> |
*** ***
@ -242,7 +246,6 @@ Variables:
foxyproxy: foxyproxy:
proxies: proxies:
- title: My company - title: My company
color: '#66cc66'
``` ```
*** ***
@ -267,9 +270,46 @@ Variables:
- :open_file_folder: proxies (Proxy configuration) - :open_file_folder: proxies (Proxy configuration)
- :open_file_folder: title (Title or Description) - :open_file_folder: title (Title or Description)
- :notebook: title (Title or Description): <span style="color: #006400">My company</span> ← loaded from the YAML file "config/02/config.yml" - :notebook: title (Title or Description): <span style="color: #006400">My company</span> ← loaded from the YAML file "config/02/config.yml"
- :notebook: color (Color): <span style="color: #006400">#66cc66</span> ← loaded from the YAML file "config/02/config.yml" - :notebook: color (Color): <span style="color: #B8860B">#00f139</span>
***
### Example 3
#### config/03/config.yml
```yml
---
foxyproxy:
proxies:
- title: My company
```
***
#### Output
```shell
rougail -m firefox/ -s Firefox -xn FoxyProxy -xd 0 foxyproxy/ --types types/proxy --modes_level basic standard advanced -u yaml -yf config/03/config.yml
```
> [!NOTE]
>
> **Caption:**
> - Variable
> - <span style="color: #B8860B">Default value</span>
> - <span style="color: #006400">Modified value</span>
Variables:
- :open_file_folder: firefox (Firefox)
- :notebook: proxy_mode (Configure Proxy Access to the Internet): <span style="color: #B8860B">No proxy</span>
- :open_file_folder: dns_over_https (DNS over HTTPS)
- :notebook: enable_dns_over_https (Enable DNS over HTTPS): <span style="color: #B8860B">false</span>
- :open_file_folder: foxyproxy (FoxyProxy)
- :open_file_folder: proxies (Proxy configuration)
- :open_file_folder: title (Title or Description)
- :notebook: title (Title or Description): <span style="color: #006400">My company</span> ← loaded from the YAML file "config/03/config.yml"
- :notebook: color (Color): <span style="color: #B8860B">#d0b88b</span>
*** ***
- [[tutorial v1.1_181] Calculate a random color](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_181~1..v1.1_181)) - [[tutorial v1.1_182] Auto save value](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_182/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_182~1..v1.1_182))

View file

@ -2,4 +2,3 @@
foxyproxy: foxyproxy:
proxies: proxies:
- title: My company - title: My company
color: '#66cc66'

View file

@ -12,6 +12,5 @@ Variables:
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📂 title (Title or Description) <span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📂 title (Title or Description)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 title (Title or Description): <span style="color: #00aa00">My company</span> ◀ loaded from the <span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 title (Title or Description): <span style="color: #00aa00">My company</span> ◀ loaded from the
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span>YAML file "config/02/config.yml" <span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span>YAML file "config/02/config.yml"
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📓 color (Color): <span style="color: #00aa00">#66cc66</span> ◀ loaded from the YAML file <span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📓 color (Color): <span style="color: #ffd700">#123681</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span>"config/02/config.yml"
</pre> </pre>

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

@ -0,0 +1 @@
rougail -m firefox/ -s Firefox -xn FoxyProxy -xd 0 foxyproxy/ --types types/proxy --modes_level basic standard advanced -u yaml -yf config/03/config.yml

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

@ -0,0 +1,4 @@
---
foxyproxy:
proxies:
- title: My company

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

@ -0,0 +1,16 @@
<pre>╭──────── Caption ────────╮
│ Variable <span style="color: #ffd700">Default value</span>
<span style="color: #00aa00">Modified value</span>
╰─────────────────────────╯
Variables:
<span style="color: #5c5cff">┣━━ </span>📂 firefox (Firefox)
<span style="color: #5c5cff"></span><span style="color: #5c5cff">┣━━ </span>📓 proxy_mode (Configure Proxy Access to the Internet): <span style="color: #ffd700">No proxy</span>
<span style="color: #5c5cff"></span><span style="color: #5c5cff">┗━━ </span>📂 dns_over_https (DNS over HTTPS)
<span style="color: #5c5cff"></span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📓 enable_dns_over_https (Enable DNS over HTTPS): <span style="color: #ffd700">false</span>
<span style="color: #5c5cff">┗━━ </span>📂 foxyproxy (FoxyProxy)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📂 proxies (Proxy configuration)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📂 title (Title or Description)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 title (Title or Description): <span style="color: #00aa00">My company</span> ◀ loaded from the
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span>YAML file "config/03/config.yml"
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📓 color (Color): <span style="color: #ffd700">#fb01ac</span>
</pre>

View file

@ -1,17 +1,17 @@
<p> <p>
<a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./">.</a><br/> <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./">.</a><br/>
├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/">firefox</a><br/> ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/">firefox</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/00-proxy.yml">00-proxy.yml</a><br/> │   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/00-proxy.yml">00-proxy.yml</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/10-manual.yml">10-manual.yml</a><br/> │   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/10-manual.yml">10-manual.yml</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/20-manual.yml">20-manual.yml</a><br/> │   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/20-manual.yml">20-manual.yml</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/30-auto.yml">30-auto.yml</a><br/> │   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/30-auto.yml">30-auto.yml</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/40-no_proxy.yml">40-no_proxy.yml</a><br/> │   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/40-no_proxy.yml">40-no_proxy.yml</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/50-prompt_authentication.yml">50-prompt_authentication.yml</a><br/> │   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/50-prompt_authentication.yml">50-prompt_authentication.yml</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/55-proxy_dns_socks5.yml">55-proxy_dns_socks5.yml</a><br/> │   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/55-proxy_dns_socks5.yml">55-proxy_dns_socks5.yml</a><br/>
│   └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./firefox/60-dns_over_https.yml">60-dns_over_https.yml</a><br/> │   └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./firefox/60-dns_over_https.yml">60-dns_over_https.yml</a><br/>
├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./foxyproxy/">foxyproxy</a><br/> ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./foxyproxy/">foxyproxy</a><br/>
│   └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./foxyproxy/00-foxyproxy.yml">00-foxyproxy.yml</a><br/> │   └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./foxyproxy/00-foxyproxy.yml">00-foxyproxy.yml</a><br/>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./types/">types</a><br/> └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./types/">types</a><br/>
    └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./types/proxy/">proxy</a><br/>     └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./types/proxy/">proxy</a><br/>
        └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_180/./types/proxy/00_type.yml">00_type.yml</a><br/>         └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_181/./types/proxy/00_type.yml">00_type.yml</a><br/>
<br/><br/></p> <br/><br/></p>