Sha256: 78f29487b26144e24abad1791de0711fb51aa6bff9fa147cf798cade240355b0

Contents?: true

Size: 775 Bytes

Versions: 31

Compression:

Stored size: 775 Bytes

Contents

# @Opulent
module Opulent
  # @Parser
  class Parser
    # Check if we match an compile time filter
    #
    # :filter
    #
    # @param parent [Node] Parent node to which we append the element
    #
    def filter(parent, indent)
      if (filter_name = accept :filter)
        # Get element attributes
        atts = attributes(shorthand_attributes) || {}

        # Accept inline text or multiline text feed as first child
        error :fiter unless accept(:line_feed).strip.empty?

        # Get everything under the filter and set it as the node value
        # and create a new node and set its extension
        parent[@children] << [:filter, filter_name[1..-1].to_sym, atts, get_indented_lines(indent), indent]
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
opulent-1.1.9 lib/opulent/parser/filter.rb
opulent-1.1.7 lib/opulent/parser/filter.rb
opulent-1.1.6 lib/opulent/parser/filter.rb
opulent-1.1.5 lib/opulent/parser/filter.rb
opulent-1.1.0 lib/opulent/parser/filter.rb
opulent-1.0.9 lib/opulent/parser/filter.rb
opulent-1.0.8 lib/opulent/parser/filter.rb
opulent-1.0.7 lib/opulent/parser/filter.rb
opulent-1.0.4 lib/opulent/parser/filter.rb
opulent-1.0.3 lib/opulent/parser/filter.rb
opulent-1.0.2 lib/opulent/parser/filter.rb