Class: Jekyll::Geolexica::ImagesGenerator
- Inherits:
-
Generator
- Object
- Generator
- Jekyll::Geolexica::ImagesGenerator
- Includes:
- Configuration
- Defined in:
- lib/jekyll/geolexica/images_generator.rb
Instance Attribute Summary collapse
-
#generated_pages ⇒ Object
readonly
Returns the value of attribute generated_pages.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Instance Method Summary collapse
Methods included from Configuration
#bibliography_path, #concepts_glob, #glossary_format, #glossary_path, #images_metadata_path, #images_path, #localized_concepts_path, #output_html?, #output_json?, #output_jsonld?, #output_tbx?, #output_turtle?, #output_yaml?, #report_issue_url, #suggest_translation_url, #term_languages
Instance Attribute Details
#generated_pages ⇒ Object (readonly)
Returns the value of attribute generated_pages.
13 14 15 |
# File 'lib/jekyll/geolexica/images_generator.rb', line 13 def generated_pages @generated_pages end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
13 14 15 |
# File 'lib/jekyll/geolexica/images_generator.rb', line 13 def site @site end |
Instance Method Details
#generate(site) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jekyll/geolexica/images_generator.rb', line 15 def generate(site) Jekyll.logger.info("Geolexica:", "Generating concept images") # Jekyll does not say why it's a good idea, and whether such approach # is thread-safe or not, but most plugins in the wild do exactly that, # including these authored by Jekyll team. @site = site @generated_pages = [] make_images if images_path && Dir.exist?(images_path) site.static_files.concat(generated_pages) end |
#images_pathnames ⇒ Object
38 39 40 |
# File 'lib/jekyll/geolexica/images_generator.rb', line 38 def images_pathnames Dir.glob("#{images_path}/*").map { |path| Pathname.new(path) } end |
#make_images ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/jekyll/geolexica/images_generator.rb', line 28 def make_images images_pathnames.each do |p| *base, dir = p.dirname.to_s.split("/") name = p.basename.to_s collection = Jekyll::Collection.new(site, "concepts") generated_pages << StaticFile.new(site, base, dir, name, collection) end end |