Sha256: a902945a2291d5c19388942988a9daebf4607ab351ce7dbdf9ee0d9539f378cc

Contents?: true

Size: 546 Bytes

Versions: 1

Compression:

Stored size: 546 Bytes

Contents

require 'i15r/base'

module I15R
  module PatternMatchers
    class TagAttributeMatcher < Base

      def self.match_title_attribute
        patt = /^(.*)(<a\s+.*title=)['"](.*?)['"](.*)/
        matches do |text, prefix|
          if m = patt.match(text)
            i18n_string = I15R::Base.get_i18n_message_string(m[3], prefix)
            i18ned_row = %(#{m[1]}#{m[2]}"<%= I18n.t("#{i18n_string}") %>"#{m[4]})
            [m[0], i18ned_row]
          end
        end
      end
      register_matcher :match_title_attribute

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
i15r-0.3.0 lib/i15r/pattern_matchers/tag_attribute_matcher.rb