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
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
}