Class: JekyllNotion::PageWithoutAFile
- Inherits:
-
Jekyll::Page
- Object
- Jekyll::Page
- JekyllNotion::PageWithoutAFile
- Defined in:
- lib/jekyll-notion/page_without_a_file.rb
Instance Method Summary collapse
-
#initialize(site, base, dir, name, new_content) ⇒ PageWithoutAFile
constructor
A new instance of PageWithoutAFile.
- #read_yaml(base, name, _opts = {}) ⇒ Object
Constructor Details
#initialize(site, base, dir, name, new_content) ⇒ PageWithoutAFile
5 6 7 8 |
# File 'lib/jekyll-notion/page_without_a_file.rb', line 5 def initialize(site, base, dir, name, new_content) self.content = new_content super(site, base, dir, name) end |
Instance Method Details
#read_yaml(base, name, _opts = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/jekyll-notion/page_without_a_file.rb', line 10 def read_yaml(base, name, _opts = {}) filename = @path || site.in_source_dir(base, name) Jekyll.logger.debug "Reading:", relative_path begin if content =~ Jekyll::Document::YAML_FRONT_MATTER_REGEXP self.content = Regexp.last_match.post_match self.data = SafeYAML.load(Regexp.last_match(1)) end rescue Psych::SyntaxError => e Jekyll.logger.warn "YAML Exception reading page #{name}: #{e.message}" raise e if site.config["strict_front_matter"] end self.data ||= {} validate_data! filename validate_permalink! filename self.data end |