Class: RageRender::ComicHTMLToStaticFileGenerator
- Inherits:
-
Jekyll::Generator
- Object
- Jekyll::Generator
- RageRender::ComicHTMLToStaticFileGenerator
- Defined in:
- lib/ragerender/jekyll/comics.rb
Overview
If there are any HTML pages in the /images directory, we treat these as HTML-comics where the author has specified their own HTML to use instead of a comic image. We turn these into static files so that they don’t appear as extra pages.
Instance Method Summary collapse
Instance Method Details
#generate(site) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ragerender/jekyll/comics.rb', line 36 def generate site site.pages.select {|f| f.relative_path.start_with? 'images' }.each do |html| site.pages.delete html static_file = Jekyll::StaticFile.new( site, html.instance_variable_get(:"@base"), # Jekyll::Pages have their leading slash removed, but we need it html.instance_variable_get(:"@dir").gsub(/^([^\/])/) {|s| '/' + s}, html.instance_variable_get(:"@name"), ) static_file.data['content'] = html.content static_file.defaults['published'] = false site.static_files.append static_file end end |