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



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

def initialize(text)
  @text = text
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



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

def text
  @text
end

Instance Method Details

#markdownObject



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

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