mirror of
https://git.sakamoto.pl/laudom/http.sh.git
synced 2025-08-12 16:33:36 +02:00
Compare commits
No commits in common. "ec0238f76f238f8a29e9b6ea327c70d5529958a1" and "f2d72ef6eed3d8acc483d46872284c2df202797b" have entirely different histories.
ec0238f76f
...
f2d72ef6ee
2 changed files with 0 additions and 19 deletions
|
@ -155,15 +155,3 @@ This is very useful when creating menus; Instead of relying on hardcoded values,
|
||||||
on *the same URI level*, one can create links such as `<a href="{{-uri-2}}meow">(...)</a>`, which will always
|
on *the same URI level*, one can create links such as `<a href="{{-uri-2}}meow">(...)</a>`, which will always
|
||||||
resolve to the same file; This eliminates a whole class of bugs where trailing slashes would break some
|
resolve to the same file; This eliminates a whole class of bugs where trailing slashes would break some
|
||||||
poorly-written relative URLs.
|
poorly-written relative URLs.
|
||||||
|
|
||||||
## Set statement
|
|
||||||
|
|
||||||
| | |
|
|
||||||
| --- | --- |
|
|
||||||
| In the template | `{{-set-<name>}}` |
|
|
||||||
| In the code | n/a |
|
|
||||||
| Notes | Very simple, processed out of order, nesting in conditional statements will not work. |
|
|
||||||
|
|
||||||
If `{{-set-<name>}}` exists anywhere within your processed template (including the included templates),
|
|
||||||
`array[?<name>]` will get set internally. This can be used to conditionally enable parts of another template
|
|
||||||
based on what other templates are loaded.
|
|
||||||
|
|
|
@ -38,13 +38,6 @@ function render() {
|
||||||
buf+="${subtemplate}"
|
buf+="${subtemplate}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# process special set statements
|
|
||||||
if [[ "$template"$'\n'"$garbage" == *'{{-set-'* ]]; then
|
|
||||||
while read key; do
|
|
||||||
ref["?$key"]=_
|
|
||||||
done <<< "$(grep -Poh '{{-set-\K(.*?)(?=}})' <<< "$template")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local key
|
local key
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
for key in ${!ref[@]}; do
|
for key in ${!ref[@]}; do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue