Sha256: be8c43ae5357488a2e08027f1528d6907eb521b9164954b1105a2a034fe11b14

Contents?: true

Size: 900 Bytes

Versions: 4

Compression:

Stored size: 900 Bytes

Contents

# frozen_string_literal: true
require_relative "parsing_helpers"

module ThemeCheck
  class LiquidCheck < Check
    extend ChecksTracking
    include ParsingHelpers

    # TODO: remove this once all regex checks are migrate to HtmlCheck# TODO: remove this once all regex checks are migrate to HtmlCheck
    TAG = /#{Liquid::TagStart}.*?#{Liquid::TagEnd}/om
    VARIABLE = /#{Liquid::VariableStart}.*?#{Liquid::VariableEnd}/om
    START_OR_END_QUOTE = /(^['"])|(['"]$)/
    QUOTED_LIQUID_ATTRIBUTE = %r{
      '(?:#{TAG}|#{VARIABLE}|[^'])*'| # any combination of tag/variable or non straight quote inside straight quotes
      "(?:#{TAG}|#{VARIABLE}|[^"])*"  # any combination of tag/variable or non double quotes inside double quotes
    }omix
    ATTR = /[a-z0-9-]+/i
    HTML_ATTRIBUTE = /#{ATTR}(?:=#{QUOTED_LIQUID_ATTRIBUTE})?/omix
    HTML_ATTRIBUTES = /(?:#{HTML_ATTRIBUTE}|\s)*/omix
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
theme-check-0.10.2 lib/theme_check/liquid_check.rb
theme-check-0.10.1 lib/theme_check/liquid_check.rb
theme-check-0.10.0 lib/theme_check/liquid_check.rb
theme-check-0.9.1 lib/theme_check/liquid_check.rb