add pre_deploy.sh script for dotter
This commit is contained in:
parent
808cdb3201
commit
d93bf44ae0
7 changed files with 192 additions and 16 deletions
30
.dotter/handlebars_helpers/flatten_table.rhai
Normal file
30
.dotter/handlebars_helpers/flatten_table.rhai
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Flatten a table into a list of values.
|
||||
* The table has to be in the form of
|
||||
* ```toml
|
||||
* [table.subtable]
|
||||
* variable1 = ["value1", "value2"]
|
||||
*
|
||||
* [table.subtable]
|
||||
* variable2 = ["value3", "value4"]
|
||||
*
|
||||
* then we use it in handlerbars like this:
|
||||
*
|
||||
* {{ flatten_table table.subtable }}
|
||||
*
|
||||
* and it will return an array with all the arrays of subtable
|
||||
*/
|
||||
|
||||
if type_of(params[0]) != "map" {
|
||||
return;
|
||||
}
|
||||
|
||||
let table = params[0];
|
||||
|
||||
let result = [];
|
||||
|
||||
for value in table.values() {
|
||||
result.append(value);
|
||||
}
|
||||
|
||||
result
|
||||
Loading…
Add table
Add a link
Reference in a new issue