Class: Jekyll::TableOfContents::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/table_of_contents/configuration.rb

Overview

jekyll-toc configuration class

Constant Summary collapse

DEFAULT_CONFIG =
{
  'min_level' => 1,
  'max_level' => 6,
  'ordered_list' => false,
  'no_toc_section_class' => 'no_toc_section',
  'list_id' => 'toc',
  'list_class' => 'section-nav',
  'sublist_class' => '',
  'item_class' => 'toc-entry',
  'item_prefix' => 'toc-'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Configuration

Returns a new instance of Configuration.



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/table_of_contents/configuration.rb', line 22

def initialize(options)
  options = generate_option_hash(options)

  @toc_levels = options['min_level']..options['max_level']
  @ordered_list = options['ordered_list']
  @no_toc_class = 'no_toc'
  @no_toc_section_class = options['no_toc_section_class']
  @list_id = options['list_id']
  @list_class = options['list_class']
  @sublist_class = options['sublist_class']
  @item_class = options['item_class']
  @item_prefix = options['item_prefix']
end

Instance Attribute Details

#item_classObject (readonly)

Returns the value of attribute item_class.



7
8
9
# File 'lib/table_of_contents/configuration.rb', line 7

def item_class
  @item_class
end

#item_prefixObject (readonly)

Returns the value of attribute item_prefix.



7
8
9
# File 'lib/table_of_contents/configuration.rb', line 7

def item_prefix
  @item_prefix
end

#list_classObject (readonly)

Returns the value of attribute list_class.



7
8
9
# File 'lib/table_of_contents/configuration.rb', line 7

def list_class
  @list_class
end

#list_idObject (readonly)

Returns the value of attribute list_id.



7
8
9
# File 'lib/table_of_contents/configuration.rb', line 7

def list_id
  @list_id
end

#no_toc_classObject (readonly)

Returns the value of attribute no_toc_class.



7
8
9
# File 'lib/table_of_contents/configuration.rb', line 7

def no_toc_class
  @no_toc_class
end

#no_toc_section_classObject (readonly)

Returns the value of attribute no_toc_section_class.



7
8
9
# File 'lib/table_of_contents/configuration.rb', line 7

def no_toc_section_class
  @no_toc_section_class
end

#ordered_listObject (readonly)

Returns the value of attribute ordered_list.



7
8
9
# File 'lib/table_of_contents/configuration.rb', line 7

def ordered_list
  @ordered_list
end

#sublist_classObject (readonly)

Returns the value of attribute sublist_class.



7
8
9
# File 'lib/table_of_contents/configuration.rb', line 7

def sublist_class
  @sublist_class
end

#toc_levelsObject (readonly)

Returns the value of attribute toc_levels.



7
8
9
# File 'lib/table_of_contents/configuration.rb', line 7

def toc_levels
  @toc_levels
end