Sha256: 0cd6a03f641f024db996c5649d02cd3f0487e17d880bfd1a04e46478baf3a6fc

Contents?: true

Size: 458 Bytes

Versions: 16

Compression:

Stored size: 458 Bytes

Contents

# frozen_string_literal: true
module ThemeCheck
  module ParsingHelpers
    # Yield each chunk outside of "...", '...'
    def outside_of_strings(markup)
      scanner = StringScanner.new(markup)

      while scanner.scan(/.*?("|')/)
        yield scanner.matched[..-2]
        # Skip to the end of the string
        scanner.skip_until(scanner.matched[-1] == "'" ? /[^\\]'/ : /[^\\]"/)
      end

      yield scanner.rest if scanner.rest?
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
theme-check-0.7.3 lib/theme_check/parsing_helpers.rb
theme-check-0.7.2 lib/theme_check/parsing_helpers.rb
theme-check-0.7.1 lib/theme_check/parsing_helpers.rb
theme-check-0.7.0 lib/theme_check/parsing_helpers.rb
theme-check-0.6.0 lib/theme_check/parsing_helpers.rb
theme-check-0.5.0 lib/theme_check/parsing_helpers.rb
theme-check-0.4.0 lib/theme_check/parsing_helpers.rb
theme-check-0.3.3 lib/theme_check/parsing_helpers.rb
theme-check-0.3.2 lib/theme_check/parsing_helpers.rb
theme-check-0.3.1 lib/theme_check/parsing_helpers.rb
theme-check-0.3.0 lib/theme_check/parsing_helpers.rb
theme-check-0.2.2 lib/theme_check/parsing_helpers.rb
theme-check-0.2.0 lib/theme_check/parsing_helpers.rb
theme-check-0.1.2 lib/theme_check/parsing_helpers.rb
theme-check-0.1.1 lib/theme_check/parsing_helpers.rb
theme-check-0.1.0 lib/theme_check/parsing_helpers.rb