Sha256: 15e96fc3ad8b5d065f66f24188a09e6e7d0bf090753a73ed7eeda178c5ebab99
Contents?: true
Size: 714 Bytes
Versions: 4
Compression:
Stored size: 714 Bytes
Contents
module Jekyll class IncludeTag < Liquid::Tag def initialize(tag_name, file, tokens) super @file = file.strip end def render(context) if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./ return "Include file '#{@file}' contains invalid characters or sequences" end Dir.chdir(File.join(Jekyll.source, '_includes')) do choices = Dir['**/*'].reject { |x| File.symlink?(x) } if choices.include?(@file) File.read(@file) else "Included file '#{@file}' not found in _includes directory" end end end end end Liquid::Template.register_tag('include', Jekyll::IncludeTag)
Version data entries
4 entries across 4 versions & 4 rubygems
Version | Path |
---|---|
ddemaree-jekyll-0.2.1 | lib/jekyll/tags/include.rb |
gabrielg-jekyll-0.2.2 | lib/jekyll/tags/include.rb |
mojombo-jekyll-0.3.0 | lib/jekyll/tags/include.rb |
jekyll-0.3.0 | lib/jekyll/tags/include.rb |