From 99f3b45d8b1413f530efbfc27d28f0cb8e8ea5db Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 8 Mar 2023 02:49:40 +0300 Subject: [PATCH] added "natural" sort order for files. + docs.. Signed-off-by: Alex A. Naanou --- scripts/make-images.sh | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/scripts/make-images.sh b/scripts/make-images.sh index 8d40ece..4038a16 100644 --- a/scripts/make-images.sh +++ b/scripts/make-images.sh @@ -14,6 +14,7 @@ shopt -s nullglob extglob # # Template structure: # templates/ +# spread.tex # imagepage.tex # textpage.tex # ... @@ -23,6 +24,7 @@ shopt -s nullglob extglob # this is separated to decouple caption writing from the # changes to the layout/sequencing and this drastically # simplify the work with writers. +# For this reason this takes priority over local captions (XXX revise). # ... # $IMAGE_DIR/ # $spread/ @@ -35,11 +37,24 @@ shopt -s nullglob extglob # ignored. # fields: # ${IMAGE0} +# replaced with image path # ${CAPTION0} -# ${IMAGE1} -# ${CAPTION1} +# replaced with content of caption file if found +# and empty otherwise. +# ${TEXT0} +# replaced with the content of a text file if +# found and empty otherwise. +# ... # NOTE: if images are included, hi-res source # substitution is not done here. +# NOTE: fields are ordered and matched according to their +# position and not their number, e.g. in the following +# sequence: +# IMAGE, IMAGE10, IMAGE20, .., +# CAPTION2, CAPTION7, CAPTION12, .. +# IMAGE10 will be filled with the second found image +# and CAPTION7 will be filled with the second found +# caption. # .tpl # indicates the spread template to use. # if given the rest of the .tex files in @@ -49,34 +64,40 @@ shopt -s nullglob extglob # fields: # ${IMAGE0} # ${CAPTION0} -# ${IMAGE1} -# ${CAPTION1} +# ${TEXT0} +# ... # imagepage.tex # image page template. # fields: # ${IMAGE} # ${CAPTION} +# ${TEXT0} +# ... # textpage.tex # text page template. # fields: # ${TEXT} +# ... # -imagepage.tpl # -textpage.tpl # indicates the image/text page template to use. # ignored if explicit templates are given. -# image fields: +# fields: # ${IMAGE} # ${CAPTION} -# text fields: # ${TEXT} +# ... # 00-.png # image. # if $IMAGE_HIRES_DIR is set then this will # resolve to: # $IMAGE_HIRES_DIR/ -# XXX hi-res substitution currently disabled. +# supported formats: +# .jpeg, .png, .pdf, .svg, .eps +# (see $IMAGE_FORMATS) # 00-.txt # local image caption text. +# NOTE: this must be named the same as the image. # 01-.txt # text. # ... @@ -278,7 +299,7 @@ templateSlots(){ TEMPLATE_INDEX[$1]=$(cat "$1" \ | grep -o '\${[A-Z0-9_]\+}' \ | sed 's/\${\(.*\)}/\1/g' \ - | sort) + | sort -V) fi echo ${TEMPLATE_INDEX[$1]} }