class Jekyll::Geolexica::MetaPagesGenerator
Attributes
generated_pages[R]
site[R]
Public Instance Methods
add_page(*pages)
click to toggle source
# File lib/jekyll/geolexica/meta_pages_generator.rb, line 53 def add_page *pages self.generated_pages.concat(pages) end
all_pages_pathnames()
click to toggle source
Lists all regular files in base_dir
recursively, and returns them as an Array of Pathname instances, which are relative to base_dir
.
# File lib/jekyll/geolexica/meta_pages_generator.rb, line 37 def all_pages_pathnames Dir.glob("**/*", base: base_dir). map { |path| Pathname.new(path) }. reject { |pathname| pathname.expand_path(base_dir).directory? } end
base_dir()
click to toggle source
# File lib/jekyll/geolexica/meta_pages_generator.rb, line 43 def base_dir File.expand_path("../../../_pages", __dir__) end
generate(site)
click to toggle source
Generates Geolexica
meta pages, both HTML and machine-readable.
# File lib/jekyll/geolexica/meta_pages_generator.rb, line 14 def generate(site) Jekyll.logger.info("Geolexica:", "Generating meta pages") # 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_pages site.pages.concat(generated_pages) end
make_pages()
click to toggle source
Processes concepts and yields a bunch of Jekyll::Page instances.
# File lib/jekyll/geolexica/meta_pages_generator.rb, line 28 def make_pages all_pages_pathnames.each do |p| next if skip_page?(p) add_page Page.new(site, base_dir, p.dirname.to_s, p.basename.to_s) end end
skip_page?(pathname)
click to toggle source
# File lib/jekyll/geolexica/meta_pages_generator.rb, line 47 def skip_page?(pathname) (pathname.extname == ".ttl" && !output_turtle?) || (pathname.extname == ".json" && !output_json?) || false end