[tutorial 028] Description of Jinja calculation (config and doc)

This commit is contained in:
egarette@silique.fr 2024-09-07 19:06:50 +02:00
parent 14be5eb0fa
commit 98986477da

View file

@ -29,6 +29,7 @@ include_toc: true
- [[tutorial 025] Conditional hidden family and calculated default value](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_025/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_025~1..v1.1_025))
- [[tutorial 026] A dynamic family](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_026/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_026~1..v1.1_026))
- [[tutorial 027] A dynamic family](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_027/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_027~1..v1.1_027))
- [[tutorial 028] Description of Jinja calculation](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_028/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_028~1..v1.1_028))
# Description
@ -36,21 +37,11 @@ include_toc: true
<img src="firefox.png" width=50% height=50% alt="Firefox Proxy setting"/>
A dynamic family
Description of Jinja calculation
HTTPS and socks proxy are very similar. It could be interesting to do on dynamic family instead of duplicate family and variable description.
By default, the Jinja calculation is generic in documentation. We can add a useful description.
First of all, we add a dynamic attribute to the family. Dynamic is here a static list of suffix. It could be a variable or jinja informations too.
The dynamic family is only hidden in the HTTPs case.
Hidden is now a Jinja calculation with a parameter named "suffix".
The suffix is use in:
- family name
- family description
- variables name
- variables description
We add a new variable "version" only accessible in "Socks" family.
# Structure
@ -105,18 +96,21 @@ manual:
use_for_https: true # Also use this proxy for HTTPS
https_proxy:
description: HTTPS Proxy
"{{ suffix }}_proxy":
description: "{{ suffix }} Proxy"
dynamic:
- HTTPS
- SOCKS
hidden:
variable: _.use_for_https
address:
description: HTTPS address
description: "{{ suffix }} address"
default:
variable: __.http_proxy.address
port:
description: HTTPS Port
description: "{{ suffix }} port"
default:
variable: __.http_proxy.port
@ -151,16 +145,21 @@ foo@bar:~$ rougail -v 1.1 -m firefox/ -o doc -do github
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **manual.use_for_https**<br/>[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Also use this proxy for HTTPS.<br/>**Default**: True |
##### HTTPS Proxy
##### "*HTTPS* Proxy" or "*SOCKS* Proxy"
`standard` _`hidden`_
**Hidden**: when the variable "manual.use_for_https" has the value "True".
This family builds families dynamically.
**Suffixes**: <br/>- HTTPS<br/>- SOCKS
| Variable&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **manual.https_proxy.address**<br/>[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | HTTPS address.<br/>**Validator**: the domain name can be an IP<br/>**Default**: the value of the variable "manual.http_proxy.address". |
| **manual.https_proxy.port**<br/>[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | HTTPS Port.<br/>**Default**: the value of the variable "manual.http_proxy.port". |
| **manual.https_proxy.address** or **manual.socks_proxy.address**<br/>[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | "*HTTPS* address" or "*SOCKS* address".<br/>**Validator**: the domain name can be an IP<br/>**Default**: the value of the variable "manual.http_proxy.address". |
| **manual.https_proxy.port** or **manual.socks_proxy.port**<br/>[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | "*HTTPS* port" or "*SOCKS* port".<br/>**Default**: the value of the variable "manual.http_proxy.port". |
# User data
@ -238,7 +237,10 @@ Variables:
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┣━━ </span>📓 address: example.net
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┗━━ </span>📓 port: <span style="color: #ffd700">8080</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 use_for_https: <span style="color: #ffd700">True</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📂 <span style="color: #ffaf00">https_proxy</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📂 <span style="color: #ffaf00">https_proxy</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┣━━ </span>📓 <span style="color: #ffaf00">address</span>: <span style="color: #ffd700">example.net</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┗━━ </span>📓 <span style="color: #ffaf00">port</span>: <span style="color: #ffd700">8080</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📂 <span style="color: #ffaf00">socks_proxy</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 <span style="color: #ffaf00">address</span>: <span style="color: #ffd700">example.net</span>
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📓 <span style="color: #ffaf00">port</span>: <span style="color: #ffd700">8080</span>
</pre>
@ -332,7 +334,10 @@ Variables:
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┣━━ </span>📓 address: http.proxy.net
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┗━━ </span>📓 port: 3128 (<span style="color: #00aa00">8080</span>)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 use_for_https: False (<span style="color: #00aa00">True</span>)
<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>📓 address: https.proxy.net (<span style="color: #00aa00">http.proxy.net</span>)
<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>📓 address: https.proxy.net (<span style="color: #00aa00">http.proxy.net</span>)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff"></span><span style="color: #5c5cff">┗━━ </span>📓 port: <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>📓 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: <span style="color: #ffd700">3128</span>
</pre>