From 7ae71693eccf9505b156d2b96c6d57a01317e391 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 4 Mar 2023 22:50:08 +0300 Subject: [PATCH] experimenting with dynamic fields in templates... Signed-off-by: Alex A. Naanou --- scripts/make-images.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/make-images.sh b/scripts/make-images.sh index bfec27d..f7d8a0f 100644 --- a/scripts/make-images.sh +++ b/scripts/make-images.sh @@ -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