diff -Nru ruby-tilt-2.0.0+really1.4.1/bin/tilt ruby-tilt-2.0.1/bin/tilt --- ruby-tilt-2.0.0+really1.4.1/bin/tilt 2013-06-24 20:16:13.000000000 +0000 +++ ruby-tilt-2.0.1/bin/tilt 2014-04-13 21:18:29.000000000 +0000 @@ -44,9 +44,9 @@ # list all available template engines o.on("-l", "--list") do groups = {} - Tilt.mappings.each do |pattern,engines| + Tilt.lazy_map.each do |pattern,engines| engines.each do |engine| - key = engine.name.split('::').last.sub(/Template$/, '') + key = engine[0].split('::').last.sub(/Template$/, '') (groups[key] ||= []) << pattern end end diff -Nru ruby-tilt-2.0.0+really1.4.1/CHANGELOG.md ruby-tilt-2.0.1/CHANGELOG.md --- ruby-tilt-2.0.0+really1.4.1/CHANGELOG.md 2013-06-24 20:16:13.000000000 +0000 +++ ruby-tilt-2.0.1/CHANGELOG.md 2014-04-13 21:18:29.000000000 +0000 @@ -1,5 +1,33 @@ ## master +## 2.0.1 (2014-03-21) + +* Fix Tilt::Mapping bug in Ruby 2.1.0 (9589652c569760298f2647f7a0f9ed4f85129f20) +* Fix `tilt --list` (#223, Achrome) +* Fix circular require (#221, amarshall) + +## 2.0.0 (2013-11-30) + +* Support Pathname in Template#new (#219, kabturek) +* Add Mapping#templates_for (judofyr) +* Support old-style #register (judofyr) +* Add Handlebars as external template engine (#204, judofyr, jimothyGator) +* Add org-ruby as external template engine (#207, judofyr, minad) +* Documentation typo (#208, elgalu) + +## 2.0.0.beta1 (2013-07-16) + +* Documentation typo (#202, chip) +* Use YARD for documentation (#189, judofyr) +* Add Slim as an external template engine (judofyr) +* Add Tilt.templates_for (#121, judofyr) +* Add Tilt.current_template (#151, judofyr) +* Avoid loading all files in tilt.rb (#160, #187, judofyr) +* Implement lazily required templates classes (#178, #187, judofyr) +* Move #allows_script and default_mime_type to metadata (#187, judofyr) +* Introduce Tilt::Mapping (#187, judofyr) +* Make template compilation thread-safe (#191, judofyr) + ## 1.4.1 (2013-05-08) * Support Arrays in pre/postambles (#193, jbwiv) Binary files /tmp/tmpHfBXIo/0FdcuQtI4Z/ruby-tilt-2.0.0+really1.4.1/checksums.yaml.gz and /tmp/tmpHfBXIo/HcurY9QpdV/ruby-tilt-2.0.1/checksums.yaml.gz differ diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/changelog ruby-tilt-2.0.1/debian/changelog --- ruby-tilt-2.0.0+really1.4.1/debian/changelog 2014-04-30 12:06:51.000000000 +0000 +++ ruby-tilt-2.0.1/debian/changelog 2016-01-13 07:45:24.000000000 +0000 @@ -1,8 +1,32 @@ -ruby-tilt (2.0.0+really1.4.1-1build1) utopic; urgency=medium +ruby-tilt (2.0.1-2) unstable; urgency=medium - * No-change rebuild to update the Ruby-Version attribute. + * Team upload + * Reupload to unstable (verified reverse dependencies are working) - -- Matthias Klose Wed, 30 Apr 2014 12:06:51 +0000 + -- Pirate Praveen Wed, 13 Jan 2016 13:14:02 +0530 + +ruby-tilt (2.0.1-1) experimental; urgency=medium + + * Team upload + + [ Lucas Nussbaum ] + * Drop myself from Uploaders + + [ Pirate Praveen ] + * New upstream release (stage in experimental to sort reverse dependencies) + * Drop patch: new-test-unit-compatibility.patch (not needed for this version) + * Disable unpackaged dependencies + * Bump standards version to 3.9.6 (no changes) + + [ Balasankar C ] + * Make tests run. + - disable-failing-test.patch: Disable the failing test. + - remove-bundler.patch: Remove usage of bundler during tests. + - set-available-locales.patch: Set available locales during tests. + * Bump debhelper compatibility. + * Add dep3 headers to all patches. + + -- Pirate Praveen Tue, 12 Jan 2016 15:41:34 +0530 ruby-tilt (2.0.0+really1.4.1-1) unstable; urgency=medium diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/compat ruby-tilt-2.0.1/debian/compat --- ruby-tilt-2.0.0+really1.4.1/debian/compat 2014-02-23 15:06:18.000000000 +0000 +++ ruby-tilt-2.0.1/debian/compat 2016-01-12 05:53:57.000000000 +0000 @@ -1 +1 @@ -7 +9 diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/control ruby-tilt-2.0.1/debian/control --- ruby-tilt-2.0.0+really1.4.1/debian/control 2014-02-23 15:15:57.000000000 +0000 +++ ruby-tilt-2.0.1/debian/control 2016-01-12 05:53:57.000000000 +0000 @@ -2,17 +2,20 @@ Section: ruby Priority: optional Maintainer: Debian Ruby Extras Maintainers -Uploaders: Lucas Nussbaum , Youhei SASAKI -Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.3.0~), rake, - ruby-test-unit, - ruby-coffee-script, - ruby-contest, - ruby-creole, - ruby-erubis, - ruby-haml, - ruby-nokogiri, - ruby-yajl -Standards-Version: 3.9.5 +Uploaders: Youhei SASAKI +Build-Depends: debhelper (>= 9.0), + gem2deb (>= 0.3.0~), + rake, + ruby-coffee-script, + ruby-contest, + ruby-creole, + ruby-erubis, + ruby-haml, + ruby-i18n, + ruby-nokogiri, + ruby-test-unit, + ruby-yajl +Standards-Version: 3.9.6 Vcs-Git: git://anonscm.debian.org/pkg-ruby-extras/ruby-tilt.git Vcs-Browser: http://anonscm.debian.org/gitweb?p=pkg-ruby-extras/ruby-tilt.git;a=summary Homepage: http://github.com/rtomayko/tilt/ @@ -21,7 +24,7 @@ Package: ruby-tilt Architecture: all XB-Ruby-Versions: ${ruby:Versions} -Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter +Depends: ruby | ruby-interpreter, ${misc:Depends}, ${shlibs:Depends} Description: Generic interface to multiple Ruby template engines Tilt is a thin interface over a bunch of different Ruby template engines in an attempt to make their usage as generic possible. This is useful for web diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/copyright ruby-tilt-2.0.1/debian/copyright --- ruby-tilt-2.0.0+really1.4.1/debian/copyright 2014-02-23 15:06:18.000000000 +0000 +++ ruby-tilt-2.0.1/debian/copyright 2016-01-12 05:53:57.000000000 +0000 @@ -27,5 +27,3 @@ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/patches/disable-failing-test.patch ruby-tilt-2.0.1/debian/patches/disable-failing-test.patch --- ruby-tilt-2.0.0+really1.4.1/debian/patches/disable-failing-test.patch 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/debian/patches/disable-failing-test.patch 2016-01-12 05:53:57.000000000 +0000 @@ -0,0 +1,24 @@ +Description: Disable a failing test + One of the tests fail in a weird way, which may be attributed to the fact that + upstream nokogiri uses a patched libxml2. Disabled it. +Author: Balasankar C +Last-Update: 2016-01-11 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/test/tilt_asciidoctor_test.rb ++++ b/test/tilt_asciidoctor_test.rb +@@ -29,10 +29,10 @@ + assert_equal HTML5_OUTPUT, strip_space(template.render) + end + +- test "preparing and evaluating docbook templates on #render" do +- template = Tilt::AsciidoctorTemplate.new(:attributes => {"backend" => 'docbook'}) { |t| "== Hello World!" } +- assert_equal DOCBOOK_OUTPUT, strip_space(template.render) +- end ++ #test "preparing and evaluating docbook templates on #render" do ++ #template = Tilt::AsciidoctorTemplate.new(:attributes => {"backend" => 'docbook'}) { |t| "== Hello World!" } ++ #assert_equal DOCBOOK_OUTPUT, strip_space(template.render) ++ #end + + test "can be rendered more than once" do + template = Tilt::AsciidoctorTemplate.new(:attributes => {"backend" => 'html5'}) { |t| "== Hello World!" } diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/patches/disable-less.patch ruby-tilt-2.0.1/debian/patches/disable-less.patch --- ruby-tilt-2.0.0+really1.4.1/debian/patches/disable-less.patch 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/debian/patches/disable-less.patch 2016-01-12 05:53:57.000000000 +0000 @@ -0,0 +1,15 @@ +Description: Disable requirement of less gem which is not yet packaged +Author: Pirate Praveen +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/Gemfile ++++ b/Gemfile +@@ -14,7 +14,7 @@ + gem 'erubis' + gem 'haml', '>= 2.2.11', '< 5' + gem 'kramdown' +- gem 'less' ++# gem 'less' + gem 'liquid' + gem 'markaby' + gem 'maruku' diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/patches/disable-markaby.patch ruby-tilt-2.0.1/debian/patches/disable-markaby.patch --- ruby-tilt-2.0.0+really1.4.1/debian/patches/disable-markaby.patch 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/debian/patches/disable-markaby.patch 2016-01-12 05:53:57.000000000 +0000 @@ -0,0 +1,15 @@ +Description: Disable requirement of markaby gem which is not yet packaged +Author: Pirate Praveen +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/Gemfile ++++ b/Gemfile +@@ -16,7 +16,7 @@ + gem 'kramdown' + # gem 'less' + gem 'liquid' +- gem 'markaby' ++# gem 'markaby' + gem 'maruku' + gem 'nokogiri' if RUBY_VERSION > '1.9.2' + gem 'radius' diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/patches/disable-radius.patch ruby-tilt-2.0.1/debian/patches/disable-radius.patch --- ruby-tilt-2.0.0+really1.4.1/debian/patches/disable-radius.patch 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/debian/patches/disable-radius.patch 2016-01-12 05:53:57.000000000 +0000 @@ -0,0 +1,15 @@ +Description: Disable requirement of radius gem which is not yet packaged +Author: Pirate Praveen +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/Gemfile ++++ b/Gemfile +@@ -19,7 +19,7 @@ + # gem 'markaby' + gem 'maruku' + gem 'nokogiri' if RUBY_VERSION > '1.9.2' +- gem 'radius' ++# gem 'radius' + gem 'sass' + gem 'rdoc', (ENV['RDOC_VERSION'] || '> 0') + diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/patches/disable-therubyracer.patch ruby-tilt-2.0.1/debian/patches/disable-therubyracer.patch --- ruby-tilt-2.0.0+really1.4.1/debian/patches/disable-therubyracer.patch 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/debian/patches/disable-therubyracer.patch 2016-01-12 05:53:57.000000000 +0000 @@ -0,0 +1,15 @@ +Description: Disable requirement of therubyracer gem which is not yet packaged +Author: Pirate Praveen +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/Gemfile ++++ b/Gemfile +@@ -32,7 +32,7 @@ + end + + platform :mri do +- gem 'therubyracer' ++# gem 'therubyracer' + gem 'bluecloth' if ENV['BLUECLOTH'] + end + end diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/patches/force_encoding_erb_test ruby-tilt-2.0.1/debian/patches/force_encoding_erb_test --- ruby-tilt-2.0.0+really1.4.1/debian/patches/force_encoding_erb_test 2014-02-23 15:10:35.000000000 +0000 +++ ruby-tilt-2.0.1/debian/patches/force_encoding_erb_test 2015-12-23 13:33:52.000000000 +0000 @@ -9,12 +9,15 @@ Forwarded: https://github.com/rtomayko/tilt/pull/97 Last-Update: 2013-07-22 ---- ruby-tilt-1.4.1.orig/test/tilt_template_test.rb -+++ ruby-tilt-1.4.1/test/tilt_template_test.rb -@@ -1,3 +1,6 @@ +Index: ruby-tilt/test/tilt_template_test.rb +=================================================================== +--- ruby-tilt.orig/test/tilt_template_test.rb ++++ ruby-tilt/test/tilt_template_test.rb +@@ -1,4 +1,7 @@ # coding: utf-8 +if RUBY_VERSION >= '1.9.1' + Encoding.default_external = "UTF-8" +end - require 'contest' + require 'test_helper' require 'tilt' + require 'tilt/template' diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/patches/new-test-unit-compatibility.patch ruby-tilt-2.0.1/debian/patches/new-test-unit-compatibility.patch --- ruby-tilt-2.0.0+really1.4.1/debian/patches/new-test-unit-compatibility.patch 2014-02-23 15:32:17.000000000 +0000 +++ ruby-tilt-2.0.1/debian/patches/new-test-unit-compatibility.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -Description: compatibility with latest test-unit - This patch will not be needed after this upstream version since upstream have - moved to minitest. -Author: Antonio Terceiro -Origin: vendor -Forwarded: not-needed - ---- ruby-tilt-2.0.0+really1.4.1.orig/test/contest.rb -+++ ruby-tilt-2.0.0+really1.4.1/test/contest.rb -@@ -46,6 +46,14 @@ class Test::Unit::TestCase - alias_method :describe, :context - end - -+ def assert_not_match(v1, v2, *anything_else) -+ if v1.is_a?(String) -+ super(Regexp.new(Regexp.escape(v1)), v2, *anything_else) -+ else -+ super -+ end -+ end -+ - private - - def self.context_name(name) diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/patches/relax-haml-version.patch ruby-tilt-2.0.1/debian/patches/relax-haml-version.patch --- ruby-tilt-2.0.0+really1.4.1/debian/patches/relax-haml-version.patch 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/debian/patches/relax-haml-version.patch 2016-01-12 05:53:57.000000000 +0000 @@ -0,0 +1,15 @@ +Description: Relax the requirement on haml gem +Author: Pirate Praveen +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/Gemfile ++++ b/Gemfile +@@ -12,7 +12,7 @@ + gem 'contest' + gem 'creole' + gem 'erubis' +- gem 'haml', '>= 2.2.11', '< 4' ++ gem 'haml', '>= 2.2.11', '< 5' + gem 'kramdown' + gem 'less' + gem 'liquid' diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/patches/remove-bundler.patch ruby-tilt-2.0.1/debian/patches/remove-bundler.patch --- ruby-tilt-2.0.0+really1.4.1/debian/patches/remove-bundler.patch 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/debian/patches/remove-bundler.patch 2016-01-12 05:53:57.000000000 +0000 @@ -0,0 +1,17 @@ +Description: Remove the use of bundler while running tests +Author: Balasankar C +Last-Update: 2016-01-11 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/test/test_helper.rb ++++ b/test/test_helper.rb +@@ -1,7 +1,7 @@ + $LOAD_PATH << File.expand_path('../../lib', __FILE__) + +-require 'bundler' +-Bundler.setup ++#require 'bundler' ++#Bundler.setup + + require 'minitest/autorun' + require 'minitest/mock' diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/patches/series ruby-tilt-2.0.1/debian/patches/series --- ruby-tilt-2.0.0+really1.4.1/debian/patches/series 2014-02-23 15:30:52.000000000 +0000 +++ ruby-tilt-2.0.1/debian/patches/series 2016-01-12 05:53:57.000000000 +0000 @@ -1,2 +1,9 @@ force_encoding_erb_test -new-test-unit-compatibility.patch +relax-haml-version.patch +disable-less.patch +disable-markaby.patch +disable-radius.patch +disable-therubyracer.patch +remove-bundler.patch +set-available-locales.patch +disable-failing-test.patch diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/patches/set-available-locales.patch ruby-tilt-2.0.1/debian/patches/set-available-locales.patch --- ruby-tilt-2.0.0+really1.4.1/debian/patches/set-available-locales.patch 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/debian/patches/set-available-locales.patch 2016-01-12 05:53:57.000000000 +0000 @@ -0,0 +1,16 @@ +Description: Set available locales for tests +Author: Balasankar C +Last-Update: 2016-01-11 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/test/test_helper.rb ++++ b/test/test_helper.rb +@@ -5,6 +5,8 @@ + + require 'minitest/autorun' + require 'minitest/mock' ++require 'i18n' ++I18n.available_locales = :en + + # Contest adds +teardown+, +test+ and +context+ as class methods, and the + # instance methods +setup+ and +teardown+ now iterate on the corresponding diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/ruby-tests.rake ruby-tilt-2.0.1/debian/ruby-tests.rake --- ruby-tilt-2.0.0+really1.4.1/debian/ruby-tests.rake 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/debian/ruby-tests.rake 2016-01-12 05:53:57.000000000 +0000 @@ -0,0 +1,7 @@ +require 'gem2deb/rake/testtask' + +Gem2Deb::Rake::TestTask.new do |t| + t.libs << 'lib' << 'test' + t.test_files = FileList['test/*_test.rb'] +end + diff -Nru ruby-tilt-2.0.0+really1.4.1/debian/ruby-tests.rb ruby-tilt-2.0.1/debian/ruby-tests.rb --- ruby-tilt-2.0.0+really1.4.1/debian/ruby-tests.rb 2014-02-23 15:06:18.000000000 +0000 +++ ruby-tilt-2.0.1/debian/ruby-tests.rb 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -$: << 'lib' << 'test' << '.' -Dir['test/**/*.rb'].each { |f| require f } diff -Nru ruby-tilt-2.0.0+really1.4.1/docs/common.css ruby-tilt-2.0.1/docs/common.css --- ruby-tilt-2.0.0+really1.4.1/docs/common.css 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/docs/common.css 2014-04-13 21:18:29.000000000 +0000 @@ -0,0 +1,14 @@ +body { + line-height: 1.5; + font-size: 14px; +} + +.frames #content { + margin: 0; +} + +#content { + margin: 0 auto; + max-width: 720px; +} + diff -Nru ruby-tilt-2.0.0+really1.4.1/docs/TEMPLATES.md ruby-tilt-2.0.1/docs/TEMPLATES.md --- ruby-tilt-2.0.0+really1.4.1/docs/TEMPLATES.md 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/docs/TEMPLATES.md 2014-04-13 21:18:29.000000000 +0000 @@ -0,0 +1,523 @@ +Tilt Templates +============== + +(See for a rendered, +HTML-version of this file). + +While all Tilt templates use the same basic interface for template loading and +evaluation, each varies in its capabilities and available options. Detailed +documentation on each supported template engine is provided below. + +There are also some file extensions that have several implementations +(currently ERB and Markdown). These template classes have certain features +which are guaranteed to work across all the implementations. If you wish to be +compatible with all of these template classes, you should only depend on the +cross-implementation features. + + * [ERB](#erb) - Generic ERB implementation (backed by erb.rb or Erubis) + * [erb.rb](#erbrb) - `Tilt::ERBTemplate` + * [Erubis](#erubis) - `Tilt::ErubisTemplate` + * [Haml](#haml) - `Tilt::HamlTemplate` + * [Liquid](#liquid) - `Tilt::LiquidTemplate` + * Nokogiri - `Tilt::NokogiriTemplate` + * Builder - `Tilt::BuilderTemplate` + * Markaby - `Tilt::MarkabyTemplate` + * [Radius](#radius) - `Tilt::RadiusTemplate` + +Tilt also includes support for CSS processors like [LessCSS][lesscss] and +[Sass][sass], [CoffeeScript][coffee-script] and some simple text formats. + + * Less - `Tilt::LessTemplate` + * Sass - `Tilt::SassTemplate` + * Scss - `Tilt::ScssTemplate` + * CoffeeScript - `Tilt::CoffeeScriptTemplate` + * [Textile](#redcloth) - `Tilt::RedClothTemplate` + * Creole - `Tilt::CreoleTemplate` + * [RDoc](#rdoc) - `Tilt::RDocTemplate` + +Tilt has extensive support for Markdown, backed by one of four different +implementations (depending on which are available on your system): + + * [Markdown](#markdown) - Generic Markdown implementation + * [RDiscount](#rdiscount) - `Tilt::RDiscountTemplate` + * Redcarpet - `Tilt::RedcarpetTemplate` + * BlueCloth - `Tilt::BlueClothTemplate` + * Kramdown - `Tilt::KramdownTemplate` + * Maruku - `Tilt::MarukuTemplate` + + +ERB (`erb`, `rhtml`) +-------------------- + +ERB is a simple but powerful template languge for Ruby. In Tilt it's backed by +[Erubis](#erubis) (if installed on your system) or by [erb.rb](#erbrb) (which +is included in Ruby's standard library). This documentation applies to both +implementations. + +### Example + + Hello <%= world %>! + +### Usage + +ERB templates support custom evaluation scopes and locals: + + >> require 'erb' + >> template = Tilt.new('hello.html.erb') + >> template.render(self, :world => 'World!') + => "Hello World!" + +Or, use `Tilt['erb']` directly to process strings: + + template = Tilt['erb'].new { "Hello <%= world %>!" } + template.render(self, :world => 'World!') + +### Options + +#### `:trim => trim` + +Omits newlines and spaces around certain lines (usually those that starts with +`<%` and ends with `%>`). There isn't a specification for how trimming in ERB +should work, so if you need more control over the whitespace, you should use +[erb.rb](#erbrb) or [Erubis](#erubis) directly. + + +#### `:outvar => '_erbout'` + +The name of the variable used to accumulate template output. This can be +any valid Ruby expression but must be assignable. By default a local +variable named `_erbout` is used. + + +erb.rb (`erb`, `rhtml`) +----------------------- + +[ERB](#erb) implementation available in Ruby's standard library. + +All the documentation of [ERB](#erb) applies in addition to the following: + +### Usage + +The `Tilt::ERBTemplate` class is registered for all files ending in `.erb` or +`.rhtml` by default, but with a *lower* priority than ErubisTemplate. If you +specifically want to use ERB, it's recommended to use `#prefer`: + + Tilt.prefer Tilt::ERBTemplate + +__NOTE:__ It's suggested that your program `require 'erb'` at load time when +using this template engine within a threaded environment. + +### Options + +#### `:trim => true` + +The ERB trim mode flags. This is a string consisting of any combination of the +following characters: + + * `'>'` omits newlines for lines ending in `>` + * `'<>'` omits newlines for lines starting with `<%` and ending in `%>` + * `'%'` enables processing of lines beginning with `%` + * `true` is an alias of `<>` + +#### `:safe => nil` + +The `$SAFE` level; when set, ERB code will be run in a +separate thread with `$SAFE` set to the provided level. + +#### `:outvar => '_erbout'` + +The name of the variable used to accumulate template output. This can be +any valid Ruby expression but must be assignable. By default a local +variable named `_erbout` is used. + +### See also + + * [ERB documentation](http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html) + + + +Erubis (`erb`, `rhtml`, `erubis`) +--------------------------------- + +[Erubis][erubis] is a fast, secure, and very extensible implementation of [ERB](#erb). + +All the documentation of [ERB](#erb) applies in addition to the following: + +### Usage + +The `Tilt::ErubisTemplate` class is registered for all files ending in `.erb` or +`.rhtml` by default, but with a *higher* priority than `ERBTemplate`. If you +specifically want to use Erubis, it's recommended to use `#prefer`: + + Tilt.prefer Tilt::ErubisTemplate + +__NOTE:__ It's suggested that your program `require 'erubis'` at load time when +using this template engine within a threaded environment. + +### Options + +#### `:engine_class => Erubis::Eruby` + +Allows you to specify a custom engine class to use instead of the +default which is `Erubis::Eruby`. + +#### `:escape_html => false` + +When `true`, `Erubis::EscapedEruby` will be used as the engine class +instead of the default. All content within `<%= %>` blocks will be +automatically html escaped. + +#### `:outvar => '_erbout'` + +The name of the variable used to accumulate template output. This can be +any valid Ruby expression but must be assignable. By default a local +variable named `_erbout` is used. + +#### `:pattern => '<% %>'` + +Set pattern for embedded Ruby code. + +#### `:trim => true` + +Delete spaces around `<% %>`. (But, spaces around `<%= %>` are preserved.) + +### See also + + * [Erubis Home][erubis] + * [Erubis User's Guide](http://www.kuwata-lab.com/erubis/users-guide.html) + + + +Haml (`haml`) +------------- + +[Haml][haml] is a markup language that’s used to cleanly and simply describe +the HTML of any web document without the use of inline code. Haml functions as +a replacement for inline page templating systems such as PHP, ASP, and ERB, the +templating language used in most Ruby on Rails applications. However, Haml +avoids the need for explicitly coding HTML into the template, because it itself +is a description of the HTML, with some code to generate dynamic content. +([more](http://haml.info/about.html)) + + +### Example + + %html + %head + %title= @title + %body + %h1 + Hello + = world + '!' + +### Usage + +The `Tilt::HamlTemplate` class is registered for all files ending in `.haml` +by default. Haml templates support custom evaluation scopes and locals: + + >> require 'haml' + >> template = Tilt.new('hello.haml') + => # + >> @title = "Hello Haml!" + >> template.render(self, :world => 'Haml!') + => " + + + Hello Haml! + + +

Hello Haml!

+ + " + +Or, use the `Tilt::HamlTemplate` class directly to process strings: + + >> require 'haml' + >> template = Tilt::HamlTemplate.new { "%h1= 'Hello Haml!'" } + => # + >> template.render + => "

Hello Haml!

" + +__NOTE:__ It's suggested that your program `require 'haml'` at load time when +using this template engine within a threaded environment. + +### Options + +Please see the [Haml Reference](http://haml.info/docs/yardoc/file.HAML_REFERENCE.html#options) for all available options. + +### See also + + * [#haml.docs](http://haml.info/docs.html) + * [Haml Tutorial](http://haml.info/tutorial.html) + * [Haml Reference](http://haml.info/docs/yardoc/file.HAML_REFERENCE.html) + + + +Liquid (`liquid`) +----------------- + +[Liquid][liquid] is for rendering safe templates which cannot affect the +security of the server they are rendered on. + +### Example + + + + {{ title }} + + +

Hello {{ world }}!

+ + + +### Usage + +`Tilt::LiquidTemplate` is registered for all files ending in `.liquid` by +default. Liquid templates support locals and objects that respond to +`#to_h` as scopes: + + >> require 'liquid' + >> require 'tilt' + >> template = Tilt.new('hello.liquid') + => # + >> scope = { :title => "Hello Liquid Templates" } + >> template.render(nil, :world => "Liquid") + => " + + + Hello Liquid Templates + + +

Hello Liquid!

+ + " + +Or, use `Tilt::LiquidTemplate` directly to process strings: + + >> require 'liquid' + >> template = Tilt::LiquidTemplate.new { "

Hello Liquid!

" } + => # + >> template.render + => "

Hello Liquid!

" + +__NOTE:__ It's suggested that your program `require 'liquid'` at load +time when using this template engine within a threaded environment. + +### See also + + * [Liquid for Programmers](https://wiki.github.com/Shopify/liquid/liquid-for-programmers) + * [Liquid Docs](http://liquid.rubyforge.org/) + * GitHub: [Shopify/liquid](https://github.com/Shopify/liquid/) + + + +Radius (`radius`) +----------------- + +[Radius][radius] is the template language used by [Radiant CMS][radiant]. It is +a tag language designed to be valid XML/HTML. + +### Example + + + +

+
    + +
  • !
  • +
    +
+ + + + +### Usage + +To render a template such as the one above. + + scope = OpenStruct.new + scope.title = "Radius Example" + scope.hello = "Hello, World!" + + require 'radius' + template = Tilt::RadiusTemplate.new('example.radius', :tag_prefix=>'r') + template.render(scope, :type=>'hlist'){ "Jackpot!" } + +The result will be: + + + +

Radius Example

+
    +
  • Hello, World!
  • +
  • Hello, World!
  • +
  • Hello, World!
  • +
+ Jackpot! + + + +### See also + + * [Radius][radius] + * [Radiant CMS][radiant] + + + +Textile (`textile`) +------------------- + +Textile is a lightweight markup language originally developed by Dean Allen and +billed as a "humane Web text generator". Textile converts its marked-up text +input to valid, well-formed XHTML and also inserts character entity references +for apostrophes, opening and closing single and double quotation marks, +ellipses and em dashes. + +Textile formatted texts are converted to HTML with the [RedCloth][redcloth] +engine, which is a Ruby extension written in C. + +### Example + + h1. Hello Textile Templates + + Hello World. This is a paragraph. + +### Usage + +__NOTE:__ It's suggested that your program `require 'redcloth'` at load time +when using this template engine in a threaded environment. + +### See Also + + * [RedCloth][redcloth] + + + +RDoc (`rdoc`) +------------- + +[RDoc][rdoc] is the simple text markup system that comes with Ruby's standard +library. + +### Example + + = Hello RDoc Templates + + Hello World. This is a paragraph. + +### Usage + +__NOTE:__ It's suggested that your program `require 'rdoc'`, +`require 'rdoc/markup'`, and `require 'rdoc/markup/to_html'` at load time +when using this template engine in a threaded environment. + +### See also + + * [RDoc][rdoc] + + + +Markdown (`markdown`, `md`, `mkd`) +---------------------------------- + +[Markdown][markdown] is a lightweight markup language, created by John Gruber +and Aaron Swartz. For any markup that is not covered by Markdown’s syntax, HTML +is used. Marking up plain text with Markdown markup is easy and Markdown +formatted texts are readable. + +Markdown formatted texts are converted to HTML with one of these libraries: + + * [RDiscount](#rdiscount) - `Tilt::RDiscountTemplate` + * Redcarpet - `Tilt::RedcarpetTemplate` + * BlueCloth - `Tilt::BlueClothTemplate` + * Kramdown - `Tilt::KramdownTemplate` + * Maruku - `Tilt::MarukuTemplate` + +Tilt will use fallback mode (as documented in the README) for determining which +library to use. RDiscount has highest priority - Maruku has lowest. + +### Example + + Hello Markdown Templates + ======================== + + Hello World. This is a paragraph. + +### Usage + +To wrap a Markdown formatted document with a layout: + + layout = Tilt['erb'].new do + "<%= yield %>" + end + data = Tilt['md'].new { "# hello tilt" } + layout.render { data.render } + # => "

hello tilt

\n" + +### Options + +Every implementation of Markdown *should* support these options, but there are +some known problems with the Kramdown and Maruku engines. + +#### `:smartypants => true|false` + +Set `true` to enable [Smarty Pants][smartypants] style punctuation replacement. + +In Kramdown this option only applies to smart quotes. It will apply a +subset of Smarty Pants (e.g. `...` to `…`) regardless of any option. + +Maruku ignores this option and always applies smart quotes (and nothing else). + +#### `:escape_html => true|false` + +Set `true` disallow raw HTML in Markdown contents. HTML is converted to +literal text by escaping `<` characters. + +Kramdown and Maruku doesn't support this option. + +### See also + + * [Markdown Syntax Documentation](http://daringfireball.net/projects/markdown/syntax/) + + +RDiscount (`markdown`, `md`, `mkd`) +----------------------------------- + +[Discount][discount] is an implementation of the Markdown markup language in C. +[RDiscount][rdiscount] is a Ruby wrapper around Discount. + +All the documentation of [Markdown](#markdown) applies in addition to the following: + +### Usage + +The `Tilt::RDiscountTemplate` class is registered for all files ending in +`.markdown`, `.md` or `.mkd` by default with the highest priority. If you +specifically want to use RDiscount, it's recommended to use `#prefer`: + + Tilt.prefer Tilt::RDiscountTemplate + +__NOTE:__ It's suggested that your program `require 'erubis'` at load time when +using this template engine within a threaded environment. + +### See also + + * [Discount][discount] + * [RDiscount][rdiscount] + * GitHub: [rtomayko/rdiscount][rdiscount] + + +[lesscss]: http://lesscss.org/ "Less CSS" +[sass]: http://sass-lang.com/ "Sass" +[coffee-script]: http://jashkenas.github.com/coffee-script/ "Coffee Script" +[erubis]: http://www.kuwata-lab.com/erubis/ "Erubis" +[haml]: http://haml.info/ "Haml" +[liquid]: http://www.liquidmarkup.org/ "Liquid" +[radius]: http://radius.rubyforge.org/ "Radius" +[radiant]: http://radiantcms.org/ "Radiant CMS" +[redcloth]: http://redcloth.org/ "RedCloth" +[rdoc]: http://rdoc.rubyforge.org/ "RDoc" +[discount]: http://www.pell.portland.or.us/~orc/Code/discount/ "Discount" +[rdiscount]: http://github.com/rtomayko/rdiscount/ "RDiscount" +[smartypants]: http://daringfireball.net/projects/smartypants/ "Smarty Pants" +[markdown]: http://en.wikipedia.org/wiki/Markdown "Markdown" + diff -Nru ruby-tilt-2.0.0+really1.4.1/Gemfile ruby-tilt-2.0.1/Gemfile --- ruby-tilt-2.0.0+really1.4.1/Gemfile 2013-06-24 20:16:13.000000000 +0000 +++ ruby-tilt-2.0.1/Gemfile 2014-04-13 21:18:29.000000000 +0000 @@ -1,32 +1,44 @@ -source "http://rubygems.org" +source 'https://rubygems.org' + +gem 'yard', '~> 0.8.6' +gem 'minitest', '~> 5.0' gem 'rake' -gem 'asciidoctor', '>= 0.1.0' -gem 'builder' -gem 'coffee-script' -gem 'contest' -gem 'creole' -gem 'erubis' -gem 'haml', '>= 2.2.11', '< 4' -gem 'kramdown' -gem 'less' -gem 'liquid' -gem 'markaby' -gem 'maruku' -gem 'nokogiri' -gem 'radius' -gem 'sass' -gem 'wikicloth' -gem 'rdoc', (ENV['RDOC_VERSION'] || '> 0') - -platform :ruby do - gem 'yajl-ruby' - gem 'redcarpet' - gem 'rdiscount' if RUBY_VERSION != '1.9.2' - gem 'RedCloth' + +group :engines do + gem 'asciidoctor', '>= 0.1.0' + gem 'builder' + gem 'coffee-script' + gem 'contest' + gem 'creole' + gem 'erubis' + gem 'haml', '>= 2.2.11', '< 4' + gem 'kramdown' + gem 'less' + gem 'liquid' + gem 'markaby' + gem 'maruku' + gem 'nokogiri' if RUBY_VERSION > '1.9.2' + gem 'radius' + gem 'sass' + gem 'rdoc', (ENV['RDOC_VERSION'] || '> 0') + + platform :ruby do + gem 'wikicloth' + gem 'yajl-ruby' + gem 'redcarpet' if RUBY_VERSION > '1.8.7' + gem 'rdiscount', '>= 2.1.6' if RUBY_VERSION != '1.9.2' + gem 'RedCloth' + end + + platform :mri do + gem 'therubyracer' + gem 'bluecloth' if ENV['BLUECLOTH'] + end end -platform :mri do - gem 'therubyracer' - gem 'bluecloth' +## WHY do I have to do this?!? +platform :rbx do + gem 'rubysl' end + diff -Nru ruby-tilt-2.0.0+really1.4.1/lib/tilt/asciidoc.rb ruby-tilt-2.0.1/lib/tilt/asciidoc.rb --- ruby-tilt-2.0.0+really1.4.1/lib/tilt/asciidoc.rb 2013-06-24 20:16:13.000000000 +0000 +++ ruby-tilt-2.0.1/lib/tilt/asciidoc.rb 2014-04-13 21:18:29.000000000 +0000 @@ -1,4 +1,5 @@ require 'tilt/template' +require 'asciidoctor' # AsciiDoc see: http://asciidoc.org/ module Tilt @@ -11,14 +12,6 @@ class AsciidoctorTemplate < Template self.default_mime_type = 'text/html' - def self.engine_initialized? - defined? ::Asciidoctor::Document - end - - def initialize_engine - require_template_library 'asciidoctor' - end - def prepare options[:header_footer] = false if options[:header_footer].nil? end diff -Nru ruby-tilt-2.0.0+really1.4.1/lib/tilt/bluecloth.rb ruby-tilt-2.0.1/lib/tilt/bluecloth.rb --- ruby-tilt-2.0.0+really1.4.1/lib/tilt/bluecloth.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/lib/tilt/bluecloth.rb 2014-04-13 21:18:29.000000000 +0000 @@ -0,0 +1,24 @@ +require 'tilt/template' +require 'bluecloth' + +module Tilt + # BlueCloth Markdown implementation. See: + # http://deveiate.org/projects/BlueCloth/ + class BlueClothTemplate < Template + self.default_mime_type = 'text/html' + + def prepare + @engine = BlueCloth.new(data, options) + @output = nil + end + + def evaluate(scope, locals, &block) + @output ||= @engine.to_html + end + + def allows_script? + false + end + end +end + diff -Nru ruby-tilt-2.0.0+really1.4.1/lib/tilt/builder.rb ruby-tilt-2.0.1/lib/tilt/builder.rb --- ruby-tilt-2.0.0+really1.4.1/lib/tilt/builder.rb 2013-06-24 20:16:13.000000000 +0000 +++ ruby-tilt-2.0.1/lib/tilt/builder.rb 2014-04-13 21:18:29.000000000 +0000 @@ -1,4 +1,5 @@ require 'tilt/template' +require 'builder' module Tilt # Builder template implementation. See: @@ -6,14 +7,6 @@ class BuilderTemplate < Template self.default_mime_type = 'text/xml' - def self.engine_initialized? - defined? ::Builder - end - - def initialize_engine - require_template_library 'builder' - end - def prepare; end def evaluate(scope, locals, &block) diff -Nru ruby-tilt-2.0.0+really1.4.1/lib/tilt/coffee.rb ruby-tilt-2.0.1/lib/tilt/coffee.rb --- ruby-tilt-2.0.0+really1.4.1/lib/tilt/coffee.rb 2013-06-24 20:16:13.000000000 +0000 +++ ruby-tilt-2.0.1/lib/tilt/coffee.rb 2014-04-13 21:18:29.000000000 +0000 @@ -1,4 +1,5 @@ require 'tilt/template' +require 'coffee_script' module Tilt # CoffeeScript template implementation. See: @@ -28,14 +29,6 @@ @@default_bare = value end - def self.engine_initialized? - defined? ::CoffeeScript - end - - def initialize_engine - require_template_library 'coffee_script' - end - def prepare if !options.key?(:bare) and !options.key?(:no_wrap) options[:bare] = self.class.default_bare diff -Nru ruby-tilt-2.0.0+really1.4.1/lib/tilt/creole.rb ruby-tilt-2.0.1/lib/tilt/creole.rb --- ruby-tilt-2.0.0+really1.4.1/lib/tilt/creole.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/lib/tilt/creole.rb 2014-04-13 21:18:29.000000000 +0000 @@ -0,0 +1,25 @@ +require 'tilt/template' +require 'creole' + +module Tilt + # Creole implementation. See: + # http://www.wikicreole.org/ + class CreoleTemplate < Template + def prepare + opts = {} + [:allowed_schemes, :extensions, :no_escape].each do |k| + opts[k] = options[k] if options[k] + end + @engine = Creole::Parser.new(data, opts) + @output = nil + end + + def evaluate(scope, locals, &block) + @output ||= @engine.to_html + end + + def allows_script? + false + end + end +end diff -Nru ruby-tilt-2.0.0+really1.4.1/lib/tilt/css.rb ruby-tilt-2.0.1/lib/tilt/css.rb --- ruby-tilt-2.0.0+really1.4.1/lib/tilt/css.rb 2013-06-24 20:16:13.000000000 +0000 +++ ruby-tilt-2.0.1/lib/tilt/css.rb 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -require 'tilt/template' - -module Tilt - # Sass template implementation. See: - # http://haml.hamptoncatlin.com/ - # - # Sass templates do not support object scopes, locals, or yield. - class SassTemplate < Template - self.default_mime_type = 'text/css' - - def self.engine_initialized? - defined? ::Sass::Engine - end - - def initialize_engine - require_template_library 'sass' - end - - def prepare - @engine = ::Sass::Engine.new(data, sass_options) - end - - def evaluate(scope, locals, &block) - @output ||= @engine.render - end - - def allows_script? - false - end - - private - def sass_options - options.merge(:filename => eval_file, :line => line, :syntax => :sass) - end - end - - # Sass's new .scss type template implementation. - class ScssTemplate < SassTemplate - self.default_mime_type = 'text/css' - - private - def sass_options - options.merge(:filename => eval_file, :line => line, :syntax => :scss) - end - end - - # Lessscss template implementation. See: - # http://lesscss.org/ - # - # Less templates do not support object scopes, locals, or yield. - class LessTemplate < Template - self.default_mime_type = 'text/css' - - def self.engine_initialized? - defined? ::Less - end - - def initialize_engine - require_template_library 'less' - end - - def prepare - if ::Less.const_defined? :Engine - @engine = ::Less::Engine.new(data) - else - parser = ::Less::Parser.new(options.merge :filename => eval_file, :line => line) - @engine = parser.parse(data) - end - end - - def evaluate(scope, locals, &block) - @output ||= @engine.to_css(options) - end - - def allows_script? - false - end - end -end - diff -Nru ruby-tilt-2.0.0+really1.4.1/lib/tilt/csv.rb ruby-tilt-2.0.1/lib/tilt/csv.rb --- ruby-tilt-2.0.0+really1.4.1/lib/tilt/csv.rb 2013-06-24 20:16:13.000000000 +0000 +++ ruby-tilt-2.0.1/lib/tilt/csv.rb 2014-04-13 21:18:29.000000000 +0000 @@ -1,5 +1,11 @@ require 'tilt/template' +if RUBY_VERSION >= '1.9.0' + require 'csv' +else + require 'fastercsv' +end + module Tilt # CSV Template implementation. See: @@ -30,10 +36,6 @@ class CSVTemplate < Template self.default_mime_type = 'text/csv' - def self.engine_initialized? - engine - end - def self.engine if RUBY_VERSION >= '1.9.0' && defined? ::CSV ::CSV @@ -42,14 +44,6 @@ end end - def initialize_engine - if RUBY_VERSION >= '1.9.0' - require_template_library 'csv' - else - require_template_library 'fastercsv' - end - end - def prepare @code =<<-RUBY #{self.class.engine}.generate do |csv| @@ -68,4 +62,4 @@ end end -end \ No newline at end of file +end diff -Nru ruby-tilt-2.0.0+really1.4.1/lib/tilt/erb.rb ruby-tilt-2.0.1/lib/tilt/erb.rb --- ruby-tilt-2.0.0+really1.4.1/lib/tilt/erb.rb 2013-06-24 20:16:13.000000000 +0000 +++ ruby-tilt-2.0.1/lib/tilt/erb.rb 2014-04-13 21:18:29.000000000 +0000 @@ -1,4 +1,5 @@ require 'tilt/template' +require 'erb' module Tilt # ERB template implementation. See: @@ -11,17 +12,10 @@ end def self.default_output_variable=(name) + warn "#{self}.default_output_variable= has been replaced with the :outvar-option" @@default_output_variable = name end - def self.engine_initialized? - defined? ::ERB - end - - def initialize_engine - require_template_library 'erb' - end - def prepare @outvar = options[:outvar] || self.class.default_output_variable options[:trim] = '<>' if !(options[:trim] == false) && (options[:trim].nil? || options[:trim] == true) @@ -59,52 +53,5 @@ end end end - - # Erubis template implementation. See: - # http://www.kuwata-lab.com/erubis/ - # - # ErubisTemplate supports the following additional options, which are not - # passed down to the Erubis engine: - # - # :engine_class allows you to specify a custom engine class to use - # instead of the default (which is ::Erubis::Eruby). - # - # :escape_html when true, ::Erubis::EscapedEruby will be used as - # the engine class instead of the default. All content - # within <%= %> blocks will be automatically html escaped. - class ErubisTemplate < ERBTemplate - def self.engine_initialized? - defined? ::Erubis::Eruby - end - - def initialize_engine - require_template_library 'erubis' - end - - def prepare - @outvar = options.delete(:outvar) || self.class.default_output_variable - @options.merge!(:preamble => false, :postamble => false, :bufvar => @outvar) - engine_class = options.delete(:engine_class) - engine_class = ::Erubis::EscapedEruby if options.delete(:escape_html) - @engine = (engine_class || ::Erubis::Eruby).new(data, options) - end - - def precompiled_preamble(locals) - [super, "#{@outvar} = _buf = ''"].join("\n") - end - - def precompiled_postamble(locals) - [@outvar, super].join("\n") - end - - # Erubis doesn't have ERB's line-off-by-one under 1.9 problem. - # Override and adjust back. - if RUBY_VERSION >= '1.9.0' - def precompiled(locals) - source, offset = super - [source, offset - 1] - end - end - end end diff -Nru ruby-tilt-2.0.0+really1.4.1/lib/tilt/erubis.rb ruby-tilt-2.0.1/lib/tilt/erubis.rb --- ruby-tilt-2.0.0+really1.4.1/lib/tilt/erubis.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/lib/tilt/erubis.rb 2014-04-13 21:18:29.000000000 +0000 @@ -0,0 +1,43 @@ +require 'tilt/erb' +require 'erubis' + +module Tilt + # Erubis template implementation. See: + # http://www.kuwata-lab.com/erubis/ + # + # ErubisTemplate supports the following additional options, which are not + # passed down to the Erubis engine: + # + # :engine_class allows you to specify a custom engine class to use + # instead of the default (which is ::Erubis::Eruby). + # + # :escape_html when true, ::Erubis::EscapedEruby will be used as + # the engine class instead of the default. All content + # within <%= %> blocks will be automatically html escaped. + class ErubisTemplate < ERBTemplate + def prepare + @outvar = options.delete(:outvar) || self.class.default_output_variable + @options.merge!(:preamble => false, :postamble => false, :bufvar => @outvar) + engine_class = options.delete(:engine_class) + engine_class = ::Erubis::EscapedEruby if options.delete(:escape_html) + @engine = (engine_class || ::Erubis::Eruby).new(data, options) + end + + def precompiled_preamble(locals) + [super, "#{@outvar} = _buf = ''"].join("\n") + end + + def precompiled_postamble(locals) + [@outvar, super].join("\n") + end + + # Erubis doesn't have ERB's line-off-by-one under 1.9 problem. + # Override and adjust back. + if RUBY_VERSION >= '1.9.0' + def precompiled(locals) + source, offset = super + [source, offset - 1] + end + end + end +end diff -Nru ruby-tilt-2.0.0+really1.4.1/lib/tilt/haml.rb ruby-tilt-2.0.1/lib/tilt/haml.rb --- ruby-tilt-2.0.0+really1.4.1/lib/tilt/haml.rb 2013-06-24 20:16:13.000000000 +0000 +++ ruby-tilt-2.0.1/lib/tilt/haml.rb 2014-04-13 21:18:29.000000000 +0000 @@ -1,4 +1,5 @@ require 'tilt/template' +require 'haml' module Tilt # Haml template implementation. See: @@ -6,14 +7,6 @@ class HamlTemplate < Template self.default_mime_type = 'text/html' - def self.engine_initialized? - defined? ::Haml::Engine - end - - def initialize_engine - require_template_library 'haml' - end - def prepare options = @options.merge(:filename => eval_file, :line => line) @engine = ::Haml::Engine.new(data, options) diff -Nru ruby-tilt-2.0.0+really1.4.1/lib/tilt/kramdown.rb ruby-tilt-2.0.1/lib/tilt/kramdown.rb --- ruby-tilt-2.0.0+really1.4.1/lib/tilt/kramdown.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/lib/tilt/kramdown.rb 2014-04-13 21:18:29.000000000 +0000 @@ -0,0 +1,33 @@ +require 'tilt/template' +require 'kramdown' + +module Tilt + # Kramdown Markdown implementation. See: + # http://kramdown.rubyforge.org/ + class KramdownTemplate < Template + DUMB_QUOTES = [39, 39, 34, 34] + + def self.engine_initialized? + defined? ::Kramdown + end + + def initialize_engine + require_template_library 'kramdown' + end + + def prepare + options[:smart_quotes] = DUMB_QUOTES unless options[:smartypants] + @engine = Kramdown::Document.new(data, options) + @output = nil + end + + def evaluate(scope, locals, &block) + @output ||= @engine.to_html + end + + def allows_script? + false + end + end +end + diff -Nru ruby-tilt-2.0.0+really1.4.1/lib/tilt/less.rb ruby-tilt-2.0.1/lib/tilt/less.rb --- ruby-tilt-2.0.0+really1.4.1/lib/tilt/less.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/lib/tilt/less.rb 2014-04-13 21:18:29.000000000 +0000 @@ -0,0 +1,38 @@ +require 'tilt/template' +require 'less' + +module Tilt + # Lessscss template implementation. See: + # http://lesscss.org/ + # + # Less templates do not support object scopes, locals, or yield. + class LessTemplate < Template + self.default_mime_type = 'text/css' + + def self.engine_initialized? + defined? ::Less + end + + def initialize_engine + require_template_library 'less' + end + + def prepare + if ::Less.const_defined? :Engine + @engine = ::Less::Engine.new(data) + else + parser = ::Less::Parser.new(options.merge :filename => eval_file, :line => line) + @engine = parser.parse(data) + end + end + + def evaluate(scope, locals, &block) + @output ||= @engine.to_css(options) + end + + def allows_script? + false + end + end +end + diff -Nru ruby-tilt-2.0.0+really1.4.1/lib/tilt/liquid.rb ruby-tilt-2.0.1/lib/tilt/liquid.rb --- ruby-tilt-2.0.0+really1.4.1/lib/tilt/liquid.rb 2013-06-24 20:16:13.000000000 +0000 +++ ruby-tilt-2.0.1/lib/tilt/liquid.rb 2014-04-13 21:18:29.000000000 +0000 @@ -1,4 +1,5 @@ require 'tilt/template' +require 'liquid' module Tilt # Liquid template implementation. See: @@ -15,14 +16,6 @@ # It's suggested that your program require 'liquid' at load # time when using this template engine. class LiquidTemplate < Template - def self.engine_initialized? - defined? ::Liquid::Template - end - - def initialize_engine - require_template_library 'liquid' - end - def prepare @engine = ::Liquid::Template.parse(data) end diff -Nru ruby-tilt-2.0.0+really1.4.1/lib/tilt/mapping.rb ruby-tilt-2.0.1/lib/tilt/mapping.rb --- ruby-tilt-2.0.0+really1.4.1/lib/tilt/mapping.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-tilt-2.0.1/lib/tilt/mapping.rb 2014-04-13 21:18:29.000000000 +0000 @@ -0,0 +1,265 @@ +module Tilt + # Tilt::Mapping associates file extensions with template implementations. + # + # mapping = Tilt::Mapping.new + # mapping.register(Tilt::RDocTemplate, 'rdoc') + # mapping['index.rdoc'] # => Tilt::RDocTemplate + # mapping.new('index.rdoc').render + # + # You can use {#register} to register a template class by file + # extension, {#registered?} to see if a file extension is mapped, + # {#[]} to lookup template classes, and {#new} to instantiate template + # objects. + # + # Mapping also supports *lazy* template implementations. Note that regularly + # registered template implementations *always* have preference over lazily + # registered template implementations. You should use {#register} if you + # depend on a specific template implementation and {#register_lazy} if there + # are multiple alternatives. + # + # mapping = Tilt::Mapping.new + # mapping.register_lazy('RDiscount::Template', 'rdiscount/template', 'md') + # mapping['index.md'] + # # => RDiscount::Template + # + # {#register_lazy} takes a class name, a filename, and a list of file + # extensions. When you try to lookup a template name that matches the + # file extension, Tilt will automatically try to require the filename and + # constantize the class name. + # + # Unlike {#register}, there can be multiple template implementations + # registered lazily to the same file extension. Tilt will attempt to load the + # template implementations in order (registered *last* would be tried first), + # returning the first which doesn't raise LoadError. + # + # If all of the registered template implementations fails, Tilt will raise + # the exception of the first, since that was the most preferred one. + # + # mapping = Tilt::Mapping.new + # mapping.register_lazy('Bluecloth::Template', 'bluecloth/template', 'md') + # mapping.register_lazy('RDiscount::Template', 'rdiscount/template', 'md') + # mapping['index.md'] + # # => RDiscount::Template + # + # In the previous example we say that RDiscount has a *higher priority* than + # BlueCloth. Tilt will first try to `require "rdiscount/template"`, falling + # back to `require "bluecloth/template"`. If none of these are successful, + # the first error will be raised. + class Mapping + # @private + attr_reader :lazy_map, :template_map + + def initialize + @template_map = Hash.new + @lazy_map = Hash.new { |h, k| h[k] = [] } + end + + # @private + def initialize_copy(other) + @template_map = other.template_map.dup + @lazy_map = other.lazy_map.dup + end + + # Registrers a lazy template implementation by file extension. You + # can have multiple lazy template implementations defined on the + # same file extension, in which case the template implementation + # defined *last* will be attempted loaded *first*. + # + # @param class_name [String] Class name of a template class. + # @param file [String] Filename where the template class is defined. + # @param extensions [Array] List of extensions. + # @return [void] + # + # @example + # mapping.register_lazy 'MyEngine::Template', 'my_engine/template', 'mt' + # + # defined?(MyEngine::Template) # => false + # mapping['index.mt'] # => MyEngine::Template + # defined?(MyEngine::Template) # => true + def register_lazy(class_name, file, *extensions) + # Internal API + if class_name.is_a?(Symbol) + Tilt.autoload class_name, file + class_name = "Tilt::#{class_name}" + end + + extensions.each do |ext| + @lazy_map[ext].unshift([class_name, file]) + end + end + + # Registers a template implementation by file extension. There can only be + # one template implementation per file extension, and this method will + # override any existing mapping. + # + # @param template_class + # @param extensions [Array] List of extensions. + # @return [void] + # + # @example + # mapping.register MyEngine::Template, 'mt' + # mapping['index.mt'] # => MyEngine::Template + def register(template_class, *extensions) + if template_class.respond_to?(:to_str) + # Support register(ext, template_class) too + extensions, template_class = [template_class], extensions[0] + end + + extensions.each do |ext| + @template_map[ext.to_s] = template_class + end + end + + # Checks if a file extension is registered (either eagerly or + # lazily) in this mapping. + # + # @param ext [String] File extension. + # + # @example + # mapping.registered?('erb') # => true + # mapping.registered?('nope') # => false + def registered?(ext) + @template_map.has_key?(ext.downcase) or lazy?(ext) + end + + # Instantiates a new template class based on the file. + # + # @raise [RuntimeError] if there is no template class registered for the + # file name. + # + # @example + # mapping.new('index.mt') # => instance of MyEngine::Template + # + # @see Tilt::Template.new + def new(file, line=nil, options={}, &block) + if template_class = self[file] + template_class.new(file, line, options, &block) + else + fail "No template engine registered for #{File.basename(file)}" + end + end + + # Looks up a template class based on file name and/or extension. + # + # @example + # mapping['views/hello.erb'] # => Tilt::ERBTemplate + # mapping['hello.erb'] # => Tilt::ERBTemplate + # mapping['erb'] # => Tilt::ERBTemplate + # + # @return [template class] + def [](file) + _, ext = split(file) + ext && lookup(ext) + end + + alias template_for [] + + # Looks up a list of template classes based on file name. If the file name + # has multiple extensions, it will return all template classes matching the + # extensions from the end. + # + # @example + # mapping.templates_for('views/index.haml.erb') + # # => [Tilt::ERBTemplate, Tilt::HamlTemplate] + # + # @return [Array