Hello community, here is the log from the commit of package rubygem-tilt for openSUSE:Factory checked in at 2017-04-12 17:31:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-tilt (Old) and /work/SRC/openSUSE:Factory/.rubygem-tilt.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-tilt" Wed Apr 12 17:31:31 2017 rev:17 rq:481713 version:2.0.7 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-tilt/rubygem-tilt.changes 2016-06-19 10:48:21.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-tilt.new/rubygem-tilt.changes 2017-04-12 18:22:47.258202934 +0200 @@ -1,0 +2,29 @@ +Mon Mar 20 05:38:11 UTC 2017 - [email protected] + +- updated to version 2.0.7 + see installed CHANGELOG.md + + ## 2.0.7 (2017-03-19) + + * Do not modify BasicObject during template compilation on ruby 2.0+ (#309, jeremyevans) + +------------------------------------------------------------------- +Fri Jan 27 05:46:55 UTC 2017 - [email protected] + +- updated to version 2.0.6 + see installed CHANGELOG.md + + ## 2.0.6 (2017-01-26) + + * Add support for LiveScript (#286, @Announcement Jacob Francis Powers) + * Add support for Sigil (#302, winebarrel) + * Add support for Erubi (#308, jeremyevans) + * Add support for options in Liquid (#298, #299, laCour) + * Always sort locals by strings (#307, jeremyevans) + + * Fix test warnings (#305, amatsuda) + * Fix indentation (#293, yui-knk) + * Use SVG badges in README (#294, vasinov) + * Fix typo and trailing space (#295, #296, karloescota) + +------------------------------------------------------------------- Old: ---- tilt-2.0.5.gem New: ---- tilt-2.0.7.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-tilt.spec ++++++ --- /var/tmp/diff_new_pack.0DZVDS/_old 2017-04-12 18:22:47.854118667 +0200 +++ /var/tmp/diff_new_pack.0DZVDS/_new 2017-04-12 18:22:47.854118667 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-tilt # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ # Name: rubygem-tilt -Version: 2.0.5 +Version: 2.0.7 Release: 0 %define mod_name tilt %define mod_full_name %{mod_name}-%{version} ++++++ tilt-2.0.5.gem -> tilt-2.0.7.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 2016-06-02 21:20:05.000000000 +0200 +++ new/CHANGELOG.md 2017-03-19 11:13:33.000000000 +0100 @@ -1,3 +1,20 @@ +## 2.0.7 (2017-03-19) + +* Do not modify BasicObject during template compilation on ruby 2.0+ (#309, jeremyevans) + +## 2.0.6 (2017-01-26) + +* Add support for LiveScript (#286, @Announcement Jacob Francis Powers) +* Add support for Sigil (#302, winebarrel) +* Add support for Erubi (#308, jeremyevans) +* Add support for options in Liquid (#298, #299, laCour) +* Always sort locals by strings (#307, jeremyevans) + +* Fix test warnings (#305, amatsuda) +* Fix indentation (#293, yui-knk) +* Use SVG badges in README (#294, vasinov) +* Fix typo and trailing space (#295, #296, karloescota) + ## 2.0.5 (2016-06-02) * Add support for reST using Pandoc (#284, mfenner) @@ -98,4 +115,3 @@ * Support RDoc 3.10 (#112, timfel) * Always compile templates; remove old source evaluator (rtomayko) * Less: Options are now being passed to the parser (#106, cowboyd) - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Gemfile new/Gemfile --- old/Gemfile 2016-06-02 21:20:05.000000000 +0200 +++ new/Gemfile 2017-03-19 11:13:33.000000000 +0100 @@ -4,7 +4,7 @@ gem 'minitest', '~> 5.0' group :development do - gem 'yard', '~> 0.8.6' + gem 'yard', '~> 0.9.0' gem 'ronn', '~> 0.7.3' end @@ -20,13 +20,14 @@ if can_execjs gem 'less' gem 'coffee-script' + gem 'livescript' gem 'babel-transpiler' gem 'typescript-node' end end platform :mri do - gem 'duktape', '~> 1.2.1.0' if can_execjs + gem 'duktape', '~> 1.3.0.6' if can_execjs end group :secondary do @@ -64,4 +65,3 @@ platform :rbx do gem 'rubysl' end - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2016-06-02 21:20:05.000000000 +0200 +++ new/README.md 2017-03-19 11:13:33.000000000 +0100 @@ -1,4 +1,4 @@ -Tilt [](http://travis-ci.org/rtomayko/tilt) [](https://gemnasium.com/rtomayko/tilt) [](http://inch-ci.org/github/rtomayko/tilt) +Tilt [](http://travis-ci.org/rtomayko/tilt) [](https://gemnasium.com/rtomayko/tilt) [](http://inch-ci.org/github/rtomayko/tilt) [](https://hakiri.io/github/rtomayko/tilt/master) ==== **NOTE** The following file documents the current release of Tilt (2.0). See @@ -29,6 +29,7 @@ | Asciidoctor | .ad, .adoc, .asciidoc | asciidoctor (>= 0.1.0) | Community | | ERB | .erb, .rhtml | none (included ruby stdlib) | Tilt team | | InterpolatedString | .str | none (included ruby core) | Tilt team | +| Erubi | .erb, .rhtml, .erubi | erubi | Community | | Erubis | .erb, .rhtml, .erubis | erubis | Tilt team | | Haml | .haml | haml | Tilt team | | Sass | .sass | haml (< 3.1) or sass (>= 3.1) | Tilt team | @@ -51,6 +52,8 @@ | Nokogiri | .nokogiri | nokogiri | Community | | CoffeeScript | .coffee | coffee-script (+ javascript) | Tilt team | | CoffeeScript (literate) | .litcoffee | coffee-script (>= 1.5.0) (+ javascript) | Tilt team | +| LiveScript | .ls | livescript (+ javascript) | Tilt team | +| TypeScript | .ts | typescript (+ javascript) | Tilt team | | Creole (Wiki markup) | .wiki, .creole | creole | Community | | WikiCloth (Wiki markup) | .wiki, .mediawiki, .mw | wikicloth | Community | | Yajl | .yajl | yajl-ruby | Community | @@ -58,6 +61,7 @@ | Prawn | .prawn | prawn (>= 2.0.0) | Community | | Babel | .es6, .babel, .jsx | babel-transpiler | Tilt team | | Opal | .rb | opal | Community | +| Sigil | .sigil | sigil | Community | Every supported template engine has a *maintainer*. Note that this is the maintainer of the Tilt integration, not the maintainer of the template engine @@ -66,7 +70,7 @@ maintained by the *community*, which is handled in the following way: - The Tilt team will liberally accept pull requests against the template - integration. It's up the community as a whole to make sure the integration + integration. It's up to the community as a whole to make sure the integration stays consistent and backwards compatible over time. - Test failures in community-maintained integrations will not be prioritized by the Tilt team and a new version of Tilt might be released even though these diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Rakefile new/Rakefile --- old/Rakefile 2016-06-02 21:20:05.000000000 +0200 +++ new/Rakefile 2017-03-19 11:13:33.000000000 +0100 @@ -11,6 +11,7 @@ t.test_files = FileList['test/*_test.rb'] t.ruby_opts = ['-Itest'] t.ruby_opts << '-rubygems' if defined? Gem + t.warning = false end # DOCUMENTATION ============================================================= Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/docs/TEMPLATES.md new/docs/TEMPLATES.md --- old/docs/TEMPLATES.md 2016-06-02 21:20:05.000000000 +0200 +++ new/docs/TEMPLATES.md 2017-03-19 11:13:33.000000000 +0100 @@ -32,6 +32,7 @@ * Scss - `Tilt::ScssTemplate` * CoffeeScript - `Tilt::CoffeeScriptTemplate` * Literate CoffeeScript - `Tilt::CoffeeScriptLiterateTemplate` + * LiveScript - `Tilt::LiveScriptTemplate` * [Textile](#redcloth) - `Tilt::RedClothTemplate` * reStructuredText - `Tilt::RstPandocTemplate` * Creole - `Tilt::CreoleTemplate` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tilt/builder.rb new/lib/tilt/builder.rb --- old/lib/tilt/builder.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/lib/tilt/builder.rb 2017-03-19 11:13:33.000000000 +0100 @@ -2,7 +2,7 @@ require 'builder' module Tilt - # Builder template implementation. See: + # Builder template implementation. See: # http://builder.rubyforge.org/ class BuilderTemplate < Template self.default_mime_type = 'text/xml' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tilt/erubi.rb new/lib/tilt/erubi.rb --- old/lib/tilt/erubi.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/tilt/erubi.rb 2017-03-19 11:13:33.000000000 +0100 @@ -0,0 +1,32 @@ +require 'tilt/template' +require 'erubi' + +module Tilt + # Erubi (a simplified version of Erubis) template implementation. + # See https://github.com/jeremyevans/erubi + # + # ErubiTemplate supports the following additional options, in addition + # to the options supported by the Erubi engine: + # + # :engine_class :: allows you to specify a custom engine class to use + # instead of the default (which is ::Erubi::Engine). + class ErubiTemplate < Template + def prepare + @options.merge!(:preamble => false, :postamble => false, :ensure=>true) + + engine_class = @options[:engine_class] || Erubi::Engine + + @engine = engine_class.new(data, @options) + @outvar = @engine.bufvar + + # Remove dup after tilt supports frozen source. + @src = @engine.src.dup + + @engine + end + + def precompiled_template(locals) + @src + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tilt/liquid.rb new/lib/tilt/liquid.rb --- old/lib/tilt/liquid.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/lib/tilt/liquid.rb 2017-03-19 11:13:33.000000000 +0100 @@ -17,7 +17,7 @@ # time when using this template engine. class LiquidTemplate < Template def prepare - @engine = ::Liquid::Template.parse(data) + @engine = ::Liquid::Template.parse(data, liquid_options) end def evaluate(scope, locals, &block) @@ -34,5 +34,11 @@ def allows_script? false end + + private + + def liquid_options + { line_numbers: true }.merge options + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tilt/livescript.rb new/lib/tilt/livescript.rb --- old/lib/tilt/livescript.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/tilt/livescript.rb 2017-03-19 11:13:33.000000000 +0100 @@ -0,0 +1,23 @@ +require 'tilt/template' +require 'livescript' + +module Tilt + # LiveScript template implementation. See: + # http://livescript.net/ + # + # LiveScript templates do not support object scopes, locals, or yield. + class LiveScriptTemplate < Template + self.default_mime_type = 'application/javascript' + + def prepare + end + + def evaluate(scope, locals, &block) + @output ||= LiveScript.compile(data, options) + end + + def allows_script? + false + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tilt/sigil.rb new/lib/tilt/sigil.rb --- old/lib/tilt/sigil.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/tilt/sigil.rb 2017-03-19 11:13:33.000000000 +0100 @@ -0,0 +1,34 @@ +require 'open3' +require 'shellwords' + +module Tilt + # Standalone string interpolator and template processor implementation in Go. + # see: https://github.com/gliderlabs/sigil + class SigilTemplate < Template + def prepare + end + + def evaluate(scope, locals, &block) + variables = locals.map {|k, v| "#{k}=#{v}" } + + cmd = ['sigil'] + + unless variables.empty? + cmd << '-p' + cmd.concat(variables) + end + + out, err, status = Open3.capture3(*cmd, :stdin_data => data) + + if status.success? + out.chomp + else + raise err.chomp.gsub('<stdin>', file) + end + end + + def allows_script? + false + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tilt/template.rb new/lib/tilt/template.rb --- old/lib/tilt/template.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/lib/tilt/template.rb 2017-03-19 11:13:33.000000000 +0100 @@ -2,11 +2,18 @@ module Tilt # @private - TOPOBJECT = Object.superclass || Object + TOPOBJECT = if RUBY_VERSION >= '2.0' + # @private + module CompiledTemplates + self + end + elsif RUBY_VERSION >= '1.9' + BasicObject + else + Object + end # @private LOCK = Mutex.new - # @private - SYMBOL_ARRAY_SORTABLE = RUBY_VERSION >= '1.9' # Base class for template implementations. Subclasses must implement # the #prepare method and one of the #evaluate or #precompiled_template @@ -158,11 +165,7 @@ # override render() may not support all features. def evaluate(scope, locals, &block) locals_keys = locals.keys - if SYMBOL_ARRAY_SORTABLE - locals_keys.sort! - else - locals_keys.sort!{|x, y| x.to_s <=> y.to_s} - end + locals_keys.sort!{|x, y| x.to_s <=> y.to_s} method = compiled_method(locals_keys) method.bind(scope).call(locals, &block) end @@ -252,7 +255,7 @@ method_source = String.new if method_source.respond_to?(:force_encoding) - method_source.force_encoding(source.encoding) + method_source.force_encoding(source.encoding) end method_source << <<-RUBY diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tilt.rb new/lib/tilt.rb --- old/lib/tilt.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/lib/tilt.rb 2017-03-19 11:13:33.000000000 +0100 @@ -4,7 +4,7 @@ # Namespace for Tilt. This module is not intended to be included anywhere. module Tilt # Current version. - VERSION = '2.0.5' + VERSION = '2.0.7' @default_mapping = Mapping.new @@ -117,6 +117,7 @@ # ERB register_lazy :ERBTemplate, 'tilt/erb', 'erb', 'rhtml' register_lazy :ErubisTemplate, 'tilt/erubis', 'erb', 'rhtml', 'erubis' + register_lazy :ErubiTemplate, 'tilt/erubi', 'erb', 'rhtml', 'erubi' # Markdown register_lazy :BlueClothTemplate, 'tilt/bluecloth', 'markdown', 'mkd', 'md' @@ -139,6 +140,7 @@ register_lazy :HamlTemplate, 'tilt/haml', 'haml' register_lazy :LessTemplate, 'tilt/less', 'less' register_lazy :LiquidTemplate, 'tilt/liquid', 'liquid' + register_lazy :LiveScriptTemplate, 'tilt/livescript','ls' register_lazy :MarkabyTemplate, 'tilt/markaby', 'mab' register_lazy :NokogiriTemplate, 'tilt/nokogiri', 'nokogiri' register_lazy :PlainTemplate, 'tilt/plain', 'html' @@ -149,6 +151,7 @@ register_lazy :RstPandocTemplate, 'tilt/rst-pandoc', 'rst' register_lazy :SassTemplate, 'tilt/sass', 'sass' register_lazy :ScssTemplate, 'tilt/sass', 'scss' + register_lazy :SigilTemplate, 'tilt/sigil', 'sigil' register_lazy :StringTemplate, 'tilt/string', 'str' register_lazy :TypeScriptTemplate, 'tilt/typescript', 'ts' register_lazy :WikiClothTemplate, 'tilt/wikicloth', 'wiki', 'mediawiki', 'mw' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2016-06-02 21:20:05.000000000 +0200 +++ new/metadata 2017-03-19 11:13:33.000000000 +0100 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: tilt version: !ruby/object:Gem::Version - version: 2.0.5 + version: 2.0.7 platform: ruby authors: - Ryan Tomayko autorequire: bindir: bin cert_chain: [] -date: 2016-06-02 00:00:00.000000000 Z +date: 2017-03-19 00:00:00.000000000 Z dependencies: [] description: Generic interface to multiple Ruby template engines email: [email protected] @@ -37,12 +37,14 @@ - lib/tilt/csv.rb - lib/tilt/dummy.rb - lib/tilt/erb.rb +- lib/tilt/erubi.rb - lib/tilt/erubis.rb - lib/tilt/etanni.rb - lib/tilt/haml.rb - lib/tilt/kramdown.rb - lib/tilt/less.rb - lib/tilt/liquid.rb +- lib/tilt/livescript.rb - lib/tilt/mapping.rb - lib/tilt/markaby.rb - lib/tilt/maruku.rb @@ -57,6 +59,7 @@ - lib/tilt/redcloth.rb - lib/tilt/rst-pandoc.rb - lib/tilt/sass.rb +- lib/tilt/sigil.rb - lib/tilt/string.rb - lib/tilt/template.rb - lib/tilt/typescript.rb @@ -84,12 +87,14 @@ - test/tilt_csv_test.rb - test/tilt_erbtemplate_test.rb - test/tilt_erubistemplate_test.rb +- test/tilt_erubitemplate_test.rb - test/tilt_etannitemplate_test.rb - test/tilt_hamltemplate_test.rb - test/tilt_kramdown_test.rb - test/tilt_lesstemplate_test.less - test/tilt_lesstemplate_test.rb - test/tilt_liquidtemplate_test.rb +- test/tilt_livescripttemplate_test.rb - test/tilt_mapping_test.rb - test/tilt_markaby_test.rb - test/tilt_markdown_test.rb @@ -106,6 +111,7 @@ - test/tilt_redclothtemplate_test.rb - test/tilt_rstpandoctemplate_test.rb - test/tilt_sasstemplate_test.rb +- test/tilt_sigil_test.rb - test/tilt_stringtemplate_test.rb - test/tilt_template_test.rb - test/tilt_test.rb @@ -139,7 +145,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.5.1 +rubygems_version: 2.6.8 signing_key: specification_version: 2 summary: Generic interface to multiple Ruby template engines @@ -155,11 +161,13 @@ - test/tilt_csv_test.rb - test/tilt_erbtemplate_test.rb - test/tilt_erubistemplate_test.rb +- test/tilt_erubitemplate_test.rb - test/tilt_etannitemplate_test.rb - test/tilt_hamltemplate_test.rb - test/tilt_kramdown_test.rb - test/tilt_lesstemplate_test.rb - test/tilt_liquidtemplate_test.rb +- test/tilt_livescripttemplate_test.rb - test/tilt_mapping_test.rb - test/tilt_markaby_test.rb - test/tilt_markdown_test.rb @@ -175,10 +183,10 @@ - test/tilt_redclothtemplate_test.rb - test/tilt_rstpandoctemplate_test.rb - test/tilt_sasstemplate_test.rb +- test/tilt_sigil_test.rb - test/tilt_stringtemplate_test.rb - test/tilt_template_test.rb - test/tilt_test.rb - test/tilt_typescript_test.rb - test/tilt_wikiclothtemplate_test.rb - test/tilt_yajltemplate_test.rb -has_rdoc: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_asciidoctor_test.rb new/test/tilt_asciidoctor_test.rb --- old/test/tilt_asciidoctor_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_asciidoctor_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -45,6 +45,6 @@ 3.times { assert_equal HTML5_OUTPUT, strip_space(template.render) } end end -rescue LoadError => boom +rescue LoadError warn "Tilt::AsciidoctorTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_blueclothtemplate_test.rb new/test/tilt_blueclothtemplate_test.rb --- old/test/tilt_blueclothtemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_blueclothtemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -28,6 +28,6 @@ assert_equal "<p>HELLO <blink>WORLD</blink></p>", template.render end end -rescue LoadError => boom +rescue LoadError warn "Tilt::BlueClothTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_coffeescripttemplate_test.rb new/test/tilt_coffeescripttemplate_test.rb --- old/test/tilt_coffeescripttemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_coffeescripttemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -30,7 +30,7 @@ refute_match "(function() {", template.render assert_equal "var name;\n\nname = \"Josh\";\n\nputs(\"Hello, \" + name);\n", template.render - template2 = @renderer.new(:no_wrap => true) { @code_with_variables} + template = @renderer.new(:no_wrap => true) { @code_with_variables} refute_match "(function() {", template.render assert_equal "var name;\n\nname = \"Josh\";\n\nputs(\"Hello, \" + name);\n", template.render end @@ -136,6 +136,6 @@ end end -rescue LoadError => boom +rescue LoadError warn "Tilt::CoffeeScriptTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_commonmarkertemplate_test.rb new/test/tilt_commonmarkertemplate_test.rb --- old/test/tilt_commonmarkertemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_commonmarkertemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -15,6 +15,6 @@ 3.times { assert_equal "<h1>Hello World!</h1>\n", template.render } end end -rescue LoadError => boom +rescue LoadError warn "Tilt::CommonMarkerTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_creoletemplate_test.rb new/test/tilt_creoletemplate_test.rb --- old/test/tilt_creoletemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_creoletemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -19,6 +19,6 @@ 3.times { assert_equal "<h1>Hello World!</h1>", template.render } end end -rescue LoadError => boom +rescue LoadError warn "Tilt::CreoleTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_csv_test.rb new/test/tilt_csv_test.rb --- old/test/tilt_csv_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_csv_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -42,7 +42,7 @@ assert_kind_of NameError, boom line = boom.backtrace.grep(/^test\.csv:/).first assert line, "Backtrace didn't contain test.csv" - file, line, meth = line.split(":") + _file, line, _meth = line.split(":") assert_equal '4', line end end @@ -61,7 +61,7 @@ end end -rescue LoadError => boom +rescue LoadError warn "Tilt::CSVTemplate (disabled) please install 'fastercsv' if using ruby 1.8.x" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_erbtemplate_test.rb new/test/tilt_erbtemplate_test.rb --- old/test/tilt_erbtemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_erbtemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -68,7 +68,7 @@ assert_kind_of NameError, boom line = boom.backtrace.grep(/^test\.erb:/).first assert line, "Backtrace didn't contain test.erb" - file, line, meth = line.split(":") + _file, line, _meth = line.split(":") assert_equal '13', line end end @@ -83,7 +83,7 @@ rescue => boom assert_kind_of RuntimeError, boom line = boom.backtrace.first - file, line, meth = line.split(":") + file, line, _meth = line.split(":") assert_equal 'test.erb', file assert_equal '6', line end @@ -170,7 +170,7 @@ assert_kind_of NameError, boom line = boom.backtrace.grep(/^test\.erb:/).first assert line, "Backtrace didn't contain test.erb" - file, line, meth = line.split(":") + _file, line, _meth = line.split(":") assert_equal '13', line end end @@ -185,7 +185,7 @@ rescue => boom assert_kind_of RuntimeError, boom line = boom.backtrace.first - file, line, meth = line.split(":") + file, line, _meth = line.split(":") assert_equal 'test.erb', file assert_equal '6', line end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_erubistemplate_test.rb new/test/tilt_erubistemplate_test.rb --- old/test/tilt_erubistemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_erubistemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -74,7 +74,7 @@ assert_kind_of NameError, boom line = boom.backtrace.grep(/^test\.erubis:/).first assert line, "Backtrace didn't contain test.erubis" - file, line, meth = line.split(":") + _file, line, _meth = line.split(":") assert_equal '13', line end end @@ -89,7 +89,7 @@ rescue => boom assert_kind_of RuntimeError, boom line = boom.backtrace.first - file, line, meth = line.split(":") + file, line, _meth = line.split(":") assert_equal 'test.erubis', file assert_equal '6', line end @@ -132,11 +132,11 @@ test "does not modify options argument" do options_hash = {:escape_html => true} - template = Tilt::ErubisTemplate.new(nil, options_hash) { |t| "Hello World!" } + Tilt::ErubisTemplate.new(nil, options_hash) { |t| "Hello World!" } assert_equal({:escape_html => true}, options_hash) end end -rescue LoadError => boom +rescue LoadError warn "Tilt::ErubisTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_erubitemplate_test.rb new/test/tilt_erubitemplate_test.rb --- old/test/tilt_erubitemplate_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/tilt_erubitemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -0,0 +1,158 @@ +require 'test_helper' +require 'tilt' + +begin + require 'tilt/erubi' + class ErubiTemplateTest < Minitest::Test + test "registered for '.erubi' files" do + assert_equal Tilt::ErubiTemplate, Tilt['test.erubi'] + assert_equal Tilt::ErubiTemplate, Tilt['test.html.erubi'] + end + + test "registered above ERB and Erubis" do + %w[erb rhtml].each do |ext| + lazy = Tilt.lazy_map[ext] + erubi_idx = lazy.index { |klass, file| klass == 'Tilt::ErubiTemplate' } + erubis_idx = lazy.index { |klass, file| klass == 'Tilt::ErubisTemplate' } + erb_idx = lazy.index { |klass, file| klass == 'Tilt::ERBTemplate' } + assert erubi_idx < erubis_idx, + "#{erubi_idx} should be lower than #{erubis_idx}" + assert erubi_idx < erb_idx, + "#{erubi_idx} should be lower than #{erb_idx}" + end + end + + test "preparing and evaluating templates on #render" do + template = Tilt::ErubiTemplate.new { |t| "Hello World!" } + assert_equal "Hello World!", template.render + end + + test "can be rendered more than once" do + template = Tilt::ErubiTemplate.new { |t| "Hello World!" } + 3.times { assert_equal "Hello World!", template.render } + end + + test "passing locals" do + template = Tilt::ErubiTemplate.new { 'Hey <%= name %>!' } + assert_equal "Hey Joe!", template.render(Object.new, :name => 'Joe') + end + + test "evaluating in an object scope" do + template = Tilt::ErubiTemplate.new { 'Hey <%= @name %>!' } + scope = Object.new + scope.instance_variable_set :@name, 'Joe' + assert_equal "Hey Joe!", template.render(scope) + end + + class MockOutputVariableScope + attr_accessor :exposed_buffer + end + + test "exposing the buffer to the template by default" do + template = Tilt::ErubiTemplate.new(nil, :bufvar=>'@_out_buf') { '<% self.exposed_buffer = @_out_buf %>hey' } + scope = MockOutputVariableScope.new + template.render(scope) + refute_nil scope.exposed_buffer + assert_equal scope.exposed_buffer, 'hey' + end + + test "passing a block for yield" do + template = Tilt::ErubiTemplate.new { 'Hey <%= yield %>!' } + assert_equal "Hey Joe!", template.render { 'Joe' } + end + + test "backtrace file and line reporting without locals" do + data = File.read(__FILE__).split("\n__END__\n").last + fail unless data[0] == ?< + template = Tilt::ErubiTemplate.new('test.erubis', 11) { data } + begin + template.render + fail 'should have raised an exception' + rescue => boom + assert_kind_of NameError, boom + line = boom.backtrace.grep(/^test\.erubis:/).first + assert line, "Backtrace didn't contain test.erubis" + _file, line, _meth = line.split(":") + assert_equal '13', line + end + end + + test "backtrace file and line reporting with locals" do + data = File.read(__FILE__).split("\n__END__\n").last + fail unless data[0] == ?< + template = Tilt::ErubiTemplate.new('test.erubis', 1) { data } + begin + template.render(nil, :name => 'Joe', :foo => 'bar') + fail 'should have raised an exception' + rescue => boom + assert_kind_of RuntimeError, boom + line = boom.backtrace.first + file, line, _meth = line.split(":") + assert_equal 'test.erubis', file + assert_equal '6', line + end + end + + test "erubis template options" do + template = Tilt::ErubiTemplate.new(nil, :escapefunc=> 'h') { 'Hey <%== @name %>!' } + scope = Object.new + def scope.h(s) s * 2 end + scope.instance_variable_set :@name, 'Joe' + assert_equal "Hey JoeJoe!", template.render(scope) + end + + test "using an instance variable as the outvar" do + template = Tilt::ErubiTemplate.new(nil, :outvar => '@buf') { "<%= 1 + 1 %>" } + scope = Object.new + scope.instance_variable_set(:@buf, 'original value') + assert_equal '2', template.render(scope) + assert_equal 'original value', scope.instance_variable_get(:@buf) + end + + test "using Erubi::CaptureEndEngine subclass via :engine_class option" do + require 'erubi/capture_end' + def self.bar + @a << "a" + yield + @a << 'b' + @a.upcase + end + template = Tilt::ErubiTemplate.new(nil, :engine_class => ::Erubi::CaptureEndEngine, :bufvar=>'@a') { 'c<%|= bar do %>d<%| end %>e' } + assert_equal "cADBe", template.render(self) + end + + test "using :escape_html => true option" do + template = Tilt::ErubiTemplate.new(nil, :escape_html => true) { |t| %(<%= "<p>Hello World!</p>" %>) } + assert_equal "<p>Hello World!</p>", template.render + end + + test "using :escape_html => false option" do + template = Tilt::ErubiTemplate.new(nil, :escape_html => false) { |t| %(<%= "<p>Hello World!</p>" %>) } + assert_equal "<p>Hello World!</p>", template.render + end + + test "erubi default does not escape html" do + template = Tilt::ErubiTemplate.new { |t| %(<%= "<p>Hello World!</p>" %>) } + assert_equal "<p>Hello World!</p>", template.render + end + + test "does not modify options argument" do + options_hash = {:escape_html => true} + Tilt::ErubiTemplate.new(nil, options_hash) { |t| "Hello World!" } + assert_equal({:escape_html => true}, options_hash) + end + end +rescue LoadError + warn "Tilt::ErubiTemplate (disabled)" +end + +__END__ +<html> +<body> + <h1>Hey <%= name %>!</h1> + + + <p><% fail %></p> +</body> +</html> + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_etannitemplate_test.rb new/test/tilt_etannitemplate_test.rb --- old/test/tilt_etannitemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_etannitemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -55,7 +55,7 @@ assert_kind_of NameError, boom line = boom.backtrace.grep(/^test\.etn:/).first assert line, "Backtrace didn't contain test.etn" - file, line, meth = line.split(":") + _file, line, _meth = line.split(":") assert_equal '13', line end end @@ -70,7 +70,7 @@ rescue => boom assert_kind_of RuntimeError, boom line = boom.backtrace.first - file, line, meth = line.split(":") + file, line, _meth = line.split(":") assert_equal 'test.etn', file assert_equal '6', line end @@ -141,7 +141,7 @@ line = boom.backtrace.first line = boom.backtrace.grep(/^test\.etn:/).first assert line, "Backtrace didn't contain test.etn" - file, line, meth = line.split(":") + _file, line, _meth = line.split(":") assert_equal '13', line end end @@ -156,7 +156,7 @@ rescue => boom assert_kind_of RuntimeError, boom line = boom.backtrace.first - file, line, meth = line.split(":") + file, line, _meth = line.split(":") assert_equal 'test.etn', file assert_equal '6', line end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_hamltemplate_test.rb new/test/tilt_hamltemplate_test.rb --- old/test/tilt_hamltemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_hamltemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -61,7 +61,7 @@ assert_kind_of NameError, boom line = boom.backtrace.grep(/^test\.haml:/).first assert line, "Backtrace didn't contain test.haml" - file, line, meth = line.split(":") + _file, line, _meth = line.split(":") assert_equal '12', line end end @@ -71,11 +71,11 @@ fail unless data[0] == ?% template = Tilt::HamlTemplate.new('test.haml') { data } begin - res = template.render(Object.new, :name => 'Joe', :foo => 'bar') + template.render(Object.new, :name => 'Joe', :foo => 'bar') rescue => boom assert_kind_of MockError, boom line = boom.backtrace.first - file, line, meth = line.split(":") + file, line, _meth = line.split(":") assert_equal 'test.haml', file assert_equal '5', line end @@ -132,7 +132,7 @@ assert_kind_of NameError, boom line = boom.backtrace.grep(/^test\.haml:/).first assert line, "Backtrace didn't contain test.haml" - file, line, meth = line.split(":") + _file, line, _meth = line.split(":") assert_equal '12', line end end @@ -142,17 +142,17 @@ fail unless data[0] == ?% template = Tilt::HamlTemplate.new('test.haml') { data } begin - res = template.render(Scope.new, :name => 'Joe', :foo => 'bar') + template.render(Scope.new, :name => 'Joe', :foo => 'bar') rescue => boom assert_kind_of MockError, boom line = boom.backtrace.first - file, line, meth = line.split(":") + file, line, _meth = line.split(":") assert_equal 'test.haml', file assert_equal '5', line end end end -rescue LoadError => boom +rescue LoadError warn "Tilt::HamlTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_kramdown_test.rb new/test/tilt_kramdown_test.rb --- old/test/tilt_kramdown_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_kramdown_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -15,6 +15,6 @@ 3.times { assert_equal '<h1 id="hello-world">Hello World!</h1>', template.render.strip } end end -rescue LoadError => boom +rescue LoadError warn "Tilt::KramdownTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_lesstemplate_test.rb new/test/tilt_lesstemplate_test.rb --- old/test/tilt_lesstemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_lesstemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -37,6 +37,6 @@ end end -rescue LoadError => boom +rescue LoadError warn "Tilt::LessTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_liquidtemplate_test.rb new/test/tilt_liquidtemplate_test.rb --- old/test/tilt_liquidtemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_liquidtemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -24,6 +24,15 @@ assert_equal "Hey Joe!", template.render(nil, :name => 'Joe') end + test "options can be set" do + err = assert_raises(Liquid::SyntaxError) do + options = { line_numbers: false, error_mode: :strict } + Tilt::LiquidTemplate.new(options) { "{{%%%}}" }.render + end + assert_equal 'Liquid syntax error: Unexpected character % in "{{%%%}}"', + err.message + end + # Object's passed as "scope" to LiquidTemplate may respond to # #to_h with a Hash. The Hash's contents are merged underneath # Tilt locals. @@ -73,6 +82,6 @@ end end -rescue LoadError => boom +rescue LoadError warn "Tilt::LiquidTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_livescripttemplate_test.rb new/test/tilt_livescripttemplate_test.rb --- old/test/tilt_livescripttemplate_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/tilt_livescripttemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -0,0 +1,37 @@ +require 'test_helper' +require 'tilt' + +begin + require 'tilt/livescript' + + class LiveScriptTemplateTest < Minitest::Test + setup do + @code_without_variables = "puts 'Hello, World!'\n" + @renderer = Tilt::LiveScriptTemplate + end + + test "compiles and evaluates the template on #render" do + template = @renderer.new { |t| @code_without_variables } + assert_match "puts('Hello, World!');", template.render + end + + test "can be rendered more than once" do + template = @renderer.new { |t| @code_without_variables } + 3.times { assert_match "puts('Hello, World!');", template.render } + end + + test "supports bare-option" do + template = @renderer.new(:bare => false) { |t| @code_without_variables } + assert_match "function", template.render + + template = @renderer.new(:bare => true) { |t| @code_without_variables } + refute_match "function", template.render + end + + test "is registered for '.ls' files" do + assert_equal @renderer, Tilt['test.ls'] + end + end +rescue LoadError + warn "Tilt::LiveScriptTemplate (disabled)" +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_mapping_test.rb new/test/tilt_mapping_test.rb --- old/test/tilt_mapping_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_mapping_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -188,7 +188,7 @@ @mapping.stub :require, req do err = assert_raises(LoadError) do - klass = @mapping['hello.mt'] + @mapping['hello.mt'] end assert_equal 'my_template2', err.message diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_markaby_test.rb new/test/tilt_markaby_test.rb --- old/test/tilt_markaby_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_markaby_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -83,6 +83,6 @@ end end -rescue LoadError => boom +rescue LoadError warn "Tilt::MarkabyTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_markdown_test.rb new/test/tilt_markdown_test.rb --- old/test/tilt_markdown_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_markdown_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -95,7 +95,7 @@ def test_smarty_pants_true # Various versions of Redcarpet support various versions of Smart pants. html = nrender "Hello ``World'' -- This is --- a test ...", :smartypants => true - assert_match /<p>Hello “World(''|”) – This is — a test …<\/p>/, html + assert_match %r!<p>Hello “World(''|”) – This is — a test …<\/p>!, html end def test_renderer_options diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_marukutemplate_test.rb new/test/tilt_marukutemplate_test.rb --- old/test/tilt_marukutemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_marukutemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -31,6 +31,6 @@ assert_equal "<p>HELLO</p>", template.render.strip end end -rescue LoadError => boom +rescue LoadError warn "Tilt::MarukuTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_pandoctemplate_test.rb new/test/tilt_pandoctemplate_test.rb --- old/test/tilt_pandoctemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_pandoctemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -58,10 +58,10 @@ test "requires arguments without value (e.g. --standalone) to be passed as hash keys (:standalone => true)" do template = Tilt::PandocTemplate.new(:standalone => true) { |t| "# This is a heading" } - assert_match /^<!DOCTYPE html.*<h1 id="this-is-a-heading">This is a heading<\/h1>.*<\/html>$/m, template.render + assert_match(/^<!DOCTYPE html.*<h1 id="this-is-a-heading">This is a heading<\/h1>.*<\/html>$/m, template.render) end end end -rescue LoadError => boom +rescue LoadError warn "Tilt::PandocTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_prawntemplate_test.rb new/test/tilt_prawntemplate_test.rb --- old/test/tilt_prawntemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_prawntemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -70,6 +70,6 @@ end -rescue LoadError => boom +rescue LoadError warn "Tilt::PrawnTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_radiustemplate_test.rb new/test/tilt_radiustemplate_test.rb --- old/test/tilt_radiustemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_radiustemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -69,7 +69,7 @@ end end -rescue LoadError => boom +rescue LoadError warn "Tilt::RadiusTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_rdiscounttemplate_test.rb new/test/tilt_rdiscounttemplate_test.rb --- old/test/tilt_rdiscounttemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_rdiscounttemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -38,6 +38,6 @@ assert_equal "<p>HELLO <blink>WORLD</blink></p>\n", template.render end end -rescue LoadError => boom +rescue LoadError warn "Tilt::RDiscountTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_rdoctemplate_test.rb new/test/tilt_rdoctemplate_test.rb --- old/test/tilt_rdoctemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_rdoctemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -11,16 +11,16 @@ test "preparing and evaluating the template with #render" do template = Tilt::RDocTemplate.new { |t| "= Hello World!" } result = template.render.strip - assert_match /<h1/, result - assert_match />Hello World!</, result + assert_match %r(<h1), result + assert_match %r(>Hello World!<), result end test "can be rendered more than once" do template = Tilt::RDocTemplate.new { |t| "= Hello World!" } 3.times do result = template.render.strip - assert_match /<h1/, result - assert_match />Hello World!</, result + assert_match %r(<h1), result + assert_match %r(>Hello World!<), result end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_redcarpettemplate_test.rb new/test/tilt_redcarpettemplate_test.rb --- old/test/tilt_redcarpettemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_redcarpettemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -38,17 +38,17 @@ test "smartypants when :smart is set" do template = Tilt::RedcarpetTemplate.new(:smartypants => true) { |t| "OKAY -- 'Smarty Pants'" } - assert_match /<p>OKAY – ('|‘)Smarty Pants('|’)<\/p>/, + assert_match %r!<p>OKAY – ('|‘)Smarty Pants('|’)<\/p>!, template.render end test "smartypants with a rendererer instance" do template = Tilt::RedcarpetTemplate.new(:renderer => Redcarpet::Render::HTML.new(:hard_wrap => true), :smartypants => true) { |t| "OKAY -- 'Smarty Pants'" } - assert_match /<p>OKAY – ('|‘)Smarty Pants('|’)<\/p>/, + assert_match %r!<p>OKAY – ('|‘)Smarty Pants('|’)<\/p>!, template.render end end -rescue LoadError => boom +rescue LoadError warn "Tilt::RedcarpetTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_redclothtemplate_test.rb new/test/tilt_redclothtemplate_test.rb --- old/test/tilt_redclothtemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_redclothtemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -31,6 +31,6 @@ assert_equal "<p>But they can be\nturned off.</p>", template.render end end -rescue LoadError => boom +rescue LoadError warn "Tilt::RedClothTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_rstpandoctemplate_test.rb new/test/tilt_rstpandoctemplate_test.rb --- old/test/tilt_rstpandoctemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_rstpandoctemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -24,7 +24,7 @@ test "doens't use markdown options" do template = Tilt::RstPandocTemplate.new(:escape_html => true) { |t| "HELLO <blink>WORLD</blink>" } err = assert_raises(RuntimeError) { template.render } - assert_match /pandoc: unrecognized option `--escape-html/, err.message + assert_match %r(pandoc: unrecognized option `--escape-html), err.message end end rescue LoadError => boom diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_sasstemplate_test.rb new/test/tilt_sasstemplate_test.rb --- old/test/tilt_sasstemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_sasstemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -36,6 +36,6 @@ end end -rescue LoadError => boom +rescue LoadError warn "Tilt::SassTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_sigil_test.rb new/test/tilt_sigil_test.rb --- old/test/tilt_sigil_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/tilt_sigil_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -0,0 +1,41 @@ +require 'test_helper' +require 'tilt' +require 'tilt/sigil' + +system('sigil -v') + +if $?.success? + class SigilTemplateTest < Minitest::Test + test "registered for '.sigil' files" do + assert_equal Tilt::SigilTemplate, Tilt['test.sigil'] + end + + test "loading and evaluating templates on #render" do + template = Tilt::SigilTemplate.new { |t| "Hello World!" } + assert_equal "Hello World!", template.render + end + + test "can be rendered more than once" do + template = Tilt::SigilTemplate.new { |t| "Hello World!" } + 3.times { assert_equal "Hello World!", template.render } + end + + test "passing locals" do + template = Tilt::SigilTemplate.new { 'Hey $name!' } + assert_equal "Hey Joe!", template.render(Object.new, :name => 'Joe') + end + + test "error message" do + template = Tilt::SigilTemplate.new('test.sigil') { '{{undef_func}}' } + begin + template.render + fail 'should have raised an exception' + rescue => boom + assert_kind_of RuntimeError, boom + assert_equal 'template: test.sigil:1: function "undef_func" not defined', boom.message + end + end + end +else + warn "Tilt::SigilTemplate (disabled)" +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_stringtemplate_test.rb new/test/tilt_stringtemplate_test.rb --- old/test/tilt_stringtemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_stringtemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -51,7 +51,7 @@ assert_kind_of NameError, boom line = boom.backtrace.grep(/^test\.str:/).first assert line, "Backtrace didn't contain test.str" - file, line, meth = line.split(":") + _file, line, _meth = line.split(":") assert_equal '13', line end end @@ -66,7 +66,7 @@ rescue => boom assert_kind_of RuntimeError, boom line = boom.backtrace.first - file, line, meth = line.split(":") + file, line, _meth = line.split(":") assert_equal 'test.str', file assert_equal '6', line end @@ -138,7 +138,7 @@ line = boom.backtrace.first line = boom.backtrace.grep(/^test\.str:/).first assert line, "Backtrace didn't contain test.str" - file, line, meth = line.split(":") + _file, line, _meth = line.split(":") assert_equal '13', line end end @@ -153,7 +153,7 @@ rescue => boom assert_kind_of RuntimeError, boom line = boom.backtrace.first - file, line, meth = line.split(":") + file, line, _meth = line.split(":") assert_equal 'test.str', file assert_equal '6', line end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_template_test.rb new/test/tilt_template_test.rb --- old/test/tilt_template_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_template_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -132,6 +132,12 @@ assert inst.prepared? end + test "template_source with locals of strings" do + inst = SourceGeneratingMockTemplate.new { |t| 'Hey #{name}!' } + assert_equal "Hey Joe!", inst.render(Object.new, 'name' => 'Joe', :name=>'Joe') + assert inst.prepared? + end + test "template_source with locals having non-variable keys raises error" do inst = SourceGeneratingMockTemplate.new { |t| '1 + 2 = #{_answer}' } err = assert_raises(RuntimeError) { inst.render(Object.new, 'ANSWER' => 3) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_typescript_test.rb new/test/tilt_typescript_test.rb --- old/test/tilt_typescript_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_typescript_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -21,7 +21,7 @@ test "supports source map" do template = Tilt::TypeScriptTemplate.new(inlineSourceMap: true) { @ts } - assert_match /sourceMappingURL/, template.render + assert_match %r(sourceMappingURL), template.render end test "can be rendered more than once" do @@ -29,6 +29,6 @@ 3.times { assert_match @js, template.render } end end -rescue LoadError => boom +rescue LoadError warn "Tilt::TypeScriptTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_wikiclothtemplate_test.rb new/test/tilt_wikiclothtemplate_test.rb --- old/test/tilt_wikiclothtemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 +++ new/test/tilt_wikiclothtemplate_test.rb 2017-03-19 11:13:33.000000000 +0100 @@ -19,14 +19,14 @@ test "compiles and evaluates the template on #render" do template = Tilt::WikiClothTemplate.new { |t| "= Hello World! =" } - assert_match /<h1>.*Hello World!.*<\/h1>/m, template.render + assert_match(/<h1>.*Hello World!.*<\/h1>/m, template.render) end test "can be rendered more than once" do template = Tilt::WikiClothTemplate.new { |t| "= Hello World! =" } - 3.times { assert_match /<h1>.*Hello World!.*<\/h1>/m, template.render } + 3.times { assert_match(/<h1>.*Hello World!.*<\/h1>/m, template.render) } end end -rescue LoadError => boom +rescue LoadError warn "Tilt::WikiClothTemplate (disabled)" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tilt.gemspec new/tilt.gemspec --- old/tilt.gemspec 2016-06-02 21:20:05.000000000 +0200 +++ new/tilt.gemspec 2017-03-19 11:13:33.000000000 +0100 @@ -3,8 +3,8 @@ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.name = 'tilt' - s.version = '2.0.5' - s.date = '2016-06-02' + s.version = '2.0.7' + s.date = '2017-03-19' s.description = "Generic interface to multiple Ruby template engines" s.summary = s.description @@ -35,12 +35,14 @@ lib/tilt/csv.rb lib/tilt/dummy.rb lib/tilt/erb.rb + lib/tilt/erubi.rb lib/tilt/erubis.rb lib/tilt/etanni.rb lib/tilt/haml.rb lib/tilt/kramdown.rb lib/tilt/less.rb lib/tilt/liquid.rb + lib/tilt/livescript.rb lib/tilt/mapping.rb lib/tilt/markaby.rb lib/tilt/maruku.rb @@ -55,6 +57,7 @@ lib/tilt/redcloth.rb lib/tilt/rst-pandoc.rb lib/tilt/sass.rb + lib/tilt/sigil.rb lib/tilt/string.rb lib/tilt/template.rb lib/tilt/typescript.rb @@ -82,12 +85,14 @@ test/tilt_csv_test.rb test/tilt_erbtemplate_test.rb test/tilt_erubistemplate_test.rb + test/tilt_erubitemplate_test.rb test/tilt_etannitemplate_test.rb test/tilt_hamltemplate_test.rb test/tilt_kramdown_test.rb test/tilt_lesstemplate_test.less test/tilt_lesstemplate_test.rb test/tilt_liquidtemplate_test.rb + test/tilt_livescripttemplate_test.rb test/tilt_mapping_test.rb test/tilt_markaby_test.rb test/tilt_markdown_test.rb @@ -104,6 +109,7 @@ test/tilt_redclothtemplate_test.rb test/tilt_rstpandoctemplate_test.rb test/tilt_sasstemplate_test.rb + test/tilt_sigil_test.rb test/tilt_stringtemplate_test.rb test/tilt_template_test.rb test/tilt_test.rb
