Class: Bookbinder::Subnav::JsonFromMarkdownToc
- Inherits:
-
Object
- Object
- Bookbinder::Subnav::JsonFromMarkdownToc
- Defined in:
- lib/bookbinder/subnav/json_from_markdown_toc.rb
Constant Summary collapse
Class.new(RuntimeError)
Class.new(RuntimeError)
Class.new(RuntimeError)
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#fs ⇒ Object
readonly
Returns the value of attribute fs.
-
#renderer ⇒ Object
readonly
Returns the value of attribute renderer.
-
#source_for_site_gen ⇒ Object
readonly
Returns the value of attribute source_for_site_gen.
Instance Method Summary collapse
- #get_links(product_config, output_locations) ⇒ Object
-
#initialize(fs) ⇒ JsonFromMarkdownToc
constructor
A new instance of JsonFromMarkdownToc.
Constructor Details
#initialize(fs) ⇒ JsonFromMarkdownToc
Returns a new instance of JsonFromMarkdownToc.
12 13 14 15 |
# File 'lib/bookbinder/subnav/json_from_markdown_toc.rb', line 12 def initialize(fs) @fs = fs @renderer = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
30 31 32 |
# File 'lib/bookbinder/subnav/json_from_markdown_toc.rb', line 30 def config @config end |
#fs ⇒ Object (readonly)
Returns the value of attribute fs.
30 31 32 |
# File 'lib/bookbinder/subnav/json_from_markdown_toc.rb', line 30 def fs @fs end |
#renderer ⇒ Object (readonly)
Returns the value of attribute renderer.
30 31 32 |
# File 'lib/bookbinder/subnav/json_from_markdown_toc.rb', line 30 def renderer @renderer end |
#source_for_site_gen ⇒ Object (readonly)
Returns the value of attribute source_for_site_gen.
30 31 32 |
# File 'lib/bookbinder/subnav/json_from_markdown_toc.rb', line 30 def source_for_site_gen @source_for_site_gen end |
Instance Method Details
#get_links(product_config, output_locations) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/bookbinder/subnav/json_from_markdown_toc.rb', line 17 def get_links(product_config, output_locations) @source_for_site_gen = output_locations.source_for_site_generator @config = product_config root = absolute_source_from_path(Pathname(config.)) raise SubnavRootMissingError.new('Subnav root not found at: ' + config.) if root.nil? @parsed_files = { Pathname(root) => '(root)'} {links: gather_urls_and_texts(root)}.to_json end |