texlive[68182] Master/texmf-dist: photobook (5sep23)

commits+karl at tug.org commits+karl at tug.org
Tue Sep 5 22:05:54 CEST 2023


Revision: 68182
          http://tug.org/svn/texlive?view=revision&revision=68182
Author:   karl
Date:     2023-09-05 22:05:54 +0200 (Tue, 05 Sep 2023)
Log Message:
-----------
photobook (5sep23)

Modified Paths:
--------------
    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/make-spreads.sh
    trunk/Master/texmf-dist/tex/latex/photobook/photobook.cls

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-09-05 20:05:25 UTC (rev 68181)
+++ trunk/Master/texmf-dist/doc/latex/photobook/scripts/README.md	2023-09-05 20:05:54 UTC (rev 68182)
@@ -137,7 +137,7 @@
 the flow of the work and not about the actual design. How many typical 
 spreads (i.e. spread templates) should it have? A good number should be 
 small-ish, for example 3-4 spread templates is a good number, if you 
-count 10+ then you might be overcomplicating tings, but note, there are 
+count 10+ then you might be overcomplicating things, but note, there are 
 no rules, a book where each spread is individually and manually layed out 
 may work as well as a book with just a single template spread, but in 
 general for a photo book the focus is on the project and the layout 
@@ -344,6 +344,8 @@
 SPREADS_DIR=spreads/
 
 # if non-empty link link images to matching ones from this directory...
+# NOTE: this is ignored if --graphicx-path is passed or GRAPHICX_PATH 
+#		is set.
 IMAGE_HIRES_DIR=
 
 # directory where external captions are stored...
@@ -370,6 +372,10 @@
         [0]=text-spread
         [2]=image-image
 )
+
+# if set (or --graphicx-path is passed) the images are identified by their
+# basename so as to let graphicx package resolve the paths internally.
+GRAPHICX_PATH=1
 ```
 
 An explicit configuration file can be manually specified:

Modified: trunk/Master/texmf-dist/doc/latex/photobook/scripts/make-spreads.sh
===================================================================
--- trunk/Master/texmf-dist/doc/latex/photobook/scripts/make-spreads.sh	2023-09-05 20:05:25 UTC (rev 68181)
+++ trunk/Master/texmf-dist/doc/latex/photobook/scripts/make-spreads.sh	2023-09-05 20:05:54 UTC (rev 68182)
@@ -132,6 +132,9 @@
 	echo "              - text spread default template (default: ${IMAGE_SPREAD[0]})."
 	echo "  --captions PATH"
 	echo "              - path to search for captions (default: $CAPTION_DIR)."
+	echo "  --graphicx-path"
+	echo "              - reference images by their basenames and let graphicx manage"
+	echo "                searching."
 	echo
 	echo "Parameters:"
 	echo "  PATH        - path to root pages directory (default: $SPREADS_DIR)"
@@ -214,6 +217,11 @@
 			shift 2
 			continue
 			;;
+		--graphicx-path)
+			GRAPHICX_PATH=1
+			shift
+			continue
+			;;
 
 		# handle unknown options...
 		-*|--*)
@@ -350,6 +358,12 @@
 # usage:
 #	populateTemplate SPREAD TEMPLATE ITEMS...
 #
+# closure: $populateTemplate_img, $populateTemplate_txt
+#
+# NOTE: this is the least hacky/ugly but could not figure out a better 
+#		way to update a list from within a function...
+populateTemplate_img=
+populateTemplate_txt=
 populateTemplate(){
 	local spread="$1"
 	local tpl="$2"
@@ -374,6 +388,16 @@
 			txt+=("$elem")
 		fi
 	done
+	local global_img=
+	if ! [ -z $populateTemplate_img ] ; then 
+		global_img=1
+		img=(${populateTemplate_img[@]})
+	fi
+	local global_txt=
+	if ! [ -z $populateTemplate_txt ] ; then
+		global_txt=1
+		txt=(${populateTemplate_txt[@]})
+	fi
 
 	local var
 	local val
@@ -412,6 +436,9 @@
 		text=$(echo "${text}" | \
 			sed "s/\${${var}}/${val%.*}/g")
 	done
+	if ! [ -z $global_img ] ; then
+		populateTemplate_img=("${populateTemplate_img[@]:$i}")
+	fi
 
 	# pass 2: captions...
 	for var in ${slots[@]} ; do
@@ -456,6 +483,9 @@
 		text=$(echo "${text}" | \
 			sed "s/\${${var}}/${val}/g")
 	done
+	if ! [ -z $global_txt ] ; then
+		populateTemplate_txt=("${txt[@]}")
+	fi
 
 	# print out the filled template...
 	echo % template: $tpl
@@ -468,7 +498,7 @@
 # usage:
 #	handleSpread SPREAD
 #
-# closure: $IMAGE_HIRES_DIR, $IMAGE_SPREAD
+# closure: $GRAPHICX_PATH, $IMAGE_HIRES_DIR, $IMAGE_SPREAD
 handleSpread(){
 	local spread="$1"
 	# skip non-spreads...
@@ -502,21 +532,32 @@
 		fi
 	done
 
+	# graphicx paths...
+	if ! [ -z $GRAPHICX_PATH ] ; then
+		local C=0
+		for image in "${img[@]}" ; do
+			local new=`basename ${image}`
+			new="${new#+([0-9])-}"
+			img[$C]=$new
+			C=$(( C + 1 ))
+		done
 	# get hi-res image paths...
-	if ! [ -z $IMAGE_HIRES_DIR ] ; then
+	elif ! [ -z $IMAGE_HIRES_DIR ] ; then
 		local C=0
 		for image in "${img[@]}" ; do
 			# skip non-images...
-			local new="$IMAGE_HIRES_DIR/`basename ${image/[0-9]-/}`"
+			local new=`basename ${image}`
+			new="$IMAGE_HIRES_DIR/${new#+([0-9])-}"
 			# ignore file ext for availability test...
 			# NOTE: the first match may be an unsupported format...
 			new="${new%.*}"
+			local target=$new
 			new=($new.*)
 			if [ -e "${new[0]}" ] ; then
 				img[$C]=${new[0]}
 			else
 				echo %
-				echo "% WARNING: hi-res image not found for: \"${image}\" -> \"${new}\"" \
+				echo "% WARNING: hi-res image not found for: \"${image}\" -> \"${target}\"" \
 					| tee >(cat >&2)
 				echo %
 			fi
@@ -565,6 +606,9 @@
 						cat "${template}"
 					fi
 				fi
+				populateTemplate_img=("${img[@]}")
+				populateTemplate_txt=("${txt[@]}")
+
 				for elem in "${items[@]}" ; do
 					C=$(( C + 1 ))
 					P=$([ $C == 1 ] \
@@ -571,37 +615,28 @@
 						&& echo "left" \
 						|| echo "right")
 
-					# XXX need to use populateTemplate here...
-					#		...to do this need to somehow remove the used
-					#		slots/files from list...
-
 					# image...
 					if [[ "${elem,,}" =~ $IMAGE_FORMATS ]] ; then
 						echo %
 						echo "% $P page (image)..."
 						template=`getTemplate "$spread" "$IMAGE_PAGE"`
-						echo % template: $template
-						anotatePath "${elem}"
-						local caption=$(getCaption "$spread" "${elem}")
-						caption=$(readCaption "$caption")
-						cat "${template}" \
-							| sed -e "s%\${IMAGE0\?}%${elem%.*}%" \
-								-e "s%\${CAPTION0\?}%${caption}%"
+						populateTemplate "$spread" "$template" 
 					# text...
 					else
 						echo %
 						echo "% $P page (text)..."
 						template=$(getTemplate "$spread" "$TEXT_PAGE")
-						echo % template: $template
-						cat "${template}" \
-							| sed "s%\${TEXT}%${elem}%"
+						populateTemplate "$spread" "$template" 
 					fi
 					# reset for next page...
 					template=
 					# ignore the rest of the items when we are done 
 					# creating two pages...
-					[ $C == 2 ] \
-						&& return
+					if [ $C == 2 ] ; then
+						populateTemplate_img=
+						populateTemplate_txt=
+						return
+					fi
 				done
 			fi
 		fi
@@ -621,6 +656,8 @@
 		fi
 	fi
 
+	populateTemplate_img=
+	populateTemplate_txt=
 	populateTemplate "$spread" "$template" "${img[@]}" "${txt[@]}"
 
 	return $?

Modified: trunk/Master/texmf-dist/tex/latex/photobook/photobook.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/photobook/photobook.cls	2023-09-05 20:05:25 UTC (rev 68181)
+++ trunk/Master/texmf-dist/tex/latex/photobook/photobook.cls	2023-09-05 20:05:54 UTC (rev 68182)
@@ -93,7 +93,7 @@
 
 %%% NOTE: \def\<module-name>@[A-Z]+ macros will be visible to both the 
 %%%		code and the generated docs...
-\edef\photobook at FILEVERSION{v0.1.25}
+\edef\photobook at FILEVERSION{v0.1.26}
 \edef\photobook at FILEDATE{2023-08-24}
 
 
@@ -2046,7 +2046,7 @@
 \setlength\photobook at cliptocell@right{0mm}%
 \newlength\photobook at cliptocell@bottom
 \setlength\photobook at cliptocell@bottom{0mm}%
-\def\cliptocellclearances{0mm 0mm 0mm 0mm}%
+\def\cliptocellclearances{{0mm} {0mm} {0mm} {0mm}}%
 
 %% Set the default bleeds for |cliptocell| environments
 %%
@@ -2061,9 +2061,8 @@
 %%%
 %%% Set by |\cliptocellbleeds{..}| and contains clearances (negative 
 %%% clipping bleeds) usable by imagecell.
-%
-% XXX BUG: bleeds is set correctly for one value but 2 and 4 seem to be 
-%		misbehaving (see: ./examples/endpaper.tex)
+%%%
+%%% XXX still testing....
 \newcommand\cliptocellbleeds[1]{
 	\setsepchar{ }%
 	\readlist*\photobook at cliptocell@bleeds{#1}%
@@ -2099,12 +2098,15 @@
 		\setlength\photobook at cliptocell@top{%
 			\photobook at cliptocell@bleeds[4]}\fi%
 	% NOTE: trailing spaces here are significant...
+	% XXX should we use \the here?
+	%		...it makes things printable...
 	\def\cliptocellclearances{%
-		{-\photobook at cliptocell@left} %
-		{-\photobook at cliptocell@bottom} %
-		{-\photobook at cliptocell@right} %
-		{-\photobook at cliptocell@top}}}
+		{-\the\photobook at cliptocell@left} %
+		{-\the\photobook at cliptocell@bottom} %
+		{-\the\photobook at cliptocell@right} %
+		{-\the\photobook at cliptocell@top}}}
 
+% XXX use \cliptocellclearances as default...
 \newenvironment{cliptocell}[1][0mm]{%
 	\begingroup%
 		\cliptocellbleeds{#1}
@@ -4270,10 +4272,16 @@
 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 %%%%% Basic book information
 
+% XXX Document metadata -- move to globals...
+% XXX Use LaTeX generic metadata...
 %% \DescribeMacro{BookType=<text>}
+%
+%% Used in page macro text to indicate the type of document built, by default
+%% this is set to |book| for the most common case but can be set to anything
+%% (e.g. |brochure|, |magazine|, |presentation|, ...etc.)
+%%
 \def\BookType{book}
-% XXX Document metadata -- move to globals...
-% XXX Use LaTeX generic metadata...
+
 %% \DescribeMacro{BookTitle=<text>}
 \def\BookTitle{}
 %% \DescribeMacro{BookVersion=<text>}



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