Class: MarkdownRecord::Rendering::Nodes::HtmlFile

Inherits:
HtmlBase
  • Object
show all
Defined in:
lib/markdown_record/rendering/nodes/html_file.rb

Constant Summary

Constants inherited from HtmlBase

MarkdownRecord::Rendering::Nodes::HtmlBase::HTML_MACROS, MarkdownRecord::Rendering::Nodes::HtmlBase::HTML_SUBSTITUTIONS

Constants included from ContentDsl

ContentDsl::HTML_COMMENT_REGEX

Constants included from ContentDsl::Enable

ContentDsl::Enable::ENCODED_REGEX, ContentDsl::Enable::REGEX

Constants included from ContentDsl::Disable

ContentDsl::Disable::ENCODED_REGEX, ContentDsl::Disable::REGEX

Constants included from ContentDsl::UseLayout

ContentDsl::UseLayout::ENCODED_REGEX, ContentDsl::UseLayout::REGEX

Constants included from ContentDsl::Fragment

ContentDsl::Fragment::ENCODED_REGEX, ContentDsl::Fragment::REGEX

Constants included from ContentDsl::DirectoryFragment

ContentDsl::DirectoryFragment::ENCODED_REGEX, ContentDsl::DirectoryFragment::REGEX

Constants included from ContentDsl::EndModel

ContentDsl::EndModel::ENCODED_REGEX, ContentDsl::EndModel::REGEX

Constants included from ContentDsl::EndAttribute

ContentDsl::EndAttribute::ENCODED_REGEX, ContentDsl::EndAttribute::REGEX

Constants included from ContentDsl::Attribute

ContentDsl::Attribute::ENCODED_REGEX, ContentDsl::Attribute::REGEX

Constants included from ContentDsl::Model

ContentDsl::Model::ENCODED_REGEX, ContentDsl::Model::REGEX

Constants included from ContentDsl::Scope

ContentDsl::Scope::ENCODED_REGEX, ContentDsl::Scope::REGEX

Instance Attribute Summary

Attributes inherited from HtmlBase

#name, #processed_html, #rendered_html

Instance Method Summary collapse

Methods inherited from HtmlBase

#finalize_html, #global_layout, #initialize, #load_layout, #process_html, #render_erb, #render_erbs, #save, #sort_value

Methods included from ContentDsl

#remove_html_dsl_command, #remove_json_dsl_commands

Methods included from ContentDsl::Enable

#enable_dsl, remove_dsl

Methods included from ContentDsl::Disable

#disable_dsl, remove_dsl

Methods included from ContentDsl::UseLayout

remove_dsl, #use_layout_dsl

Methods included from ContentDsl::Fragment

#fragment_dsl, remove_dsl

Methods included from ContentDsl::DirectoryFragment

#directory_fragment_dsl, remove_dsl

Methods included from ContentDsl::EndModel

#end_model_dsl, remove_dsl

Methods included from ContentDsl::EndAttribute

#end_attribute_dsl, remove_dsl

Methods included from ContentDsl::Attribute

#attribute_dsl, remove_dsl

Methods included from ContentDsl::Model

#model_dsl, remove_dsl

Methods included from ContentDsl::Scope

remove_dsl, #scope_dsl

Methods included from PathUtilities

#base_content_root_name, #base_rendered_path, #base_rendered_root, #clean_path, #erb_locals_from_path, #fragment_attributes_from_path, #full_path_to_parts, #path_to_fragment_id, #remove_prefix, #rendered_path, #scoped_id_to_parts, #to_scoped_id

Constructor Details

This class inherits a constructor from MarkdownRecord::Rendering::Nodes::HtmlBase

Instance Method Details

#concatenated_htmlObject



26
27
28
# File 'lib/markdown_record/rendering/nodes/html_file.rb', line 26

def concatenated_html
  @processed_html
end

#custom_layout(html) ⇒ Object



34
35
36
37
38
39
# File 'lib/markdown_record/rendering/nodes/html_file.rb', line 34

def custom_layout(html)
  cust_layout = use_layout_dsl(html)
  return nil unless cust_layout
    
  load_layout(cust_layout)
end

#file_layoutObject



41
42
43
44
# File 'lib/markdown_record/rendering/nodes/html_file.rb', line 41

def file_layout
  file_layout_path = ::MarkdownRecord.config.file_layout_path
  @file_layout ||= file_layout_path ? load_layout(file_layout_path) : nil
end

#layoutObject



30
31
32
# File 'lib/markdown_record/rendering/nodes/html_file.rb', line 30

def layout
  @layout ||= custom_layout(@rendered_html) || file_layout
end

#raw_contentObject



22
23
24
# File 'lib/markdown_record/rendering/nodes/html_file.rb', line 22

def raw_content
  @raw_content ||= File.read(@pathname)
end

#render(file_saver) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/markdown_record/rendering/nodes/html_file.rb', line 6

def render(file_saver)
  render_html
  process_html
  finalize_html

  if @options[:deep]
    save(file_saver)
  end
end

#render_htmlObject



16
17
18
19
20
# File 'lib/markdown_record/rendering/nodes/html_file.rb', line 16

def render_html
  html = @markdown.render(raw_content)
  html = remove_json_dsl_commands(html) 
  @rendered_html = html
end