Class: JekyllSupport::OutlineTag

Inherits:
JekyllBlock
  • Object
show all
Includes:
JekyllOutlineVersion
Defined in:
lib/outline_tag.rb

Overview

rubocop:disable Metrics/ClassLength

Constant Summary collapse

FIXNUM_MAX =
(2**((0.size * 8) - 2)) - 1

Constants included from JekyllOutlineVersion

JekyllOutlineVersion::VERSION

Instance Method Summary collapse

Instance Method Details

#open_headObject



95
# File 'lib/outline_tag.rb', line 95

def open_head; end

#render_impl(text) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/outline_tag.rb', line 61

def render_impl(text)
  headers = make_headers(super) # Process the block content.

  @helper.gem_file __FILE__

  @die_on_outline_error = @tag_config['die_on_outline_error'] == true if @tag_config
  @pry_on_outline_error = @tag_config['pry_on_outline_error'] == true if @tag_config

  @fields  = @helper.parameter_specified?('fields')&.split || ['title']
  @sort_by = @helper.parameter_specified?('sort_by_title') ? 'title' : 'order'
  @collection_name = @helper.remaining_markup
  raise OutlineError, 'collection_name was not specified' unless @collection_name

  @docs = obtain_docs(@collection_name)
  collection = headers + @docs
  render_outline collection
rescue OutlineError => e # jekyll_plugin_support handles StandardError
  @logger.error { JekyllPluginHelper.remove_html_tags e.logger_message }
  binding.pry if @pry_on_outline_error # rubocop:disable Lint/Debugger
  exit! 1 if @die_on_outline_error

  e.html_message
end

#render_outline(collection) ⇒ Object

Overload this for a subclass



86
87
88
89
90
91
92
93
# File 'lib/outline_tag.rb', line 86

def render_outline(collection)
  <<~HEREDOC
    <div class="outer_posts">
    #{make_entries collection}
    </div>
    #{@helper.attribute if @helper.attribution}
  HEREDOC
end