Class: FlexibleInclude::FlexibleInclude

Inherits:
JekyllSupport::JekyllTag
  • Object
show all
Extended by:
FlexibleClassMethods
Includes:
FlexiblePrivateMethods, JekyllFlexibleIncludePluginVersion
Defined in:
lib/flexible_include.rb

Constant Summary

Constants included from FlexiblePrivateMethods

FlexibleInclude::FlexiblePrivateMethods::PREFIX, FlexibleInclude::FlexiblePrivateMethods::SUFFIX

Constants included from JekyllFlexibleIncludePluginVersion

JekyllFlexibleIncludePluginVersion::VERSION

Instance Method Summary collapse

Methods included from FlexibleClassMethods

access_allowed, escape_html, normalize_path, number_content, security_check

Methods included from FlexiblePrivateMethods

#denied, #highlight, #maybe_raise_error, #parse_args, #remove_html_tags, #render_completion, #run, #setup, #wrap_in_pre

Instance Method Details

#html_message(error) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/flexible_include.rb', line 28

def html_message(error)
  <<~END_MSG
    <div class='#{error.class.name.snakecase}'>
      #{self.class} raised in #{calling_file} while processing line #{line_number} (after front matter) of #{path}
      #{message}
    </div>
  END_MSG
end

#render_implObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/flexible_include.rb', line 37

def render_impl
  setup
  @path = ::JekyllSupport::JekyllPluginHelper.expand_env @filename, @logger
  handle_path_types
  render_completion
rescue Errno::EACCES => e
  e.shorten_backtrace
  @logger.error { "#{e.class.name}: #{e.message}" }
  exit! 1 if @die_on_file_error

  html_message
rescue Errno::ENOENT => e
  e.shorten_backtrace
  @logger.error { "#{e.class.name}: #{e.message}" }
  exit! 1 if @die_on_path_denied

  html_message
rescue FlexibleIncludeError => e
  @logger.error { e.logger_message }
  exit! if @die_on_other_error

  html_message
  # rescue StandardError => e
  #   @logger.error { e.full_message }
  #   exit! 4

  #   html_message
end