From 8c4edb655e44defd2f0c1199440cf4775f0f4277 Mon Sep 17 00:00:00 2001 From: Thomas Laumann Date: Fri, 4 Nov 2011 17:33:53 +0100 Subject: [PATCH] Have TextileConverter pass any arguments set to true in config's redcloth section to RedCloth constructor as an array of symbols. This means explicitly setting (for example): redcloth: hard_breaks: false lite_mode: true no_span_caps: true will cause RedCloth to be invoked thusly: RedCloth.new(content, [:lite_mode, :no_span_caps]) (Notice that hard_breaks is ignored.) This means, however, anything set to true in the redcloth section in _config.yml _will_ be passed to RedCloth. Mayhem may ensue. --- lib/jekyll/converters/textile.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/converters/textile.rb b/lib/jekyll/converters/textile.rb index 814b2080..838c96a7 100644 --- a/lib/jekyll/converters/textile.rb +++ b/lib/jekyll/converters/textile.rb @@ -27,13 +27,18 @@ module Jekyll def convert(content) setup - r = RedCloth.new(content) - if !@config['redcloth'].nil? and !@config['redcloth']['hard_breaks'].nil? - r.hard_breaks = @config['redcloth']['hard_breaks'] + restrictions = Array.new + if !@config['redcloth'].nil? + @config['redcloth'].each do |key, value| + restrictions << key.to_sym if value + end + require 'ap' + ap restrictions end - r.to_html + + RedCloth.new(content, restrictions).to_html end end