lib/cheesy-gallery/generator.rb in cheesy-gallery-1.1.0 vs lib/cheesy-gallery/generator.rb in cheesy-gallery-1.1.1

- old
+ new

@@ -1,20 +1,16 @@ -# typed: strict # frozen_string_literal: true require 'jekyll' require 'json' require 'cheesy-gallery/gallery_index' require 'cheesy-gallery/image_file' require 'cheesy-gallery/image_thumb' # The generator modifies the `site` data structure to contain all data necessary by the layouts and tags to render the galleries class CheesyGallery::Generator < Jekyll::Generator - extend T::Sig - - sig { params(site: Jekyll::Site).void } def generate(site) - @site = T.let(site, T.nilable(Jekyll::Site)) + @site = site (site.collections.values.find_all { |c| c.metadata['cheesy-gallery'] } || [site.collections['galleries']]).compact.each do |collection| collection.metadata['output'] = true unless collection.metadata.key? 'output' # all directories in the collection that have a file in them, as absolute paths from the root of the collection galleries = Set[*collection.entries.map { |e| File.expand_path(File.join('/', File.dirname(e))) }]