You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2009/06/30 08:39:20 UTC
svn commit: r789579 - /buildr/trunk/rakelib/jekylltask.rb
Author: assaf
Date: Tue Jun 30 06:39:19 2009
New Revision: 789579
URL: http://svn.apache.org/viewvc?rev=789579&view=rev
Log:
Fixed Jekyll 0.5.2 and Liquid 2.0.0 to work under Ruby 1.9.
Modified:
buildr/trunk/rakelib/jekylltask.rb
Modified: buildr/trunk/rakelib/jekylltask.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/rakelib/jekylltask.rb?rev=789579&r1=789578&r2=789579&view=diff
==============================================================================
--- buildr/trunk/rakelib/jekylltask.rb (original)
+++ buildr/trunk/rakelib/jekylltask.rb Tue Jun 30 06:39:19 2009
@@ -84,3 +84,37 @@
end
end
Liquid::Template.register_filter(TocFilter)
+
+
+
+# Under Ruby 1.9 [a,b,c].to_s doesn't join the array first. (Jekyll 0.5.2 requires this)
+module Jekyll
+ class HighlightBlock < Liquid::Block
+ def render(context)
+ if context.registers[:site].pygments
+ render_pygments(context, super.join)
+ else
+ render_codehighlighter(context, super.join)
+ end
+ end
+ end
+end
+
+# Ruby 1.9 has sane closure scoping which manages to mess Liquid filters. (Liquid 2.0.0 requires this)
+module Liquid
+ class Variable
+ def render(context)
+ return '' if @name.nil?
+ @filters.inject(context[@name]) do |output, filter|
+ filterargs = filter[1].to_a.collect do |a|
+ context[a]
+ end
+ begin
+ context.invoke(filter[0], output, *filterargs)
+ rescue FilterNotFound
+ raise FilterNotFound, "Error - filter '#{filter[0]}' in '#{@markup.strip}' could not be found."
+ end
+ end
+ end
+ end
+end