Sha256: 2a6405b3e1c50e8db5b7fa71f4d044b2060d31228e669ca93ebe0571178e84ce

Contents?: true

Size: 950 Bytes

Versions: 24

Compression:

Stored size: 950 Bytes

Contents

module Octopress
  module Ink
    module Helpers
      module ContentFor
        def self.get_block_name(tag_name, markup)
          if markup.strip == ''
            raise IOError.new "Syntax Error: #{tag_name} requires a name, eg. {% #{tag_name} sidebar %}"
          else
            markup.strip
          end
        end

        # Gets the storage space for the content block
        def self.get_block(context, block)
          context.environments.first['content_for'] ||= {}
          context.environments.first['content_for'][block] ||= []
        end

        def self.render(context, block)
          content = get_block(context, block).map { |b| b }.join
        end

        def self.append_to_block(context, block, content)
          converter = context.environments.first['converter']
          content = converter.convert(content).sub(/\n$/,'')
          get_block(context, block) << content
        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/content_for.rb
octopress-ink-1.0.0.rc.10 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.rc.9 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.rc.8 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.rc.7 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.rc.6 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.rc.5 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.rc.3 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.rc.2 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.rc.1 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.alpha.45 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.alpha.44 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.alpha.43 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.alpha.42 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.alpha.41 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.alpha.40 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.alpha.39 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.alpha.38 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.alpha.37 lib/octopress-ink/helpers/content_for.rb
octopress-ink-1.0.0.alpha.36 lib/octopress-ink/helpers/content_for.rb