Sha256: cdf60ba618254dc6c79a73e5442899d2b46bb0828eed4369c1a8d73d18b6ded6

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

# 
# http://baldowl.github.com/2011/04/13/rough-gallery-plugin-for-jekyll.html
# Basic: add a `gallery` attribute to the YAML header of any page with value
# being the extension of your images. Every image with that extension stored
# inside the page's directory (and every one of its subdirectories) will be
# added to the `gallery_items` attribute of that same page (alphabetically
# sorted).

module Jekyll
	class Gallery < Generator
		safe true

		def generate site
			site.pages.each do |page|
				gallery(site, page) if page.data['gallery']
			end
		end

		def gallery site, page
			base = page.instance_variable_get :@dir
			# search = File.join '**', "*.#{page.data['gallery']}"
			search = "#{page.data['gallery']}"
			items = Dir.chdir(base[1..-1] || '.') do
				Dir.glob(search).sort.map {|item| File.join base, item}
			end
			page.data = page.data.deep_merge 'gallery_items' => items
		end
	end
end

module Jekyll
	module AssetFilter
		def download_entry(input)      
			info = File.basename(input, '.zip').split('-')[0..-1]
			info << '*' if info.size < 4
			"%1s | %2s | %3s | %4s" % info
		end
	end
end

Liquid::Template.register_filter(Jekyll::AssetFilter)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
delphivm-0.9.0 dvmimports.org/_plugins/gallery.rb
delphivm-0.8.1 dvmimports.org/_plugins/gallery.rb
delphivm-0.8.0 dvmimports.org/_plugins/gallery.rb
delphivm-0.7.7 dvmimports.org/_plugins/gallery.rb
delphivm-0.7.4 dvmimports.org/_plugins/gallery.rb