]> git.sommitrealweird.co.uk Git - bpgallery.git/blobdiff - bpgallery.sh
Up version for release
[bpgallery.git] / bpgallery.sh
index d98805fca0ffc237afe89510c9cfbe5b52513c93..678f896b079916d2136ab2518d5b0eb8a4d8e7c0 100755 (executable)
 # 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"
 
 function bpgallery_default_head() {
 cat <<END
@@ -294,12 +293,10 @@ if [[ -z $INDEXDOCUMENT ]]; then
        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
@@ -471,17 +468,15 @@ function generate_pages() {
                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
@@ -490,7 +485,9 @@ function generate_pages() {
                        nextpage=${nextimage}.html
                fi
                filename=${extradir}${currentimage}
-               generate_general_page "$previouspage" "$currentpage" "$nextpage" $addlink
+               if [ "x$currentpage" != "x" ]; then
+                       generate_general_page "$previouspage" "$currentpage" "$nextpage" $addlink
+               fi
                $ECHOCOMMAND $nextimage
        done | tail -n 2 | (
                read previouspage
@@ -498,17 +495,15 @@ function generate_pages() {
                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
-               else
-                       addlink=${currentpage}${extra}.html
-               fi
-               
                filename=${extradir}${currentpage}
                if [[ $addlinks == 1 ]]; then
                        currentpage=${currentpage}${extra}.html
@@ -546,7 +541,8 @@ function generate_general_page() {
        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