app/models/wiki_content.rb in Pimki-1.4.092 vs app/models/wiki_content.rb in Pimki-1.5.092

- old
+ new

@@ -44,11 +44,11 @@ # Moved URIChunk from pre-engine to post-engine, as it clashed with the textile # markup of "link":URL. PRE_ENGINE_ACTIONS = [ NoWiki, Category, Include, Literal::Pre, WikiSymbol, WikiChunk::Link, WikiChunk::BlikiLink ] - POST_ENGINE_ACTIONS = [ Literal::Tags, WikiChunk::Word, URIChunk, Todo ] + POST_ENGINE_ACTIONS = [ Literal::Tags, URIChunk, WikiChunk::Word, Todo ] DEFAULT_OPTS = { :pre_engine_actions => PRE_ENGINE_ACTIONS, :post_engine_actions => POST_ENGINE_ACTIONS, @@ -67,34 +67,35 @@ # Deep copy of DEFAULT_OPTS to ensure that changes to PRE/POST_ENGINE_ACTIONS stay local @options = Marshal.load(Marshal.dump(DEFAULT_OPTS)).update(options) @options[:engine] = Engines::MAP[@web.markup] || Engines::Textile - @options[:engine_opts] = [] - case @options[:engine] - when Engines::Textile + @options[:engine_opts] = DEFAULT_OPTS[:engine_opts] + case @options[:engine].name + when 'Engines::Textile' if RedCloth::VERSION >= '3.0.0' # RedCloth v3 changes the default behaviour from not folding lines. - DEFAULT_OPTS[:engine_opts] = [:hard_breaks] + @options[:engine_opts] += [:hard_breaks] end @options[:engine_opts] += (@web.safe_mode ? [:filter_html, :filter_styles] : []) - when Engines::BlueMarkdown, Engines::RedMarkdown + when 'Engines::BlueMarkdown', 'Engines::RedMarkdown' @options[:engine_opts] += (@web.safe_mode ? [:filter_html, :filter_styles] : []) - when Engines::RDoc + when 'Engines::RDoc' nil end - @options[:post_engine_actions].delete(WikiChunk::Word) if @web.brackets_only super(@revision.content) begin render!(@options[:pre_engine_actions] + [@options[:engine]] + @options[:post_engine_actions]) rescue => e + puts "[#{DateTime.now.strftime '%F %T'}] DEBUG: #{e}" + puts e.backtrace @rendered = "<strong>#{e.message}</strong><br/><br/>#{e.backtrace.join('<br/>')}" end end # Call @web.page_link using current options. \ No newline at end of file