ucm: add Prepend and Append block handling for If conditions (syntax 8+)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2025-11-17 18:00:59 +01:00
parent ebfc29110c
commit a8620e814b
2 changed files with 125 additions and 26 deletions

View file

@ -550,6 +550,14 @@ must define a *Condition* block and *True* or *False* blocks or both. The *True*
blocks will be merged to the parent tree (where the *If* block is defined) when
the *Condition* is evaluated.
Starting with *Syntax* version *8*, *If* blocks can also include *Prepend* and *Append*
configuration blocks. These blocks are always merged to the parent tree, independent of the
condition evaluation result:
- *Prepend* block is merged before the condition result (*True* or *False* block)
- *Append* block is merged after the condition result (*True* or *False* block)
- Both *Prepend* and *Append* can be specified simultaneously
- When *Prepend* or *Append* is present, the *Condition* directive can be omitted
Example:
~~~{.html}
@ -566,6 +574,38 @@ If.uniqueid {
}
~~~
Example with Prepend and Append (*Syntax* version *8*+):
~~~{.html}
If.setup {
Prepend {
Define.before "prepended"
}
Condition {
Type AlwaysTrue
}
True {
Define.middle "conditional"
}
Append {
Define.after "appended"
}
}
~~~
Example with Prepend/Append only (no Condition, *Syntax* version *8*+):
~~~{.html}
If.common {
Prepend {
Define.x "always executed"
}
Append {
Define.y "also always executed"
}
}
~~~
#### True (Type AlwaysTrue)
Execute only *True* block. It may be used to change the evaluation order as