Class: Madness::InlineTableOfContents

Inherits:
Object
  • Object
show all
Includes:
ServerHelper
Defined in:
lib/madness/inline_table_of_contents.rb

Overview

Generate a markdown Table of Contents for a single document

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ServerHelper

#config, #disallowed_static?, #docroot, #find_static_file, #log, #theme

Constructor Details

#initialize(text) ⇒ InlineTableOfContents

Returns a new instance of InlineTableOfContents.



9
10
11
# File 'lib/madness/inline_table_of_contents.rb', line 9

def initialize(text)
  @text = text
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



7
8
9
# File 'lib/madness/inline_table_of_contents.rb', line 7

def text
  @text
end

Instance Method Details

#markdownObject



13
14
15
# File 'lib/madness/inline_table_of_contents.rb', line 13

def markdown
  @markdown ||= ([caption, ''] + items).join "\n"
end