This commit is contained in:
egarette@silique.fr 2026-03-08 07:49:25 +01:00
parent 21669746a3
commit 7f44b505c9
173 changed files with 545 additions and 204 deletions

View file

@ -24,9 +24,10 @@ if __name__ == "__main__":
# rougailconfig = RougailConfig.copy() # rougailconfig = RougailConfig.copy()
rougailconfig = get_rougail_config(backward_compatibility=False, add_extra_options=False) rougailconfig = get_rougail_config(backward_compatibility=False, add_extra_options=False)
rougailconfig['main_structural_directories'] = ['firefox'] rougailconfig['main_structural_directories'] = ['firefox']
if Path('config/namespace').is_file(): if Path('namespace').is_file():
has_namespace = True has_namespace = True
has_foxyproxy = False has_foxyproxy = False
rougailconfig['main_namespace'] = 'Firefox'
elif Path('foxyproxy').is_dir(): elif Path('foxyproxy').is_dir():
has_foxyproxy = True has_foxyproxy = True
has_namespace = True has_namespace = True
@ -36,6 +37,11 @@ if __name__ == "__main__":
has_foxyproxy = False has_foxyproxy = False
has_namespace = False has_namespace = False
rougailconfig['main_namespace'] = None rougailconfig['main_namespace'] = None
if Path('types').is_dir():
has_types = True
rougailconfig['types'] = [str(d) for d in Path('types').iterdir()]
else:
has_types = False
# rougailconfig['tiramisu_cache'] = "cache.py" # rougailconfig['tiramisu_cache'] = "cache.py"
if Path('mode').is_file(): if Path('mode').is_file():
rougailconfig['modes_level'] = ['basic', 'standard', 'advanced'] rougailconfig['modes_level'] = ['basic', 'standard', 'advanced']
@ -62,12 +68,12 @@ if __name__ == "__main__":
doc = '' doc = ''
yaml = YAML() yaml = YAML()
namespace = 'firefox' namespace = 'firefox'
if rougailconfig['main_namespace']: if has_foxyproxy:
dirname = "foxyproxy" dirname = "foxyproxy"
else: else:
dirname = "firefox" dirname = "firefox"
doc += inv_formatter.title('Screenshot', 2) + '\n' doc += inv_formatter.title('Screenshot', 2) + '\n'
doc += f'<img src="{namespace}.png" width=50% height=50% alt="{namespace.capitalize()} Proxy setting"/>\n\n' doc += f'<img src="{dirname}.png" width=50% height=50% alt="{namespace.capitalize()} Proxy setting"/>\n\n'
# with doc_file.open('r') as docfh: # with doc_file.open('r') as docfh:
# doc += docfh.read() # doc += docfh.read()
doc += '\n' + inv_formatter.title('Clone and install', 2) + '\n\n' doc += '\n' + inv_formatter.title('Clone and install', 2) + '\n\n'
@ -76,7 +82,6 @@ if __name__ == "__main__":
doc += "Then switch to the tutorial page:\n\n" doc += "Then switch to the tutorial page:\n\n"
doc += f"```shell\ngit switch --detach {commit_id}\n```\n" doc += f"```shell\ngit switch --detach {commit_id}\n```\n"
tree = Path('tree.html') tree = Path('tree.html')
display_yml = None
if tree.is_file(): if tree.is_file():
doc += '\n' + inv_formatter.title('Structure', 2) + '\n\n' doc += '\n' + inv_formatter.title('Structure', 2) + '\n\n'
with tree.open() as fh: with tree.open() as fh:
@ -85,19 +90,21 @@ if __name__ == "__main__":
doc += tree_content + "\n\n" doc += tree_content + "\n\n"
with tree.open("w") as fh: with tree.open("w") as fh:
fh.write(tree_content) fh.write(tree_content)
for f in Path(".").iterdir(): display_yml = None
if f.name.startswith('DISPLAY_'): if not (Path(".") / 'NODISPLAY').is_file():
filename = f.name[8:] for f in Path(".").iterdir():
display_yml = Path(dirname) / filename if f.name.startswith('DISPLAY_'):
break filename = f.name[8:]
else: display_yml = Path(dirname) / filename
files = list(Path(dirname).iterdir()) break
files.sort() else:
for f in reversed(files): files = list(Path(dirname).iterdir())
if not f.name.endswith('.yml'): files.sort()
continue for f in reversed(files):
display_yml = f if not f.name.endswith('.yml'):
break continue
display_yml = f
break
if display_yml: if display_yml:
doc += f"Contents of the {str(display_yml)} file" doc += f"Contents of the {str(display_yml)} file"
doc += '\n\n```yml\n' doc += '\n\n```yml\n'
@ -113,6 +120,8 @@ if __name__ == "__main__":
CMD += "-s Firefox " CMD += "-s Firefox "
if has_foxyproxy: if has_foxyproxy:
CMD += "-xn FoxyProxy -xd 0 foxyproxy/ " CMD += "-xn FoxyProxy -xd 0 foxyproxy/ "
if has_types:
CMD += "--types " + " ".join(rougailconfig["types"]) + " "
if has_mode: if has_mode:
CMD += "--modes_level basic standard advanced " CMD += "--modes_level basic standard advanced "
if inv_doc: if inv_doc:
@ -127,7 +136,7 @@ if __name__ == "__main__":
inv_doc = inventory.run()[1] inv_doc = inventory.run()[1]
if inv_doc: if inv_doc:
doc += inv_formatter.title("Let's generate the changelog", 3) doc += inv_formatter.title("Let's generate the changelog", 3)
cmd = CMD + "-o doc --doc.contents changelog" cmd = CMD + "-o doc --doc.contents changelog --doc.changelog.previous_json_file previous.yml"
doc += f'```shell\n{cmd}\n```\n' doc += f'```shell\n{cmd}\n```\n'
doc += inv_doc + "\n" doc += inv_doc + "\n"
doc += "***\n" doc += "***\n"

View file

@ -54,7 +54,7 @@ for i in $(ls -d "examples"/* | sort); do
base_url_doc=$(cat $i/URL) base_url_doc=$(cat $i/URL)
fi fi
if [ -f "$i/TITLE.md" ]; then if [ -f "$i/TITLE.md" ]; then
echo "- [$(head -n 1 $i/TITLE.md)]($base_url_doc)" >> summary.md echo "- $(head -n 1 $i/TITLE.md) ([doc]($base_url_doc))" >> summary.md
fi fi
if [ -f "$i/SUBTITLE.md" ]; then if [ -f "$i/SUBTITLE.md" ]; then
echo " - $(head -n 1 $i/SUBTITLE.md)" >> summary.md echo " - $(head -n 1 $i/SUBTITLE.md)" >> summary.md
@ -66,7 +66,7 @@ for i in $(ls -d "examples"/* | sort); do
commit_id="v${VERSION}_$num" commit_id="v${VERSION}_$num"
title=$(head -n 1 $i/README.md) title=$(head -n 1 $i/README.md)
summary="[tutorial $commit_id] $title" summary="[tutorial $commit_id] $title"
url_doc="$base_url_doc#$(echo $title | tr A-Z a-z | sed 's/ /-/g' | sed 's//-/g')" url_doc="$base_url_doc#$(echo $title | tr A-Z a-z | sed 's/ /-/g' | sed 's//-/g' | sed 's/\"//g')"
diff_url="https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/${commit_id}~1..$commit_id" diff_url="https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/${commit_id}~1..$commit_id"
echo " - [$summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/$commit_id/README.md) ([doc]($url_doc) - [diff]($diff_url))" >> summary.md echo " - [$summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/$commit_id/README.md) ([doc]($url_doc) - [diff]($diff_url))" >> summary.md
cp "summary_total.md" "$DEST" cp "summary_total.md" "$DEST"
@ -83,10 +83,16 @@ for i in $(ls -d "examples"/* | sort); do
cp -v "$j" "$DEST/$j" cp -v "$j" "$DEST/$j"
done done
fi fi
if [ -d ../types ]; then
mkdir -p $DEST/types
for j in $(ls -d ../types/* 2>/dev/null); do
cp -va "$j" "$DEST/types/"
done
fi
cd $DEST cd $DEST
tree -H $TUTO_ROOT/$commit_id/ -P "*.yml" > tree.html tree -H $TUTO_ROOT/$commit_id/ -P "*.yml" > tree.html
cd - > /dev/null cd - > /dev/null
cp -v DISPLAY_* "$DEST/" 2> /dev/null || true cp -v NODISPLAY DISPLAY_* "$DEST/" 2> /dev/null || true
cp -f ../README.md "$DEST" cp -f ../README.md "$DEST"
if [ -d ../config ]; then if [ -d ../config ]; then
cp -aL ../config "$DEST" cp -aL ../config "$DEST"
@ -94,20 +100,18 @@ for i in $(ls -d "examples"/* | sort); do
msg="[tutorial $commit_id] $(cat ../README.md)" msg="[tutorial $commit_id] $(cat ../README.md)"
[ -e ../firefox.png ] && cp ../firefox.png "$DEST" [ -e ../firefox.png ] && cp ../firefox.png "$DEST"
[ -e ../foxyproxy.png ] && cp ../foxyproxy.png "$DEST" [ -e ../foxyproxy.png ] && cp ../foxyproxy.png "$DEST"
[ -e ../namespace ] && cp ../namespace "$DEST"
cd $BEFORE cd $BEFORE
cd "$DEST" cd "$DEST"
# #
before=$(grep "commit/$commit_id/README.md" summary_total.md -B1 | wc -l)
echo "- [Summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/branch/$VERSION/README.md)" > summary_before.md echo "- [Summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/branch/$VERSION/README.md)" > summary_before.md
if [ "$before" = "2" ]; then if [ -n "$old_commit_id" ]; then
echo $(grep "commit/$commit_id/README.md" summary_total.md -B1 | head -n 1) >> summary_before.md echo "- [$old_summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/$old_commit_id/README.md) ([diff]($diff_url))" >> summary_before.md
fi fi
echo "" >> summary_before.md echo "" >> summary_before.md
echo "# $summary" >> summary_before.md echo "# $summary" >> summary_before.md
echo "" >> summary_before.md echo "" >> summary_before.md
echo "[View the diff]($diff_url)" >> summary_before.md echo "[Read the tutorial \"$title\" in the documentation]($url_doc)" >> summary_before.md
echo "" >> summary_before.md
echo "[Read the documentation]($url_doc)" >> summary_before.md
after=$(grep "commit/$commit_id/README.md" summary_total.md -A1 | wc -l) after=$(grep "commit/$commit_id/README.md" summary_total.md -A1 | wc -l)
if [ "$after" = "2" ]; then if [ "$after" = "2" ]; then
echo $(grep "commit/$commit_id/README.md" summary_total.md -A1 | tail -n 1) > summary_after.md echo $(grep "commit/$commit_id/README.md" summary_total.md -A1 | tail -n 1) > summary_after.md
@ -117,7 +121,7 @@ for i in $(ls -d "examples"/* | sort); do
mv config/mode mode mv config/mode mode
fi fi
"$BUILDER"/build.py "$BUILDER" "$commit_id" "$BUILDER"/build.py "$BUILDER" "$commit_id"
rm -rf config/*/README.md config/*/read_write config/namespace config/*/invalid DISPLAY_* rm -rf config/*/README.md config/*/read_write namespace config/*/invalid DISPLAY_* NODISPLAY
rm -rf jinja_caches summary.md summary_before.md summary_after.md summary_total.md rm -rf jinja_caches summary.md summary_before.md summary_after.md summary_total.md
if [ -f mode ]; then if [ -f mode ]; then
MODE=1 MODE=1
@ -133,13 +137,17 @@ for i in $(ls -d "examples"/* | sort); do
fi fi
git commit -m"$summary (config and doc)" git commit -m"$summary (config and doc)"
git add . git add .
git commit -am"$msg" git commit -am"$msg" --allow-empty
git tag -a "$commit_id" -m"format version $VERSION: $num" git tag -a "$commit_id" -m"format version $VERSION: $num"
if [ "$MODE" = 1 ]; then if [ "$MODE" = 1 ]; then
touch mode touch mode
fi fi
cd - > /dev/null cd - > /dev/null
# old_commit_id="$commit_id" old_commit_id="$commit_id"
old_summary="$summary"
# echo "pouet $i"
# [ "$i" = "examples/120" ] && exit 1
if [ -f previous.yml ]; then cp -a previous.yml previous_old.yml; fi
fi fi
done done
cd "$DEST" cd "$DEST"

View file

@ -1,8 +1 @@
Or a sub family Or a sub family
Inside a family, we can have variables or families.
The "type" for family "manual" became unecessary because container an other family, so it's not a variable.
The description can now be has family comment.
In disabled attribute, it's better tu use relative path (we will see the reason in an other slide).

View file

@ -1 +1 @@
A variable with type's parameters A variable with types parameters

View file

@ -1 +1 @@
https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/calculated.html https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/properties.html

View file

@ -1 +1 @@
A conditional disabled variable with type web_address HTTP Proxy with "proxy" type

View file

@ -1 +1 @@
A web_address variable Custom type

View file

@ -1 +1,2 @@
We cannot configure "auto" if "proxy_mode" is not "Automatic proxy configuration URL". If "use_for_https" is false, HTTPS variables are visible in read only mode and in read write mode.

View file

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

View file

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

View file

@ -0,0 +1,14 @@
%YAML 1.2
---
version: 1.1
manual:
description: Manual proxy configuration
disabled:
variable: _.proxy_mode
when_not: Manual proxy configuration
http_proxy:
description: HTTP Proxy
type: proxy
...

View file

@ -0,0 +1,19 @@
%YAML 1.2
---
version: 1.1
proxy:
address:
description: Proxy address
type: domainname
params:
allow_ip: true
mandatory: false
port:
description: Proxy port
type: port
default: 8080
mandatory: false
...

1
examples/081/README.md Normal file
View file

@ -0,0 +1 @@
HTTPS and SOCKS Proxy

View file

@ -0,0 +1,2 @@
If "use_for_https" is false, HTTPS variables are visible in read only mode and in read write mode.

View file

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

View file

@ -0,0 +1,35 @@
%YAML 1.2
---
version: 1.1
manual:
use_for_https: true # Also use this proxy for HTTPS
https_proxy:
description: HTTPS Proxy
type: proxy
hidden:
variable: _.use_for_https
address:
default:
variable: __.http_proxy.address
mandatory: true
port:
default:
variable: __.http_proxy.port
mandatory: true
socks_proxy:
description: SOCKS Proxy
type: proxy
version:
description: SOCKS host version used by proxy
choices:
- v4
- v5
default: v5
...

View file

@ -1 +1 @@
A conditional disabled variable with type domainname and parameters A conditional disabled variable with type web_address

View file

@ -1 +1 @@
A full documented variable with multiple values and not mandatory A web_address variable

View file

@ -0,0 +1 @@
We cannot configure "auto" if "proxy_mode" is not "Automatic proxy configuration URL".

View file

@ -1 +1,2 @@
--- ---
auto: https://auto.proxy.net/wpad.dat

View file

@ -1,4 +1,2 @@
--- ---
proxy_mode: Automatic proxy configuration URL proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat
no_proxy: 192.168.1.0/24

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

View file

@ -1 +0,0 @@
A variable with multiple value

View file

@ -1,6 +0,0 @@
---
proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat
no_proxy:
- example.net
- 192.168.1.0/24

View file

@ -1 +0,0 @@
A non mandatory variable

View file

@ -1,6 +0,0 @@
---
proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat
no_proxy:
- example.net
- 192.168.1.0/24

View file

@ -1 +0,0 @@
Examples

View file

@ -1,6 +0,0 @@
---
proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat
no_proxy:
- example.net
- 192.168.1.0/24

View file

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

View file

@ -1 +0,0 @@
A conditional disabled boolean variable

View file

@ -1 +0,0 @@
Various variables

View file

@ -1 +0,0 @@
A Jinja conditional disabled boolean variable

View file

@ -1,18 +0,0 @@
%YAML 1.2
---
version: 1.1
proxy_dns_socks5:
description: Use proxy DNS when using SOCKS v5
default: false
disabled:
jinja: |-
{% if _.manual.socks_proxy.version is propertyerror %}
the proxy mode is not manual
{% elif _.manual.socks_proxy.version == 'v4' %}
socks version is v4
{% endif %}
description: |-
if "firefox.proxy_mode" is not "Manual proxy configuration"
or "firefox.manual.socks_proxy.version" is "v4"
...

View file

@ -1,19 +0,0 @@
%YAML 1.2
---
version: 1.1
proxy_dns_socks5:
description: Use proxy DNS when using SOCKS v5
mode: advanced
default: false
disabled:
jinja: |-
{% if _.manual.socks_proxy.version is propertyerror %}
the proxy mode is not manual
{% elif _.manual.socks_proxy.version == 'v4' %}
socks version is v4
{% endif %}
description: |-
if "firefox.proxy_mode" is not "Manual proxy configuration"
or "firefox.manual.socks_proxy.version" is "v4"
...

View file

@ -1 +1 @@
A boolean variable A conditional disabled variable with type domainname and parameters

View file

@ -1 +1 @@
Various variables A full documented variable with multiple values and not mandatory

View file

@ -1,3 +1,4 @@
--- ---
proxy_mode: Automatic proxy configuration URL proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat auto: https://auto.proxy.net/wpad.dat
no_proxy: 192.168.1.0/24

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

View file

@ -1 +1 @@
A choice variable A variable with multiple value

View file

@ -1,3 +1,6 @@
--- ---
dns_over_https: proxy_mode: Automatic proxy configuration URL
enable_dns_over_https: true auto: https://auto.proxy.net/wpad.dat
no_proxy:
- example.net
- 192.168.1.0/24

View file

@ -1 +1 @@
A web_address variable A non mandatory variable

View file

@ -1,3 +1,6 @@
--- ---
dns_over_https: proxy_mode: Automatic proxy configuration URL
enable_dns_over_https: true auto: https://auto.proxy.net/wpad.dat
no_proxy:
- example.net
- 192.168.1.0/24

View file

@ -1,5 +1,3 @@
--- ---
dns_over_https: proxy_mode: Automatic proxy configuration URL
enable_dns_over_https: true auto: https://auto.proxy.net/wpad.dat
provider: Custom
custom_dns_url: http://dns.net

View file

@ -1 +1 @@
A variable with custom validation Examples

View file

@ -1,3 +1,6 @@
--- ---
dns_over_https: proxy_mode: Automatic proxy configuration URL
enable_dns_over_https: true auto: https://auto.proxy.net/wpad.dat
no_proxy:
- example.net
- 192.168.1.0/24

View file

@ -1,5 +1,3 @@
--- ---
dns_over_https: proxy_mode: Automatic proxy configuration URL
enable_dns_over_https: true auto: https://auto.proxy.net/wpad.dat
provider: Custom
custom_dns_url: http://dns.net

View file

@ -1 +1 @@
Namespace A conditional disabled boolean variable

View file

@ -1 +1 @@
Namespace Practice

View file

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View file

@ -1,4 +0,0 @@
%YAML 1.2
---
version: 1.1
...

View file

@ -1 +0,0 @@
xxx

View file

@ -1 +1 @@
xxx A boolean variable

View file

@ -1 +1 @@
xxx A Jinja conditional disabled boolean variable

View file

@ -0,0 +1,15 @@
%YAML 1.2
---
version: 1.1
proxy_dns_socks5:
description: Use proxy DNS when using SOCKS v5
default: false
disabled:
jinja: |-
{{ _.proxy_mode != "Manual proxy configuration" or _.manual.socks_proxy.version == 'v4' }}
return_type: boolean
description: |-
if "_.proxy_mode" is not "Manual proxy configuration"
or "_.manual.socks_proxy.version" is "v4"
...

View file

@ -1 +0,0 @@
xxx

View file

@ -1 +0,0 @@
xxx

View file

@ -1 +1 @@
xxx Disabled a variable when an other variable are disabled

1
examples/120/TITLE.md Normal file
View file

@ -0,0 +1 @@
The Jinja propertyerror filter

View file

@ -0,0 +1,15 @@
%YAML 1.2
---
version: 1.1
proxy_dns_socks5:
description: Use proxy DNS when using SOCKS v5
default: false
disabled:
jinja: |-
{{ _.manual.socks_proxy.version is propertyerror or _.manual.socks_proxy.version == 'v4' }}
return_type: boolean
description: |-
if "_.proxy_mode" is not "Manual proxy configuration"
or "_.manual.socks_proxy.version" is "v4"
...

View file

@ -0,0 +1,5 @@
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: http.proxy.net

View file

@ -0,0 +1,6 @@
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: http.proxy.net
proxy_dns_socks5: true

View file

@ -0,0 +1,7 @@
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: http.proxy.net
socks_proxy:
version: v4

View file

@ -0,0 +1,16 @@
%YAML 1.2
---
version: 1.1
proxy_dns_socks5:
description: Use proxy DNS when using SOCKS v5
mode: advanced
default: false
disabled:
jinja: |-
{{ _.manual.socks_proxy.version is propertyerror or _.manual.socks_proxy.version == 'v4' }}
return_type: boolean
description: |-
if "_.proxy_mode" is not "Manual proxy configuration"
or "_.manual.socks_proxy.version" is "v4"
...

1
examples/140/TITLE.md Normal file
View file

@ -0,0 +1 @@
Practice

Some files were not shown because too many files have changed in this diff Show more