Sha256: 11cdc8a37a4d97d7f701f866ce5338c119aecb9c7b1cfd8f28d88bc9f3f2e889

Contents?: true

Size: 722 Bytes

Versions: 8

Compression:

Stored size: 722 Bytes

Contents

module Locomotive
  module Builder
    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

8 entries across 8 versions & 1 rubygems

Version Path
locomotivecms_builder-1.0.0.alpha8 lib/locomotive/builder/liquid/tags/google_analytics.rb
locomotivecms_builder-1.0.0.alpha7 lib/locomotive/builder/liquid/tags/google_analytics.rb
locomotivecms_builder-1.0.0.alpha6 lib/locomotive/builder/liquid/tags/google_analytics.rb
locomotivecms_builder-1.0.0.alpha5 lib/locomotive/builder/liquid/tags/google_analytics.rb
locomotivecms_builder-1.0.0.alpha4 lib/locomotive/builder/liquid/tags/google_analytics.rb
locomotivecms_builder-1.0.0.alpha3 lib/locomotive/builder/liquid/tags/google_analytics.rb
locomotivecms_builder-1.0.0.alpha2 lib/locomotive/builder/liquid/tags/google_analytics.rb
locomotivecms_builder-1.0.0.alpha1 lib/locomotive/builder/liquid/tags/google_analytics.rb