fixing bugs in the gallery program due to ruby mutability issues

This commit is contained in:
Andrew Davidson 2016-09-19 22:20:03 -04:00
parent f2425919c6
commit b889aad4f8

View file

@ -24,11 +24,11 @@ module Jekyll
end
end
class GalleryPhoto < Page
def initialize(site, base, dir, name, photo)
def initialize(site, base, dir, photo)
@site = site
@base = base
@dir = dir
@name = name
@name = 'index.html'
self.process(@name)
self.read_yaml(File.join(base, "_layouts"), 'gallery-photo.html')
@ -48,19 +48,18 @@ module Jekyll
index_record['slug'] = gallery['gallery-slug']
index_record['key'] = gallery['gallery-key']
gallery_index.push(index_record)
gallery_page = index_record
gallery_page = index_record.clone
gallery_page['images'] = gallery['images']
site.pages << GalleryPage.new(
site, site.source, "photos/#{gallery['gallery-slug']}",
site.pages << GalleryPage.new(site, site.source,
"photos/#{gallery['gallery-slug']}",
gallery_page)
gallery['images'].each { |image|
gallery_photo = index_record
gallery['images'].each_with_index { |image, i|
gallery_photo = index_record.clone
gallery_photo['image'] = image
site.pages << GalleryPhoto.new(
site, site.source, "photos/#{gallery['gallery-slug']}",
"#{image['basename']}.html", gallery_photo)
site.pages << GalleryPhoto.new(site, site.source,
"photos/#{gallery['gallery-slug']}/#{image['basename']}",
gallery_photo)
}
}
site.pages << GalleryIndex.new(site, site.source,