Sha256: a845bf7543685717fd7da19e70648eed1f07ef3043328e8200dafd05126c01a0

Contents?: true

Size: 706 Bytes

Versions: 3

Compression:

Stored size: 706 Bytes

Contents

module Locomotive
  module Steam
    module Liquid
      module Tags
        class GoogleAnalytics < ::Liquid::Tag

          Syntax = /(#{::Liquid::Expression}+)?/

          def initialize(tag_name, markup, tokens, options)
            if markup =~ Syntax
              @account_id = $1.gsub('\'', '')
            else
              raise ::Liquid::SyntaxError.new(options[:locale].t("errors.syntax.google_analytics"), options[:line])
            end

            super
          end

          def render(context)
           "<!-- google analytics for #{@account_id} -->"
          end
        end

        ::Liquid::Template.register_tag('google_analytics', GoogleAnalytics)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
locomotivecms_steam-0.1.2.pre.beta lib/locomotive/steam/liquid/tags/google_analytics.rb
locomotivecms_steam-0.1.1 lib/locomotive/steam/liquid/tags/google_analytics.rb
locomotivecms_steam-0.1.0 lib/locomotive/steam/liquid/tags/google_analytics.rb