texlive[66601] Master: photobook (19mar23)

commits+karl at tug.org commits+karl at tug.org
Mon Mar 20 19:49:30 CET 2023


Revision: 66601
          http://tug.org/svn/texlive?view=revision&revision=66601
Author:   karl
Date:     2023-03-20 19:49:29 +0100 (Mon, 20 Mar 2023)
Log Message:
-----------
photobook (19mar23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/photobook/Makefile
    trunk/Master/texmf-dist/doc/latex/photobook/photobook.pdf
    trunk/Master/texmf-dist/doc/latex/photobook/scripts/README.md
    trunk/Master/texmf-dist/doc/latex/photobook/scripts/cls2tex.sh
    trunk/Master/texmf-dist/doc/latex/photobook/scripts/make-spreads.sh
    trunk/Master/texmf-dist/tex/latex/photobook/photobook.cls
    trunk/Master/tlpkg/tlpsrc/photobook.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/photobook/scripts/make-spreads.cfg.example

Modified: trunk/Master/texmf-dist/doc/latex/photobook/Makefile
===================================================================
--- trunk/Master/texmf-dist/doc/latex/photobook/Makefile	2023-03-20 18:41:45 UTC (rev 66600)
+++ trunk/Master/texmf-dist/doc/latex/photobook/Makefile	2023-03-20 18:49:29 UTC (rev 66601)
@@ -45,6 +45,7 @@
 
 .EXPORT_ALL_VARIABLES:
 
+
 # NOTE: this makes things run consistently on different systems including 
 # 		things like Android...
 SHELL := bash
@@ -58,8 +59,9 @@
 VERSION = $(strip $(shell \
 	cat $(MODULE).cls \
 		| grep 'VERSION{' \
-	 	| sed 's/.*{\(.*\)}.*/\1/' \
-		| sed 's/v//'))
+	 	| sed \
+			-e 's/.*{\(.*\)}.*/\1/' \
+			-e 's/v//'))
 DATE = $(strip $(shell date "+%Y%m%d%H%M"))
 COMMIT = $(strip $(shell git rev-parse HEAD))
 
@@ -123,6 +125,7 @@
 	README.md \
 	LICENSE \
 	Makefile \
+	DEPENDS.txt \
 	$(MODULE).cls \
 	$(MODULE).pdf
 DIST_FILES = \
@@ -239,7 +242,17 @@
 		> $@
 
 
+# list of dependencies...
+#
+DEPENDS.txt: $(MODULE).cls
+	cat $< \
+		| egrep -zo '\s*\\RequirePackage(\[[^]]*\])?\{[^}]*\}' \
+		| sed 's/.*{\(.*\)}/hard \1\n/' \
+		| grep -a hard \
+		> $@
 
+
+
 #----------------------------------------------------------------------
 # Info targets...
 
@@ -287,7 +300,6 @@
 	cp -f $(DIST_DIR)/$(DIST_NAME).zip $(DIST_DIR)/$(MODULE).zip
 
 
-
 .PHONY: tag
 tag:
 	@echo "Will create and publish git tag:"
@@ -294,11 +306,29 @@
 	@echo "    v$(VERSION)"
 	@echo "Last 5 tags:"
 	@git tag -l 'v[0-9]*'\
+		| sort -V \
 		| tail -n 5 \
 		| sed 's/^/    /' \
 		| tac
-	@echo "Note that this must be done after a commit."
-	@read -p "(press any key to continue or ctrl-c to cancel)"
+#	# check if we need to bug the user about committing and/or pushing stuff...
+	@\
+		UNCOMITTED=$$(git status --porcelain=v1 2> /dev/null | grep -v '??' | wc -l) ;\
+		UNPUSHED=$$(git log origin..HEAD | wc -l) ;\
+		if ! [ $$UNCOMITTED = 0 ] ; then \
+			echo ;\
+			echo "WARNING: Uncommited changes found!" ;\
+		fi ;\
+		if ! [ $$UNPUSHED = 0 ] ; then \
+			[ $$UNCOMITTED = 0 ] \
+				&& echo ;\
+			echo "WARNING: Unpushed commits found!" ;\
+		fi ;\
+		if ! [ $$UNCOMITTED = 0 ] || ! [ $$UNPUSHED = 0 ] ; then \
+			echo ;\
+			echo "Note that this must be done after a commit and a push." ;\
+			echo "(press any key to continue or ctrl-c to cancel)" ;\
+			read ;\
+		fi ;\
 	git tag "v$(VERSION)"
 	git push origin "v$(VERSION)"
 
@@ -390,7 +420,7 @@
 
 .PHONY: clean
 clean: sweep
-	rm -rf $(DIST_DIR) $(BUILD_DIR) $(MODULE).md *.pdf
+	rm -rf $(DIST_DIR) $(BUILD_DIR) $(MODULE).md DEPENDS.txt *.pdf
 
 
 

Modified: trunk/Master/texmf-dist/doc/latex/photobook/photobook.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/photobook/scripts/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/photobook/scripts/README.md	2023-03-20 18:41:45 UTC (rev 66600)
+++ trunk/Master/texmf-dist/doc/latex/photobook/scripts/README.md	2023-03-20 18:49:29 UTC (rev 66601)
@@ -4,9 +4,9 @@
 
 <!-- TOC depthfrom:2 -->
 
-- [make-spreads.sh](#make-imagessh)
-	- [The process](#the-process)
-		- [Automatic template inferenceing](#automatic-template-inferenceing)
+- [make-spreads.sh](#make-spreadssh)
+	- [Theory of operation](#theory-of-operation)
+		- [Automatic template inferencing](#automatic-template-inferencing)
 		- [Manual template selection](#manual-template-selection)
 		- [Template tweaking](#template-tweaking)
 		- [Manual spread layouts](#manual-spread-layouts)
@@ -23,8 +23,10 @@
 `make-spreads.sh`
 ----------------
 
-Generate LaTeX block of pages from a directory tree.
+<!-- XXX add a TL;DR, "quick start" or "cheat sheet" section... abstract? -->
 
+Generate LaTeX block of pages/spreads from a directory tree.
+
 This was initially intended as a means to convert the exported directory 
 tree from an image viewer where image/text sequencing was done, but it 
 can also be used standalone.
@@ -104,7 +106,7 @@
 ```
 
 
-### The process
+### Theory of operation
 
 <!-- XXX spreads vs. pages -->
 
@@ -196,9 +198,20 @@
 on the right page of the spread using the appropriate page template and
 leave the left page blank.
 
-<!-- XXX do we need a `blankpage.tex` template??? -->
+A black page uses `blankpage.tex` template if available, otherwise a
+trivial blank page is used:
+```latex
+\null
+\newpage
+```
 
+<!-- XXX
+Template search order:
+- spread directory
+- template directory
+-->
 
+
 #### Manual template selection
 
 A template can be selected manually by providing a file in the form:
@@ -250,7 +263,9 @@
 Any paths in the `layout.tex` should be relative to the location the
 built block .tex file will be located, usually to the project root.
 
+Template field substitution is done as for all other templates.
 
+
 ### Templates
 
 A template is a LaTeX file with zero or more special fields defined.
@@ -315,8 +330,7 @@
 All the configuration options can be given in a configuration file as
 well as environment variables.
 
-<!-- XXX this is not true at the moment, not sure if this is a bug or a feature...
-Environment variables take precedence over the configuration file. -->
+Environment variables take precedence over the configuration file.
 
 The default `make-images.cfg` would look something like:
 ```shell
@@ -361,7 +375,12 @@
 )
 ```
 
+An explicit configuration file can be manually specified:
+```shell
+$ make-spreads.sh -c <path> ..
+```
 
+
 ---
 
 `cls2tex.sh`
@@ -375,6 +394,7 @@
 ```
 
 The `--help` says it all:
+<!-- :r !cl2tex.sh --help -->
 ```
 Generate docs from latex package/class
 
@@ -392,8 +412,8 @@
   - read the INPUT
   - keep lines starting with \def\<module-name>@[A-Z]\+
   - keep lines starting with '%%'
-  - %%%%% Text -> \subsection(Text)
-  - %%%% Text -> \section(Text)
+  - %%%%% Text -> \subsection{Text}
+  - %%%% Text -> \section{Text}
   - %% >> code -> \begin{verbatim}code\end{verbatim}
   - write the result to OUTPUT
 

Modified: trunk/Master/texmf-dist/doc/latex/photobook/scripts/cls2tex.sh
===================================================================
--- trunk/Master/texmf-dist/doc/latex/photobook/scripts/cls2tex.sh	2023-03-20 18:41:45 UTC (rev 66600)
+++ trunk/Master/texmf-dist/doc/latex/photobook/scripts/cls2tex.sh	2023-03-20 18:49:29 UTC (rev 66601)
@@ -26,8 +26,8 @@
 	echo "  - read the INPUT"
 	echo "  - keep lines starting with \\def\\<module-name>@[A-Z]\\+"
 	echo "  - keep lines starting with '%%'"
-	echo "  - %%%%% Text -> \\subsection(Text)"
-	echo "  - %%%% Text -> \\section(Text)"
+	echo "  - %%%%% Text -> \\subsection{Text}"
+	echo "  - %%%% Text -> \\section{Text}"
 	echo "  - %% >> code -> \\begin{verbatim}code\\end{verbatim}"
 	echo "  - write the result to OUTPUT"
 	echo

Added: trunk/Master/texmf-dist/doc/latex/photobook/scripts/make-spreads.cfg.example
===================================================================
--- trunk/Master/texmf-dist/doc/latex/photobook/scripts/make-spreads.cfg.example	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/photobook/scripts/make-spreads.cfg.example	2023-03-20 18:49:29 UTC (rev 66601)
@@ -0,0 +1,39 @@
+# if non-empty make-spreads.sh will add image paths to pdf notes...
+ANOTATE_IMAGE_PATHS=
+
+# file extensions to treat as text (separated with "|")
+TEXT_FORMATS=txt
+
+# file extensions to treat as images (separated with "|")
+IMAGE_FORMATS=jpeg|jpg|png|pdf|svg|eps
+
+# default directory spread definitions are located in...
+SPREADS_DIR=spreads/
+
+# if non-empty link link images to matching ones from this directory...
+IMAGE_HIRES_DIR=
+
+# directory where external captions are stored...
+CAPTION_DIR=captions/
+
+# root template directory...
+TEMPLATE_DIR=templates/
+
+# empty page template...
+EMPTY_PAGE=emptypage
+
+# text page template...
+TEXT_PAGE=textpage
+
+# image page template...
+IMAGE_PAGE=imagepage
+
+# spread templates...
+IMAGE_SPREAD=(
+        #
+        #   +------- number of found images
+        #  /     +-- template name
+        # /     /
+        [0]=text-spread
+        [2]=image-image
+)


Property changes on: trunk/Master/texmf-dist/doc/latex/photobook/scripts/make-spreads.cfg.example
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/latex/photobook/scripts/make-spreads.sh
===================================================================
--- trunk/Master/texmf-dist/doc/latex/photobook/scripts/make-spreads.sh	2023-03-20 18:41:45 UTC (rev 66600)
+++ trunk/Master/texmf-dist/doc/latex/photobook/scripts/make-spreads.sh	2023-03-20 18:49:29 UTC (rev 66601)
@@ -2,75 +2,15 @@
 shopt -s nullglob extglob
 
 #----------------------------------------------------------------------
-# 
-# TIP: It is better to think of a visual book as a set of spreads 
-#		rather than a set of pages, hence the focus on spreads in the 
-#		code below.
-#		The main unit of a "visual" book is a spread, it's the thing 
-#		you see when you hold the book open, and the main workflow 
-#		when building a book is creating spreads and ordering them so 
-#		a single page is almost never treated as an independent unit.
-# TIP: it is not recommended to use too many templates, the layout 
-#		should be and feel structured and this structure should not be 
-#		too complex for the average reader to get comfortable in.
-# 
 #
+# For docs see README.md
+#
+#
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# 
-# Template structure:
-#	templates/
-#		spread.tex
-#		imagepage.tex
-#		textpage.tex
-#		...
-#	captions/
-#		<image>.txt
-#			image caption.
-#			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).
-#		...
-#	$SPREADS_DIR/
+#
+# XXX DOC:
 #		$spread/
-#			tweaks.tex
-#				template tweaks.
-#				loaded before the templates are handled.
-#			layout.tex
-#				manual layout of spread.
-#				if given rest of directory contents are 
-#				ignored.
-#				fields:
-#					${IMAGE0}
-#						replaced with image path
-#					${CAPTION0}
-#						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.
-#			<spread-template-name>.tpl
-#				indicates the spread template to use.
-#				if given the rest of the .tex files in 
-#				directory are ignored.
-#				resolves to:
-#					templates/<spread-template-name>.tex
-#				fields:
-#					${IMAGE0}
-#					${CAPTION0}
-#					${TEXT0}
-#					...
+#			...
 #			imagepage.tex
 #				image page template.
 #				fields:
@@ -87,73 +27,50 @@
 #			<spread-template-name>-textpage.tpl
 #				indicates the image/text page template to use.
 #				ignored if explicit templates are given.
-#				fields:
-#					${IMAGE}
-#					${CAPTION}
-#					${TEXT}
-#					...
-#			00-<image>.png
-#				image.
-#				if $IMAGE_HIRES_DIR is set then this will 
-#				resolve to:
-#					$IMAGE_HIRES_DIR/<image>
-#				supported formats:
-#					.jpeg, .png, .pdf, .svg, .eps 
-#					(see $IMAGE_FORMATS)
-#			00-<image>.txt
-#				local image caption text.
-#				NOTE: this must be named the same as the image.
-#			01-<text>.txt
-#				text.
 #			...
-#		...
 #
 #
-# Env variables:
-#	ANOTATE_IMAGE_PATHS=
-#	TEXT_FORMATS=<ext>|..
-#	IMAGE_FORMATS=<ext>|..
-#	SPREADS_DIR=<path>
-#	IMAGE_HIRES_DIR=<path>
-#		sets the path to which the hi-res images are resolved.
-#	CAPTION_DIR=<path>
-#	TEMPLATE_DIR=<path>
-#	EMPTY_PAGE=<name>
-#	TEXT_PAGE=<name>
-#	IMAGE_PAGE=<name>
-#	IMAGE_SPREAD=<array>
 #
-#
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-#
-# XXX 
-#
-#
-#
 #----------------------------------------------------------------------
+# load config...
 
-# load config...
 CONFIG=${CONFIG:=$(basename ${0%.*}).cfg}
+# prepend CFG_ to settings in config...
+# NOTE: this is done to prevent them overriding the environment...
 [ -e $CONFIG ] \
-	&& source "$CONFIG"
+	&& eval $(cat "$CONFIG" \
+		| sed -e 's/^\(\s*\)\([A-Z_]\+=\)/\1CFG_\2/')
 
 
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 # defaults...
+#
 # NOTE: all of these options can be either set in the $CONFIG file or 
 #		set in the script env.
 # NOTE: env takes priority over $CONFIG
 
 # if set add pdf annotations of paths to each image...
+ANOTATE_IMAGE_PATHS=${ANOTATE_IMAGE_PATHS:=$CFG_ANOTATE_IMAGE_PATHS}
 ANOTATE_IMAGE_PATHS=${ANOTATE_IMAGE_PATHS:=}
 
 # supported formats/extensions...
+TEXT_FORMATS=${TEXT_FORMATS:=$CFG_TEXT_FORMATS}
 TEXT_FORMATS=${TEXT_FORMATS:=txt}
+
+IMAGE_FORMATS=${IMAGE_FORMATS:=$CFG_IMAGE_FORMATS}
 IMAGE_FORMATS=${IMAGE_FORMATS:=jpeg|jpg|png|pdf|svg|eps}
 
+
+SPREADS_DIR=${SPREADS_DIR:=$CFG_SPREADS_DIR}
 SPREADS_DIR=${SPREADS_DIR:=spreads/}
+
+IMAGE_HIRES_DIR=${IMAGE_HIRES_DIR:=$CFG_IMAGE_HIRES_DIR}
 IMAGE_HIRES_DIR=${IMAGE_HIRES_DIR:=}
+
+CAPTION_DIR=${CAPTION_DIR:=$CFG_CAPTION_DIR}
 CAPTION_DIR=${CAPTION_DIR:=captions/}
+
+TEMPLATE_DIR=${TEMPLATE_DIR:=$CFG_TEMPLATE_DIR}
 TEMPLATE_DIR=${TEMPLATE_DIR:=templates/}
 
 # Default templates
@@ -161,8 +78,13 @@
 #		page components...
 
 # page templates...
+EMPTY_PAGE=${EMPTY_PAGE:=$CFG_EMPTY_PAGE}
 EMPTY_PAGE=${EMPTY_PAGE:=emptypage}
+
+TEXT_PAGE=${TEXT_PAGE:=$CFG_TEXT_PAGE}
 TEXT_PAGE=${TEXT_PAGE:=textpage}
+
+IMAGE_PAGE=${IMAGE_PAGE:=$CFG_IMAGE_PAGE}
 IMAGE_PAGE=${IMAGE_PAGE:=imagepage}
 
 # dynamic spread templates...
@@ -169,10 +91,17 @@
 # NOTE: the index here corresponds to the number of images found in a 
 #		spread directory...
 if [ ${#IMAGE_SPREAD[@]} = 0 ] ; then
-	IMAGE_SPREAD=(
-		[0]=text-spread
-		[2]=image-image
-	)
+	if [ ${#CFG_IMAGE_SPREAD[@]} != 0 ] ; then
+		IMAGE_SPREAD=()
+		for i in ${!CFG_IMAGE_SPREAD[@]} ; do
+			IMAGE_SPREAD[$i]=${CFG_IMAGE_SPREAD[$i]}
+		done
+	else
+		IMAGE_SPREAD=(
+			[0]=text-spread
+			[2]=image-image
+		)
+	fi
 fi
 
 
@@ -188,17 +117,18 @@
 	echo
 	echo "Arguments:"
 	echo "  -h --help   - print this help and exit."
+	echo "  -c PATH     - load configuration from PATH."
 	echo "  -a --annotate"
 	echo "              - add annotations with image paths to pages."
-	echo "  --templates=PATH"
+	echo "  --templates PATH"
 	echo "              - path to search for templates (default: $TEMPLATE_DIR)."
-	echo "  --single-image-tpl=NAME"
+	echo "  --single-image-tpl NAME"
 	echo "              - single image default template (default: ${IMAGE_SPREAD[1]})."
-	echo "  --double-image-tpl=NAME"
+	echo "  --double-image-tpl NAME"
 	echo "              - double image default template (default: ${IMAGE_SPREAD[2]})."
-	echo "  --text-spread-tpl=NAME"
+	echo "  --text-spread-tpl NAME"
 	echo "              - text spread default template (default: ${IMAGE_SPREAD[0]})."
-	echo "  --captions=PATH"
+	echo "  --captions PATH"
 	echo "              - path to search for captions (default: $CAPTION_DIR)."
 	echo
 	echo "Parameters:"
@@ -248,31 +178,32 @@
 			ANOTATE_IMAGE_PATHS=1
 			shift
 			;;
+		-c)
+			$CONFIG="$2"
+			[ -e "$CONFIG" ] \
+				&& source "$CONFIG"
+			shift 2
+			;;
 
 		--templates)
 			TEMPLATE_DIR=$2
-			shift
-			shift
+			shift 2
 			;;
 		--single-image-tpl)
 			IMAGE_SPREAD[1]=$2
-			shift
-			shift
+			shift 2
 			;;
 		--double-image-tpl)
 			IMAGE_SPREAD[2]=$2
-			shift
-			shift
+			shift 2
 			;;
 		--text-spread-tpl)
 			IMAGE_SPREAD[0]=$2
-			shift
-			shift
+			shift 2
 			;;
 		--captions)
 			CAPTION_DIR=$2
-			shift
-			shift
+			shift 2
 			;;
 
 		# handle unknown options...
@@ -289,7 +220,7 @@
 
 
 if [ -z $1 ] ; then
-	SPREADS_DIR=pages/
+	SPREADS_DIR=spreads/
 else
 	SPREADS_DIR=$1/
 fi
@@ -348,24 +279,44 @@
 #	getTemplate SPREAD TYPE
 #
 getTemplate(){
-	local SPREAD=$1
-	local TYPE=$2
-	local TEMPLATE=($SPREAD/*-$TYPE.tex)
-	if [ -z $TEMPLATE ] ; then
-		TEMPLATE=($SPREAD/*-$TYPE.tpl)
-		if ! [ -z $TEMPLATE ] ; then
-			TEMPLATE=${TEMPLATE/$SPREAD\//}
-			TEMPLATE=${TEMPLATE/[0-9]-/}
-			TEMPLATE="$TEMPLATE_DIR/${TEMPLATE[0]%-${TYPE}.*}.tex"
+	local spread=$1
+	local name=$2
+	local template
+
+	if [[ $name =~ .*\.tex ]] ; then 
+		# already an existing template...
+		if [ -e "$name" ] ; then
+			echo $name
+			return
 		fi
+		# normalize...
+		name=${name%.tex}
+	# normalize template name...
+	elif [[ $name =~ .*\.tpl ]] ; then
+		name=$( echo $name \
+			| sed \
+				-e 's/.tpl$//' \
+				-e "s%$spread/%%" \
+				-e 's/^[0-9]\+-//' )
 	fi
-	if [ -z $TEMPLATE ] ; then
-		 TEMPLATE="$TEMPLATE_DIR/${TYPE}.tex"
+
+	# local template...
+	template=($spread/*-$name.tex)
+	if [ ${#template[@]} != 0 ] ; then
+		template=${template[0]}
+	else
+		template=($spread/$name.tex)
 	fi
-	if ! [ -e $TEMPLATE ] ; then
-		return
+	# global template...
+	if [ -z $template ] \
+			|| ! [ -e "$template" ] ; then
+		 template="$TEMPLATE_DIR/${name}.tex"
 	fi
-	echo $TEMPLATE
+	# check if the thing exists...
+	if ! [ -e $template ] ; then
+		return 1
+	fi
+	echo $template
 }
 
 
@@ -429,7 +380,7 @@
 	local i=0
 	for var in ${slots[@]} ; do
 		name=${var//[0-9]/}
-		if ! [ ${name} = "IMAGE" ] ; then
+		if [ ${name} != "IMAGE" ] ; then
 			continue
 		fi
 
@@ -449,7 +400,7 @@
 		i=$(( i + 1 ))
 
 		val=${val//\//\\/}
-		text=$(echo -e "${text}" | \
+		text=$(echo "${text}" | \
 			sed "s/\${${var}}/${val%.*}/g")
 	done
 
@@ -456,7 +407,7 @@
 	# pass 2: captions...
 	for var in ${slots[@]} ; do
 		name=${var//[0-9]/}
-		if ! [ ${name} = "CAPTION" ] ; then
+		if [ ${name} != "CAPTION" ] ; then
 			continue
 		fi
 
@@ -472,7 +423,7 @@
 			val=$(readCaption "${val}")
 		fi
 
-		text=$(echo -e "${text}" | \
+		text=$(echo "${text}" | \
 			sed "s/\${${var}}/${val}/g")
 	done
 
@@ -493,14 +444,14 @@
 		done
 
 		val=${val//\//\\/}
-		text=$(echo -e "${text}" | \
+		text=$(echo "${text}" | \
 			sed "s/\${${var}}/${val}/g")
 	done
 
 	# print out the filled template...
 	echo % template: $tpl
-	echo -e "${text}"
-	return 0
+	echo "${text}"
+	return
 }
 
 
@@ -641,27 +592,29 @@
 					# ignore the rest of the items when we are done 
 					# creating two pages...
 					[ $C == 2 ] \
-						&& return 0
+						&& return
 				done
 			fi
 		fi
 		# formatting done...
 		[ -z $template ] \
-			&& return 0
+			&& return
 
-		# format template path...
-		template=${template/$spread\//}
-		template=${template/[0-9]-/}
-		# get...
-		template="${template[0]%.*}.tex"
-		if ! [ -e "$template" ] ; then
-			template="$TEMPLATE_DIR/${template[0]%.*}.tex"
+		# resolve the template path...
+		local p=$template
+		template=$(getTemplate "$spread" "$template")
+
+		# not found...
+		if [ -z $template ] ; then
+			echo "%"
+			echo "% ERROR: could not resolve template: $p" | tee >(cat >&2)
+			echo "%"
 		fi
 	fi
 
 	populateTemplate "$spread" "$template" "${img[@]}" "${txt[@]}"
 
-	return 0
+	return $?
 }
 
 

Modified: trunk/Master/texmf-dist/tex/latex/photobook/photobook.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/photobook/photobook.cls	2023-03-20 18:41:45 UTC (rev 66600)
+++ trunk/Master/texmf-dist/tex/latex/photobook/photobook.cls	2023-03-20 18:49:29 UTC (rev 66601)
@@ -76,8 +76,8 @@
 
 %%% NOTE: \def\<module-name>@[A-Z]+ macros will be visible to both the 
 %%%		code and the generated docs...
-\edef\photobook at FILEVERSION{v0.1.10}
-\edef\photobook at FILEDATE{2023-03-11}
+\edef\photobook at FILEVERSION{v0.1.15}
+\edef\photobook at FILEDATE{2023-03-18}
 
 
 %% \documentclass{ltxdoc}
@@ -1156,6 +1156,19 @@
 	\InitPages%
 	\ResetFoldMarks}
 
+%% \DescribeMacro{\ChangeLayout}
+%
+%% Change document layout.
+%
+%%	>> \ChangeLayout{<layoutmode>}
+%
+%% This is a shorthand for |\def\layoutmode{<layoutmode>}| and then 
+%% |\ReInitPages|, and as this is changing any other parameters that may 
+%% affect the layout, this should be done last.
+%%
+\newcommand\ChangeLayout[1]{%
+	\def\layoutmode{#1}%
+	\ReInitPages}
 
 
 %----------------------------------------------------------------------

Modified: trunk/Master/tlpkg/tlpsrc/photobook.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/photobook.tlpsrc	2023-03-20 18:41:45 UTC (rev 66600)
+++ trunk/Master/tlpkg/tlpsrc/photobook.tlpsrc	2023-03-20 18:49:29 UTC (rev 66601)
@@ -0,0 +1,36 @@
+hard kvoptions
+#hard calc (in tools)
+hard xargs
+#hard ifthen (in base)
+hard iftex
+hard pgf
+#hard pgffor
+hard xint
+#hard xinttools (in xint)
+hard listofitems
+hard xkeyval
+hard etoolbox
+hard atbegshi
+#hard afterpage (in tools)
+hard changepage
+hard hyperref
+hard pdfcomment
+hard eso-pic
+hard environ
+hard numprint
+#hard trimclip (in adjustbox)
+hard xcolor
+hard pagecolor
+hard colorspace
+hard graphics
+#hard graphicx
+hard adjustbox
+hard textpos
+hard fancyvrb
+#hard tikz (in pgf)
+hard mdframed
+hard flowfram
+#hard rotating (in graphics)
+hard fancyhdr
+hard pdfpages
+hard geometry



More information about the tex-live-commits mailing list.