Class: JekyllReadmeIndex::Generator
- Inherits:
-
Jekyll::Generator
- Object
- Jekyll::Generator
- JekyllReadmeIndex::Generator
- Defined in:
- lib/jekyll-readme-index/generator.rb
Constant Summary collapse
- INDEX_REGEX =
%r!$|index\.(html?|xhtml|xml)$!i.freeze
- GITHUB_DIR =
"/.github"- DOCS_DIR =
"/docs"- SPECIAL_DIRS =
[GITHUB_DIR, DOCS_DIR].freeze
- GITHUB_README_PATTERN =
%r!^/\.github/readme!i.freeze
- DOCS_README_PATTERN =
%r!^/docs/readme!i.freeze
- ROOT_README_PATTERN =
%r!^/readme!i.freeze
- CONFIG_KEY =
"readme_index"- ENABLED_KEY =
"enabled"- CLEANUP_KEY =
"remove_originals"- FRONTMATTER_KEY =
"with_frontmatter"- PATTERN_KEY =
"readme_pattern"
Instance Attribute Summary collapse
-
#site ⇒ Object
Returns the value of attribute site.
Instance Method Summary collapse
- #generate(site) ⇒ Object
-
#initialize(site) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(site) ⇒ Generator
Returns a new instance of Generator.
24 25 26 |
# File 'lib/jekyll-readme-index/generator.rb', line 24 def initialize(site) @site = site end |
Instance Attribute Details
#site ⇒ Object
Returns the value of attribute site.
13 14 15 |
# File 'lib/jekyll-readme-index/generator.rb', line 13 def site @site end |
Instance Method Details
#generate(site) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/jekyll-readme-index/generator.rb', line 28 def generate(site) @site = site return if disabled? readmes.each do |readme| next unless should_be_index?(readme) site.pages << readme.to_page site.static_files.delete(readme) if cleanup? end if with_frontmatter? readmes_with_frontmatter.each do |readme| next unless should_be_index?(readme) readme.update_permalink end end end |