Class: MarkdownRecord::JsonRenderer

Inherits:
Object
  • Object
show all
Includes:
ContentDsl, PathUtilities
Defined in:
lib/markdown_record/rendering/json_renderer.rb

Constant Summary

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 Method Summary collapse

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

#initialize(file_saver: ::MarkdownRecord::FileSaver.new) ⇒ JsonRenderer

Returns a new instance of JsonRenderer.



9
10
11
# File 'lib/markdown_record/rendering/json_renderer.rb', line 9

def initialize(file_saver: ::MarkdownRecord::FileSaver.new)
  @file_saver = file_saver
end

Instance Method Details

#render_models_for_subdirectory(subdirectory: "", **options) ⇒ Object



13
14
15
16
17
18
# File 'lib/markdown_record/rendering/json_renderer.rb', line 13

def render_models_for_subdirectory(subdirectory: "", **options)
  start_path = ::MarkdownRecord.config.content_root.join(subdirectory)
  node = MarkdownRecord::Rendering::Nodes::JsonDirectory.new(start_path, options, true)
  node.render(@file_saver)
  node.json_models
end