Sha256: 02df381ab761d373620d764fdd2b25e06a6c6dda42e3c7001217c76e18658e32

Contents?: true

Size: 720 Bytes

Versions: 7

Compression:

Stored size: 720 Bytes

Contents

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

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

          def initialize(tag_name, markup, tokens, context)
            if markup =~ Syntax
              @account_id = $1.gsub('\'', '')
            else
              raise ::Liquid::SyntaxError.new("Syntax Error in 'google_analytics' - Valid syntax: google_analytics <account_id>")
            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

7 entries across 7 versions & 1 rubygems

Version Path
locomotivecms_wagon-1.2.2 lib/locomotive/wagon/liquid/tags/google_analytics.rb
locomotivecms_wagon-1.2.1 lib/locomotive/wagon/liquid/tags/google_analytics.rb
locomotivecms_wagon-1.2.0 lib/locomotive/wagon/liquid/tags/google_analytics.rb
locomotivecms_wagon-1.1.0 lib/locomotive/wagon/liquid/tags/google_analytics.rb
locomotivecms_wagon-1.0.2 lib/locomotive/wagon/liquid/tags/google_analytics.rb
locomotivecms_wagon-1.0.1 lib/locomotive/wagon/liquid/tags/google_analytics.rb
locomotivecms_wagon-1.0.0 lib/locomotive/wagon/liquid/tags/google_analytics.rb