Open PCadillac opened 10 years ago
:+1: experiencing this as well
Solved .... please correct in Github delete line 54 commented in the following (plugins/render_partial.rb)
#
#
#
#
#
# #
require 'pathname' require './plugins/octopress_filters'
module Jekyll
class RenderPartialTag < Liquid::Tag include OctopressFilters def initialize(tag_name, markup, tokens) @file = nil @raw = false if markup =~ /^(\S+)\s?(\w+)?/ @file = $1.strip @raw = $2 == 'raw' end super end
def render(context)
file_dir = (context.registers[:site].source || 'source')
file_path = Pathname.new(file_dir).expand_path
file = file_path + @file
unless file.file?
return "File #{file} could not be found"
end
Dir.chdir(file_path) do
contents = file.read
if contents =~ /\A-{3}.+[^\A]-{3}\n(.+)/m
contents = $1.lstrip
end
if @raw
contents
else
partial = Liquid::Template.parse(contents)
context.stack do
partial.render(context)
end
end
end
end
end end
Liquid::Template.register_tag('render_partial', Jekyll::RenderPartialTag)
@PCadillac Please wrap the code with three backquotes like:
require 'pathname'
:+1: experiencing this as well
I disagree @PCadillac, I don't think that's the solution. Removing this line will only avoid the problem without solving it as it will stop preprocessing the contents, and it no longer renders the markdown into html. I believe it should be changed to
contents = OctopressFilters::pre_filter(contents)
Or perhaps the Include isn't working properly. However if you change it to the above you get another error that method `ext' does not exist from here. It appears to expect what I believe should be a Jekyll::Page, however it's getting a string. I'm not sure how you're supposed to craft the Jekyll::Page from what you currently have either. If anyone could point me in the right direction on fixing this I'd be more than happy to do the work and file a PR. Any ideas?
@lethjakman One way to do it (a kludge, really) is to create a fake object with two attributes: content
, and ext
. Set the former to a string you want to process, and the latter to "html"
. That should do it. After calling pre_filter
we can extract the result from content
.
The idea is to pattern our fake object after Page, but thankfully only two attributes are used by pre_filter.
on unbuntu 14.04 or windows 7 ruby --version: ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux] but same pb with ruby 2.1.2
(c9e0078d65 Brandon Mathis imathis authored 7 days ago) all basic plugins work, besides render_partial
Simple test post:
Maybe linked with the last modifications (last week(s) ) ... was OK before