Sha256: 70441f6a60e5ee58a1da7f006ec8aec049500836fd3baedc9643074f4b378acb

Contents?: true

Size: 802 Bytes

Versions: 19

Compression:

Stored size: 802 Bytes

Contents

module SlimLint::Filters
  # A dumbed-down version of {Slim::CodeAttributes} which doesn't introduce any
  # temporary variables or other cruft.
  class AttributeProcessor < Slim::Filter
    define_options :merge_attrs

    # Handle attributes expression `[:html, :attrs, *attrs]`
    #
    # @param attrs [Array]
    # @return [Array]
    def on_html_attrs(*attrs)
      [:multi, *attrs.map { |a| compile(a) }]
    end

    # Handle attribute expression `[:html, :attr, name, value]`
    #
    # @param name [String] name of the attribute
    # @param value [Array] Sexp representing the value
    def on_html_attr(name, value)
      if value[0] == :slim && value[1] == :attrvalue
        code = value[3]
        [:code, code]
      else
        @attr = name
        super
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
slim_lint-0.15.1 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.15.0 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.14.0 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.13.0 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.12.0 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.11.0 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.10.0 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.9.0 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.8.3 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.8.2 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.8.1 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.8.0 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.7.2 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.7.1 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.7.0 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.6.1 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.6.0 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.5.0 lib/slim_lint/filters/attribute_processor.rb
slim_lint-0.4.0 lib/slim_lint/filters/attribute_processor.rb