don't display "run slideshow" when there is 1 image or less.
authorgc <gc>
Wed, 16 Mar 2005 21:03:14 +0000 (21:03 +0000)
committergc <gc>
Wed, 16 Mar 2005 21:03:14 +0000 (21:03 +0000)
don't generate image-*.html where there are only videos.

booh

diff --git a/booh b/booh
index 77f6fafbfbf65b35bbf8738b6c3f889164a551e6..ab0f38e26217ec6d3a924651d36b4bef470e137d 100755 (executable)
--- a/booh
+++ b/booh
@@ -541,7 +541,7 @@ def walk_source_dir
             html = $html_thumbnails.collect { |l| l.clone }
             iterations = {}
             for i in html
-                i.sub!(/~~run_slideshow~~/, '<a href="image-' + sizeobj['name'] + '.html?run_slideshow">' + utf8(_('Run slideshow!')) + '</a>')
+                i.sub!(/~~run_slideshow~~/, images.size <= 1 ? '' : '<a href="image-' + sizeobj['name'] + '.html?run_slideshow">' + utf8(_('Run slideshow!')) + '</a>')
                 i.sub!(/~~title~~/, xmldir.attributes['thumbnails-caption'] || File.basename(dir))
                 for sizeobj2 in $images_size
                     if sizeobj != sizeobj2
@@ -593,39 +593,41 @@ def walk_source_dir
         end
 
         #- generate image.html (page with fullscreen images)
-        #- don't ask me why I need so many backslashes... the aim is to print \\\" for each " in the javascript source
-        captions4js = find_captions(xmldir, images).collect { |e| e ? '"' + e.gsub('"', '\\\\\\\\\\\\\\\\\"' ) + '"' : '""' }.join(', ')
-        for sizeobj in $images_size
-            html = $html_images.collect { |l| l.clone }
-            images4js = fullscreen_images[sizeobj['name']].collect { |e| "\"#{e}\"" }.join(', ')
-            otherimages4js = ''
-            othersizes = []
-            for sizeobj2 in $images_size
-                if sizeobj != sizeobj2
-                    otherimages4js += "var images_#{sizeobj2['name']} = new Array(" + fullscreen_images[sizeobj2['name']].collect { |e| "\"#{e}\"" }.join(', ') + ")\n"
-                    othersizes << "\"#{sizeobj2['name']}\""
-                end
-            end
-            for i in html
-                i.sub!(/~~images~~/, images4js)
-                i.sub!(/~~other_images~~/, otherimages4js)
-                i.sub!(/~~other_sizes~~/, othersizes.join(', '))
-                i.sub!(/~~captions~~/, captions4js)
-                i.sub!(/~~title~~/, xmldir.attributes['thumbnails-caption'] || File.basename(dir))
-                i.sub!(/~~thumbnails~~/, '<a href="thumbnails-' + sizeobj['name'] + '.html">' + utf8(_('Return to thumbnails')) + '</a>')
+        if images.size > 0
+            #- don't ask me why I need so many backslashes... the aim is to print \\\" for each " in the javascript source
+            captions4js = find_captions(xmldir, images).collect { |e| e ? '"' + e.gsub('"', '\\\\\\\\\\\\\\\\\"' ) + '"' : '""' }.join(', ')
+            for sizeobj in $images_size
+                html = $html_images.collect { |l| l.clone }
+                images4js = fullscreen_images[sizeobj['name']].collect { |e| "\"#{e}\"" }.join(', ')
+                otherimages4js = ''
+                othersizes = []
                 for sizeobj2 in $images_size
                     if sizeobj != sizeobj2
-                        i.sub!(/~~size_#{sizeobj2['name']}~~/,
-                               '<a href="image-' + sizeobj2['name'] + '.html" id="link' + sizeobj2['name'] + '">' + sizenames[sizeobj2['name']] + '</a>')
-                    else
-                        i.sub!(/~~size_#{sizeobj2['name']}~~/,
-                               sizenames[sizeobj2['name']])
+                        otherimages4js += "var images_#{sizeobj2['name']} = new Array(" + fullscreen_images[sizeobj2['name']].collect { |e| "\"#{e}\"" }.join(', ') + ")\n"
+                        othersizes << "\"#{sizeobj2['name']}\""
                     end
                 end
+                for i in html
+                    i.sub!(/~~images~~/, images4js)
+                    i.sub!(/~~other_images~~/, otherimages4js)
+                    i.sub!(/~~other_sizes~~/, othersizes.join(', '))
+                    i.sub!(/~~captions~~/, captions4js)
+                    i.sub!(/~~title~~/, xmldir.attributes['thumbnails-caption'] || File.basename(dir))
+                    i.sub!(/~~thumbnails~~/, '<a href="thumbnails-' + sizeobj['name'] + '.html">' + utf8(_('Return to thumbnails')) + '</a>')
+                    for sizeobj2 in $images_size
+                        if sizeobj != sizeobj2
+                            i.sub!(/~~size_#{sizeobj2['name']}~~/,
+                                   '<a href="image-' + sizeobj2['name'] + '.html" id="link' + sizeobj2['name'] + '">' + sizenames[sizeobj2['name']] + '</a>')
+                        else
+                            i.sub!(/~~size_#{sizeobj2['name']}~~/,
+                                   sizenames[sizeobj2['name']])
+                        end
+                    end
+                end
+                ios = File.open("#{dest_dir}/image-#{sizeobj['name']}.html", "w")
+                ios.write(html)
+                ios.close
             end
-            ios = File.open("#{dest_dir}/image-#{sizeobj['name']}.html", "w")
-            ios.write(html)
-            ios.close
         end
     }