don't abort on substInFile for dirs without elements
authorgc <gc>
Sat, 28 May 2005 18:09:31 +0000 (18:09 +0000)
committergc <gc>
Sat, 28 May 2005 18:09:31 +0000 (18:09 +0000)
bin/booh-backend

index e40f7c723ed99d0737b2d0ca90ac8611d82c4573..819375c39a82f499c0273ce52e42d66ce62150c8 100755 (executable)
@@ -902,23 +902,25 @@ def walk_source_dir
         ios.close
 
         #- substitute "return to albums" and previous/next correctly
         ios.close
 
         #- substitute "return to albums" and previous/next correctly
-        for sizeobj in $images_size
-            substInFile("#{dest_dir}/thumbnails-#{sizeobj['name']}.html") { |line|
-                sub_previous_next_album(previous_album, next_album, line)
-                if xmldir.elements['dir']
-                    line.sub!(/~~return_to_albums~~/, '<a href="index.html">' + utf8(_('return to albums')) + '</a>')
-                else
-                    if xmldir.parent.name == 'dir'
-                        line.sub!(/~~return_to_albums~~/, '<a href="../index.html">' + utf8(_('return to albums')) + '</a>')
+        if xmldir.elements['image'] || xmldir.elements['video']
+            for sizeobj in $images_size
+                substInFile("#{dest_dir}/thumbnails-#{sizeobj['name']}.html") { |line|
+                    sub_previous_next_album(previous_album, next_album, line)
+                    if xmldir.elements['dir']
+                        line.sub!(/~~return_to_albums~~/, '<a href="index.html">' + utf8(_('return to albums')) + '</a>')
                     else
                     else
-                        line.sub!(/~~return_to_albums~~/, '')
+                        if xmldir.parent.name == 'dir'
+                            line.sub!(/~~return_to_albums~~/, '<a href="../index.html">' + utf8(_('return to albums')) + '</a>')
+                        else
+                            line.sub!(/~~return_to_albums~~/, '')
+                        end
                     end
                     end
-                end
-                line
-            }
-            substInFile("#{dest_dir}/image-#{sizeobj['name']}.html") { |line|
-                sub_previous_next_album(previous_album, next_album, line)
-            }
+                    line
+                }
+                substInFile("#{dest_dir}/image-#{sizeobj['name']}.html") { |line|
+                    sub_previous_next_album(previous_album, next_album, line)
+                }
+            end
         end
 
     }
         end
 
     }