diff --git a/.travis.yml b/.travis.yml index 3ccec3c495..7a10548be9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ addons: - ubuntu-toolchain-r-test packages: - g++-4.8 - + - pandoc rvm: - 2.2.10 - 2.3.8 diff --git a/Gemfile b/Gemfile index 6df880fd4f..7bee5fab36 100644 --- a/Gemfile +++ b/Gemfile @@ -60,6 +60,7 @@ if RUBY_ENGINE == "ruby" gem 'reel-rack' gem 'celluloid', '~> 0.16.0' gem 'commonmarker', '~> 0.20.0' + gem 'pandoc-ruby', '~> 2.0.2' gem 'simplecov', require: false end diff --git a/README.md b/README.md index 336ac2b994..effb719297 100644 --- a/README.md +++ b/README.md @@ -750,6 +750,8 @@ template, you almost always want to pass locals to it. BlueCloth, kramdown, maruku + commonmarker + pandoc diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index c36fbcaf00..5536245a39 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -722,6 +722,7 @@ def liquid(template, options = {}, locals = {}, &block) end def markdown(template, options = {}, locals = {}) + options[:exclude_outvar] = true render :markdown, template, options, locals end @@ -818,10 +819,11 @@ def render(engine, data, options = {}, locals = {}, &block) content_type = options.delete(:content_type) || content_type layout_engine = options.delete(:layout_engine) || engine scope = options.delete(:scope) || self + exclude_outvar = options.delete(:exclude_outvar) options.delete(:layout) # set some defaults - options[:outvar] ||= '@_out_buf' + options[:outvar] ||= '@_out_buf' unless exclude_outvar options[:default_encoding] ||= settings.default_encoding # compile and render template