Sha256: fd323ae89a1f3fa525eb3044b03599f9620ebea1879a6fc5ec9e43ab56b43762

Contents?: true

Size: 562 Bytes

Versions: 24

Compression:

Stored size: 562 Bytes

Contents

module Octopress
  module Ink
    module Helpers
      module Conditional
        SYNTAX = /(.*)\s(if|unless)\s(.+)/

        def self.parse(markup, context)
          if markup =~ SYNTAX
            case $2
            when 'if'
              tag = Liquid::If.new('if', $3, ["true","{% endif %}"])
            when 'unless'
              tag = Liquid::Unless.new('unless', $3, ["true","{% endunless %}"])
            end
            tag.render(context) != '' ? $1 : false
          else
            markup
          end
        end

      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
octopress-ink-1.0.0.rc.11 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.rc.10 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.rc.9 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.rc.8 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.rc.7 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.rc.6 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.rc.5 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.rc.3 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.rc.2 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.rc.1 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.alpha.45 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.alpha.44 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.alpha.43 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.alpha.42 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.alpha.41 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.alpha.40 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.alpha.39 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.alpha.38 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.alpha.37 lib/octopress-ink/helpers/conditional.rb
octopress-ink-1.0.0.alpha.36 lib/octopress-ink/helpers/conditional.rb