Class: JekyllNotion::Generator
- Inherits:
-
Jekyll::Generator
- Object
- Jekyll::Generator
- JekyllNotion::Generator
- Defined in:
- lib/jekyll-notion/generator.rb
Instance Attribute Summary collapse
-
#current_db ⇒ Object
readonly
Returns the value of attribute current_db.
-
#current_page ⇒ Object
readonly
Returns the value of attribute current_page.
Instance Method Summary collapse
- #collections ⇒ Object
- #config_databases ⇒ Object
- #config_pages ⇒ Object
- #data ⇒ Object
- #generate(site) ⇒ Object
- #pages ⇒ Object
Instance Attribute Details
#current_db ⇒ Object (readonly)
Returns the value of attribute current_db.
5 6 7 |
# File 'lib/jekyll-notion/generator.rb', line 5 def current_db @current_db end |
#current_page ⇒ Object (readonly)
Returns the value of attribute current_page.
5 6 7 |
# File 'lib/jekyll-notion/generator.rb', line 5 def current_page @current_page end |
Instance Method Details
#collections ⇒ Object
41 42 43 |
# File 'lib/jekyll-notion/generator.rb', line 41 def collections @collections ||= {} end |
#config_databases ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/jekyll-notion/generator.rb', line 24 def config_databases if config["database"] Jekyll.logger.warn("Jekyll Notion:", "database property is deprecated, use databases instead.") end config["databases"] || [] end |
#config_pages ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/jekyll-notion/generator.rb', line 33 def config_pages if config["page"] Jekyll.logger.warn("Jekyll Notion:", "page property is deprecated, use pages instead.") end config["pages"] || [] end |
#data ⇒ Object
45 46 47 |
# File 'lib/jekyll-notion/generator.rb', line 45 def data @data ||= {} end |
#generate(site) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jekyll-notion/generator.rb', line 7 def generate(site) @site = site return unless notion_token? && config? setup if fetch_on_watch? || cache_empty? read_notion_databases read_notion_pages else collections.each_pair { |key, val| @site.collections[key] = val } data.each_pair { |key, val| @site.data[key] = val } pages.each { |page| @site.pages << page } end end |
#pages ⇒ Object
49 50 51 |
# File 'lib/jekyll-notion/generator.rb', line 49 def pages @pages ||= [] end |