Skip to content

Commit

Permalink
Merge pull request #1533 from 304/add_pandoc_support
Browse files Browse the repository at this point in the history
Add pandoc support
  • Loading branch information
namusyaka committed Aug 17, 2019
2 parents 8bd783d + 6ebf9ce commit 50b7c4f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -17,7 +17,7 @@ addons:
- ubuntu-toolchain-r-test
packages:
- g++-4.8

- pandoc
rvm:
- 2.2.10
- 2.3.8
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -750,6 +750,8 @@ template, you almost always want to pass locals to it.
<a href="https://github.com/ged/bluecloth" title="BlueCloth">BlueCloth</a>,
<a href="https://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
<a href="https://github.com/bhollis/maruku" title="maruku">maruku</a>
<a href="https://github.com/gjtorikian/commonmarker" title="commonmarker">commonmarker</a>
<a href="https://github.com/alphabetum/pandoc-ruby" title="pandoc">pandoc</a>
</td>
</tr>
<tr>
Expand Down
4 changes: 3 additions & 1 deletion lib/sinatra/base.rb
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 50b7c4f

Please sign in to comment.