mirror of
https://github.com/flynx/photobook.git
synced 2025-11-01 20:00:13 +00:00
cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
e4ded36d47
commit
4834ccbf03
@ -111,18 +111,6 @@ shopt -s nullglob extglob
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
|
||||||
# XXX TODO:
|
|
||||||
# - revise printed comments...
|
|
||||||
# - add real arg handling...
|
|
||||||
# - add abbility to apply template to a specific page in spread...
|
|
||||||
# ...something like:
|
|
||||||
# <template-name>-left.tpl
|
|
||||||
# <template-name>-right.tpl
|
|
||||||
# - add multiple images/captions...
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
# defaults...
|
# defaults...
|
||||||
@ -276,9 +264,9 @@ STOP=$(( FROM + COUNT ))
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Get image caption...
|
||||||
# usage:
|
# usage:
|
||||||
# getCaption SPREAD IMAGE
|
# getCaption SPREAD IMAGE
|
||||||
# XXX should we report images w/o captions???
|
|
||||||
getCaption(){
|
getCaption(){
|
||||||
local spread=$1
|
local spread=$1
|
||||||
local name=`basename "${2%.*}"`
|
local name=`basename "${2%.*}"`
|
||||||
@ -297,6 +285,8 @@ getCaption(){
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Read/print caption text...
|
||||||
# usage:
|
# usage:
|
||||||
# readCaption PATH
|
# readCaption PATH
|
||||||
readCaption(){
|
readCaption(){
|
||||||
@ -306,7 +296,34 @@ readCaption(){
|
|||||||
| sed -e 's/\\/\\\\\\/g'
|
| sed -e 's/\\/\\\\\\/g'
|
||||||
}
|
}
|
||||||
|
|
||||||
# get template slots (cached)...
|
|
||||||
|
# Get template...
|
||||||
|
# usage:
|
||||||
|
# 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"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -z $TEMPLATE ] ; then
|
||||||
|
TEMPLATE="$TEMPLATE_DIR/${TYPE}.tex"
|
||||||
|
fi
|
||||||
|
if ! [ -e $TEMPLATE ] ; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo $TEMPLATE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Get template slots (cached)...
|
||||||
# usage:
|
# usage:
|
||||||
# templateSlots TEMPLATE
|
# templateSlots TEMPLATE
|
||||||
declare -A TEMPLATE_INDEX
|
declare -A TEMPLATE_INDEX
|
||||||
@ -322,6 +339,7 @@ templateSlots(){
|
|||||||
echo ${TEMPLATE_INDEX[$1]}
|
echo ${TEMPLATE_INDEX[$1]}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Populate template image/text slots
|
# Populate template image/text slots
|
||||||
# usage:
|
# usage:
|
||||||
# populateTemplate SPREAD TEMPLATE ITEMS...
|
# populateTemplate SPREAD TEMPLATE ITEMS...
|
||||||
@ -439,7 +457,8 @@ populateTemplate(){
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
|
# Handle/print spread...
|
||||||
# usage:
|
# usage:
|
||||||
# handleSpread SPREAD
|
# handleSpread SPREAD
|
||||||
#
|
#
|
||||||
@ -584,30 +603,6 @@ handleSpread(){
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# usage:
|
|
||||||
# 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"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ -z $TEMPLATE ] ; then
|
|
||||||
TEMPLATE="$TEMPLATE_DIR/${TYPE}.tex"
|
|
||||||
fi
|
|
||||||
if ! [ -e $TEMPLATE ] ; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
echo $TEMPLATE
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add pdf notes with image path used in template
|
# Add pdf notes with image path used in template
|
||||||
# usage:
|
# usage:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user