added "natural" sort order for files. + docs..

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-03-08 02:49:40 +03:00
parent 010b3ad4e9
commit 99f3b45d8b

View File

@ -14,6 +14,7 @@ shopt -s nullglob extglob
# #
# Template structure: # Template structure:
# templates/ # templates/
# spread.tex
# imagepage.tex # imagepage.tex
# textpage.tex # textpage.tex
# ... # ...
@ -23,6 +24,7 @@ shopt -s nullglob extglob
# this is separated to decouple caption writing from the # this is separated to decouple caption writing from the
# changes to the layout/sequencing and this drastically # changes to the layout/sequencing and this drastically
# simplify the work with writers. # simplify the work with writers.
# For this reason this takes priority over local captions (XXX revise).
# ... # ...
# $IMAGE_DIR/ # $IMAGE_DIR/
# $spread/ # $spread/
@ -35,11 +37,24 @@ shopt -s nullglob extglob
# ignored. # ignored.
# fields: # fields:
# ${IMAGE0} # ${IMAGE0}
# replaced with image path
# ${CAPTION0} # ${CAPTION0}
# ${IMAGE1} # replaced with content of caption file if found
# ${CAPTION1} # 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 # NOTE: if images are included, hi-res source
# substitution is not done here. # 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.
# <spread-template-name>.tpl # <spread-template-name>.tpl
# indicates the spread template to use. # indicates the spread template to use.
# if given the rest of the .tex files in # if given the rest of the .tex files in
@ -49,34 +64,40 @@ shopt -s nullglob extglob
# fields: # fields:
# ${IMAGE0} # ${IMAGE0}
# ${CAPTION0} # ${CAPTION0}
# ${IMAGE1} # ${TEXT0}
# ${CAPTION1} # ...
# imagepage.tex # imagepage.tex
# image page template. # image page template.
# fields: # fields:
# ${IMAGE} # ${IMAGE}
# ${CAPTION} # ${CAPTION}
# ${TEXT0}
# ...
# textpage.tex # textpage.tex
# text page template. # text page template.
# fields: # fields:
# ${TEXT} # ${TEXT}
# ...
# <spread-template-name>-imagepage.tpl # <spread-template-name>-imagepage.tpl
# <spread-template-name>-textpage.tpl # <spread-template-name>-textpage.tpl
# indicates the image/text page template to use. # indicates the image/text page template to use.
# ignored if explicit templates are given. # ignored if explicit templates are given.
# image fields: # fields:
# ${IMAGE} # ${IMAGE}
# ${CAPTION} # ${CAPTION}
# text fields:
# ${TEXT} # ${TEXT}
# ...
# 00-<image>.png # 00-<image>.png
# image. # image.
# if $IMAGE_HIRES_DIR is set then this will # if $IMAGE_HIRES_DIR is set then this will
# resolve to: # resolve to:
# $IMAGE_HIRES_DIR/<image> # $IMAGE_HIRES_DIR/<image>
# XXX hi-res substitution currently disabled. # supported formats:
# .jpeg, .png, .pdf, .svg, .eps
# (see $IMAGE_FORMATS)
# 00-<image>.txt # 00-<image>.txt
# local image caption text. # local image caption text.
# NOTE: this must be named the same as the image.
# 01-<text>.txt # 01-<text>.txt
# text. # text.
# ... # ...
@ -278,7 +299,7 @@ templateSlots(){
TEMPLATE_INDEX[$1]=$(cat "$1" \ TEMPLATE_INDEX[$1]=$(cat "$1" \
| grep -o '\${[A-Z0-9_]\+}' \ | grep -o '\${[A-Z0-9_]\+}' \
| sed 's/\${\(.*\)}/\1/g' \ | sed 's/\${\(.*\)}/\1/g' \
| sort) | sort -V)
fi fi
echo ${TEMPLATE_INDEX[$1]} echo ${TEMPLATE_INDEX[$1]}
} }