experimenting with dynamic fields in templates...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-03-04 22:50:08 +03:00
parent 3eac98bb5d
commit 7ae71693ec

View File

@ -223,6 +223,23 @@ getCaption(){
echo ${C[*]}
}
# XXX EXPERIMENTAL...
# index ${VAR} variables in templates...
declare -A TEMPLATE_INDEX
indexTemplates(){
#echo indexing templates...
local lst
local tpl
for tpl in "${TEMPLATE_PATH}"/* ; do
#echo ${tpl}...
lst=( $(cat "${tpl}" \
| grep -o '\${[A-Z0-9]\+}' \
| sed 's/\${\(.*\)}/\1/g' \
| sort) )
TEMPLATE_INDEX[$(basename "${tpl}")]=${lst[@]}
done
}
getTemplate(){
local SPREAD=$1
local TYPE=$2