Sha256: 16a7538a66ffbe3f692db21b3633f13a3e852cff57a8306c30f7a974ad8fe7cd

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

require_relative '../error/jekyll_plugin_error_handling'

module JekyllSupport
  class JekyllBlockNoArgParsing < JekyllBlock
    attr_reader :argument_string, :helper, :line_number, :logger, :page, :site

    def initialize(tag_name, argument_string, parse_context)
      class << self
        include NoArgParsing
      end

      super
      @logger.debug { "#{self.class}: respond_to?(:o_arg_parsing) #{respond_to?(:no_arg_parsing) ? 'yes' : 'no'}." }
    rescue StandardError => e
      e.shorten_backtrace
      @logger.error { e.full_message }
      JekyllSupport.error_short_trace(@logger, e)
    end

    # Liquid::Block subclasses do not render if there is no content within the tag
    # This override fixes that
    def blank?
      false
    end

    # Jekyll plugins must override this method, not render, so their plugin can be tested more easily
    # The following variables are predefined:
    #   @argument_string, @config, @envs, @helper, @layout, @logger, @mode, @page, @paginator, @site, @tag_name and @theme
    def render_impl
      abort "#{self.class}.render_impl for tag #{@tag_name} must be overridden, but it was not."
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jekyll_plugin_support-1.0.3 lib/block/jekyll_plugin_support_block_noarg.rb
jekyll_plugin_support-1.0.2 lib/block/jekyll_plugin_support_block_noarg.rb
jekyll_plugin_support-1.0.1 lib/block/jekyll_plugin_support_block_noarg.rb
jekyll_plugin_support-1.0.0 lib/block/jekyll_plugin_support_block_noarg.rb