*** empty log message ***
authorgc <gc>
Sun, 6 Mar 2005 13:07:28 +0000 (13:07 +0000)
committergc <gc>
Sun, 6 Mar 2005 13:07:28 +0000 (13:07 +0000)
booh

diff --git a/booh b/booh
index 88045c746e0e6dd67400936585023dad8d79ec67..95d9254639a48a75f3817c1ae4ae597ea3e10016 100755 (executable)
--- a/booh
+++ b/booh
@@ -244,11 +244,20 @@ def psys(cmd)
     end
 end
 
+def find_caption_value(image)
+    caption = $captions[image]
+    if caption != nil
+        return caption['value']
+    else
+        return nil
+    end
+end
+
 def find_captions(dir, images)
     if $captions_skel
         $images_list_for_captions += images.collect { |img| "#{dir}/#{img}" }
     end
-    return images.collect { |img| $captions["#{dir}/#{img}"]['value'] }
+    return images.collect { |img| find_caption_value("#{dir}/#{img}") }
 end
 
 def entry2type(entry)
@@ -266,7 +275,7 @@ def walk_source_dir
     `find #{$source} -type d`.each { |dir|
         dir.chomp!
         entries = []
-        if $captions
+        if $captions.size > 0
             msg 2, __("Handling %s from captions list...", dir)
             entries = $captions.keys.sort { |a,b| $captions[a]['order'] <=> $captions[b]['order'] }.
                                      find_all { |file| File.dirname(file) == dir }.
@@ -390,7 +399,7 @@ def walk_source_dir
                     html_thumbnails.gsub!(/~~image_iteration~~/,
                                           '<a href="image.html?current=' + fullscreen_images[index] + '"><img src="' + thumbnail_images[index] + '" border="0"/></a>')
                     html_thumbnails.gsub!(/~~caption_iteration~~/,
-                                          $captions["#{dir}/#{images[index]}"]['value'] || images[index])
+                                          find_caption_value("#{dir}/#{images[index]}") || images[index])
                     html_thumbnails.gsub!(/~~ifimage\?~~([^~]+)~~/) { $1 }
                     html_thumbnails.gsub!(/~~ifvideo\?~~[^~]+~~/, '')
                 elsif type == 'video'
@@ -398,7 +407,7 @@ def walk_source_dir
                     html_thumbnails.gsub!(/~~image_iteration~~/,
                                           '<a href="' + videos[index] + '"><img src="' + thumbnail_videos[index] + '" border="0"/></a>')
                     html_thumbnails.gsub!(/~~caption_iteration~~/,
-                                          $captions["#{dir}/#{videos[index]}"]['value'] || videos[index])
+                                          find_caption_value("#{dir}/#{videos[index]}") || videos[index])
                     html_thumbnails.gsub!(/~~ifimage\?~~[^~]+~~/, '')
                     html_thumbnails.gsub!(/~~ifvideo\?~~([^~]+)~~/) { $1 }
                 end