Sha256: c270ac935408cd8b18684c5cf88572bdc9c41f48ab0a87f60b7a71f93b36f358

Contents?: true

Size: 786 Bytes

Versions: 27

Compression:

Stored size: 786 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)
      return unless (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

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
opulent-1.6.7 lib/opulent/parser/filter.rb
opulent-1.6.6 lib/opulent/parser/filter.rb
opulent-1.6.5 lib/opulent/parser/filter.rb
opulent-1.6.3 lib/opulent/parser/filter.rb
opulent-1.6.2 lib/opulent/parser/filter.rb
opulent-1.6.1 lib/opulent/parser/filter.rb
opulent-1.6.0 lib/opulent/parser/filter.rb