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.
This commit is contained in:
Thomas Laumann 2011-11-04 17:33:53 +01:00
parent bb9f1064d3
commit 8c4edb655e
1 changed files with 9 additions and 4 deletions

View File

@ -27,13 +27,18 @@ module Jekyll
def convert(content) def convert(content)
setup setup
r = RedCloth.new(content)
if !@config['redcloth'].nil? and !@config['redcloth']['hard_breaks'].nil? restrictions = Array.new
r.hard_breaks = @config['redcloth']['hard_breaks'] if !@config['redcloth'].nil?
@config['redcloth'].each do |key, value|
restrictions << key.to_sym if value
end
require 'ap'
ap restrictions
end end
r.to_html
RedCloth.new(content, restrictions).to_html
end end
end end