# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-set -e
set -f
-VERSION="1.1+arch"
+VERSION="1.1.1+arch"
function bpgallery_default_head() {
cat <<END
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>${TITLE}</title>
- <link rel="stylesheet" href="style.css" type="text/css" />
+ <link rel="stylesheet" href="${BASEURL}style.css" type="text/css" />
</head>
<body>
END
<h1>${caption}</h1>
<div class="navigation">
<ul>
- <li><a href='${INDEXDOCUMENT}'>Thumbnails</a></li>
+ <li><a href='${BASEURL}${INDEXDOCUMENT}'>Thumbnails</a></li>
END
if [[ ! -z $previouspage ]]; then
$ECHOCOMMAND "<li><a href='${previouspage}'>Previous</a></li>"
GENERATEPAGESFORMEDIUMSIZE=1
fi
+if [[ -z $PAGESDIRECTORY ]]; then
+ PAGESDIRECTORY=""
+else
+ temp=${PAGESDIRECTORY:${#PAGESDIRECTORY}-1:1}
+ if [[ "x$temp" != "x/" ]] && [[ "x$temp" != "x\\" ]]; then
+ PAGESDIRECTORY=${PAGESDIRECTORY}/
+ fi
+fi
+
if [[ -z $MEDIUMWIDTH ]]; then
MEDIUMWIDTH=400
fi
INDEXDOCUMENT=index.html
fi
-if [[ $GENERATEPAGESFORFULLSIZE != 0 ]]; then
- if declare -F "bpgallery_${BPGALLERY_THEME}_page" > /dev/null ; then
- BPGALLERY_PAGE_FUNCTION="bpgallery_${BPGALLERY_THEME}_page"
- else
- BPGALLERY_PAGE_FUNCTION="bpgallery_default_page"
- fi
+if declare -F "bpgallery_${BPGALLERY_THEME}_page" > /dev/null ; then
+ BPGALLERY_PAGE_FUNCTION="bpgallery_${BPGALLERY_THEME}_page"
+else
+ BPGALLERY_PAGE_FUNCTION="bpgallery_default_page"
fi
if declare -F "bpgallery_${BPGALLERY_THEME}_head" > /dev/null ; then
addlink=""
if [[ $GENERATEPAGESFORFULLSIZE != 0 ]]; then
- addlink=${currentimage}${extra}.html
+ if [[ $addlinks == 1 ]]; then
+ addlink=${currentimage}.html
+ else
+ addlink=${currentimage}${extra}.html
+ fi
else
addlink=${currentimage}
fi
- if [[ $addlinks == 1 ]]; then
- addlink=${currentimage}.html
- else
- addlink=${currentimage}${extra}.html
- fi
-
previouspage=$currentpage
currentpage=$nextpage
if [[ $addlinks == 1 ]]; then
else
nextpage=${nextimage}.html
fi
- filename=${extradir}${currentimage}
- generate_general_page "$previouspage" "$currentpage" "$nextpage" $addlink
+
+ if [[ "x$PAGESDIRECTORY" != "x" ]]; then
+ filename=../${extradir}${currentimage}
+ else
+ filename=${extradir}${currentimage}
+ fi
+ if [ "x$currentpage" != "x" ]; then
+ generate_general_page "$previouspage" "$currentpage" "$nextpage" $addlink
+ fi
$ECHOCOMMAND $nextimage
done | tail -n 2 | (
read previouspage
addlink=""
if [[ $GENERATEPAGESFORFULLSIZE != 0 ]]; then
- addlink=${currentpage}.html
+ if [[ $addlinks == 1 ]]; then
+ addlink=${currentpage}.html
+ else
+ addlink=${currentpage}${extra}.html
+ fi
else
addlink=${currentpage}
fi
-
- if [[ $addlinks == 1 ]]; then
- addlink=${currentpage}.html
+
+ if [[ "x$PAGESDIRECTORY" != "x" ]]; then
+ filename=../${extradir}${currentpage}
else
- addlink=${currentpage}${extra}.html
+ filename=${extradir}${currentpage}
fi
-
- filename=${extradir}${currentpage}
if [[ $addlinks == 1 ]]; then
currentpage=${currentpage}${extra}.html
previouspage=${previouspage}${extra}.html
fi
if [ -r captions.txt ]; then
- caption=$($GREPCOMMAND -E "^${filename} " captions.txt); caption=${caption#* }
+ imagefilename=${filename##*/}
+ caption=$($GREPCOMMAND -E "^${imagefilename} " captions.txt); caption=${caption#* }
else
caption=""
fi
- $BPGALLERY_PAGE_FUNCTION > "$currentpage"
+ $BPGALLERY_PAGE_FUNCTION > "${PAGESDIRECTORY}$currentpage"
}
if [[ $OUTPUTHTML != 0 ]]; then
generate_thumbs
+if [[ "x$PAGESDIRECTORY" != "x" ]]; then
+ if [ ! -d $PAGESDIRECTORY ]; then
+ mkdir -p $PAGESDIRECTORY
+ fi
+
+ if [ ! -w $PAGESDIRECTORY ]; then
+ $ECHOCOMMAND "Can't write to $PAGESDIRECTORY directory, exiting"
+ exit 16
+ fi
+
+ BASEURL="../"
+fi
+
if [ $GENERATEPAGESFORMEDIUMSIZE != 0 ]; then
generate_medium
generate_medium_pages
DESCRIPTION=""
fi
+BASEURL=""
$ECHOCOMMAND "Starting to generate page"
extra=__medium
fi
-$FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 -I {} $ECHOCOMMAND {} | $SORTCOMMAND -g | while read filename; do filename=${filename#./}; if [ -r captions.txt ]; then caption=$($GREPCOMMAND -E "^$filename " captions.txt); caption=${caption#* }; else caption=""; fi; if [ $GENERATEPAGESFORMEDIUMSIZE != 0 ]; then link=$(bpgallery_escape_url "${filename}${extra}.html"); elif [ $GENERATEPAGESFORFULLSIZE != 0 ]; then link=$(bpgallery_escape_url "${filename}.html"); else link=$(bpgallery_escape_url "$filename"); fi; filename=$(bpgallery_escape_url "$filename"); $BPGALLERY_THUMBSLINE_FUNCTION; done >> ${INDEXDOCUMENT}
+$FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 -I {} $ECHOCOMMAND {} | $SORTCOMMAND -g | while read filename; do filename=${filename#./}; if [ -r captions.txt ]; then caption=$($GREPCOMMAND -E "^$filename " captions.txt); caption=${caption#* }; else caption=""; fi; if [ $GENERATEPAGESFORMEDIUMSIZE != 0 ]; then link=${PAGESDIRECTORY}$(bpgallery_escape_url "${filename}${extra}.html"); elif [ $GENERATEPAGESFORFULLSIZE != 0 ]; then link=${PAGESDIRECTORY}$(bpgallery_escape_url "${filename}.html"); else link=$(bpgallery_escape_url "$filename"); fi; filename=$(bpgallery_escape_url "$filename"); $BPGALLERY_THUMBSLINE_FUNCTION; done >> ${INDEXDOCUMENT}
$BPGALLERY_TAIL_FUNCTION >> ${INDEXDOCUMENT}