Sha256: e6556c49370519cc7bc63f4eea2607a25510e20fb243612b67aa56d805bb165e
Contents?: true
Size: 822 Bytes
Versions: 2
Compression:
Stored size: 822 Bytes
Contents
module Octopress module IncludeHelper include Conditional def render_include(file, context) tag = Jekyll::Tags::IncludeTag.new('', file, []) tag.render(context) end def exists(file, context) base = Pathname.new(context.registers[:site].source || 'source').expand_path File.exists? File.join(base, "_includes", file) end def get_files(files, context) files = files.split("||").map do |file| file = file.strip context[file].nil? ? file : context[file] end end def get_include(files, context) files = get_files(files, context) files.each_with_index do |f, i| if exists(f, context) return f elsif i == files.size - 1 return f == 'none' ? false : f end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
octopress-3.0.0.alpha2 | lib/octopress/liquid_helpers/include.rb |
octopress-3.0.0.alpha1 | lib/octopress/liquid_helpers/include.rb |