Fix medium sized page generation
authorBrett Parker <arch@sommitrealweird.co.uk>
Sun, 13 May 2007 10:28:17 +0000 (10:28 +0000)
committerBrett Parker <arch@sommitrealweird.co.uk>
Sun, 13 May 2007 10:28:17 +0000 (10:28 +0000)
Declare the function even if we're not generating fullsize pages.

git-archimport-id: arch@sommitrealweird.co.uk--2005-desktop/bpgallery--mainline--1.1--patch-6

TODO
bpgallery.sh

diff --git a/TODO b/TODO
index e03eb456365559c3eff6a7a7612defab540a27ed..8f689016f7b7e62c1f55b688df99833bc8d7ea59 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,3 @@
-* Generate medium sized pages correctly when not generating full size pages.
 * Allow a fixed height to be specified instead or as well as a fixed width, in
   the latter case, resize to which ever fits the bounding box, but keep the
   aspect ratio.
index d98805fca0ffc237afe89510c9cfbe5b52513c93..ccbb32872da3ea67fb5c7362021b26d61c39b0ad 100755 (executable)
@@ -294,12 +294,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 +469,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 +486,10 @@ function generate_pages() {
                        nextpage=${nextimage}.html
                fi
                filename=${extradir}${currentimage}
-               generate_general_page "$previouspage" "$currentpage" "$nextpage" $addlink
+               echo "'$previouspage' '$currentpage' '$nextpage' '$addlink'" >> /tmp/bpgallery-tmp.log
+               if [ "x$currentpage" != "x" ]; then
+                       generate_general_page "$previouspage" "$currentpage" "$nextpage" $addlink
+               fi
                $ECHOCOMMAND $nextimage
        done | tail -n 2 | (
                read previouspage
@@ -498,17 +497,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
@@ -528,6 +525,8 @@ function generate_medium_pages() {
 
 function generate_general_page() {
 
+       echo 'Generating the page...' >> /tmp/bpgallery-tmp.log
+
        if [[ -z $1 ]]; then
                previouspage=""
        fi