tilt 2.0.5 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/Gemfile +2 -2
- data/README.md +6 -2
- data/Rakefile +1 -0
- data/docs/TEMPLATES.md +1 -0
- data/lib/tilt.rb +4 -1
- data/lib/tilt/builder.rb +1 -1
- data/lib/tilt/erubi.rb +32 -0
- data/lib/tilt/liquid.rb +7 -1
- data/lib/tilt/livescript.rb +23 -0
- data/lib/tilt/sigil.rb +34 -0
- data/lib/tilt/template.rb +2 -8
- data/test/tilt_asciidoctor_test.rb +1 -1
- data/test/tilt_blueclothtemplate_test.rb +1 -1
- data/test/tilt_coffeescripttemplate_test.rb +2 -2
- data/test/tilt_commonmarkertemplate_test.rb +1 -1
- data/test/tilt_creoletemplate_test.rb +1 -1
- data/test/tilt_csv_test.rb +2 -2
- data/test/tilt_erbtemplate_test.rb +4 -4
- data/test/tilt_erubistemplate_test.rb +4 -4
- data/test/tilt_erubitemplate_test.rb +158 -0
- data/test/tilt_etannitemplate_test.rb +4 -4
- data/test/tilt_hamltemplate_test.rb +7 -7
- data/test/tilt_kramdown_test.rb +1 -1
- data/test/tilt_lesstemplate_test.rb +1 -1
- data/test/tilt_liquidtemplate_test.rb +10 -1
- data/test/tilt_livescripttemplate_test.rb +37 -0
- data/test/tilt_mapping_test.rb +1 -1
- data/test/tilt_markaby_test.rb +1 -1
- data/test/tilt_markdown_test.rb +1 -1
- data/test/tilt_marukutemplate_test.rb +1 -1
- data/test/tilt_pandoctemplate_test.rb +2 -2
- data/test/tilt_prawntemplate_test.rb +1 -1
- data/test/tilt_radiustemplate_test.rb +1 -1
- data/test/tilt_rdiscounttemplate_test.rb +1 -1
- data/test/tilt_rdoctemplate_test.rb +4 -4
- data/test/tilt_redcarpettemplate_test.rb +3 -3
- data/test/tilt_redclothtemplate_test.rb +1 -1
- data/test/tilt_rstpandoctemplate_test.rb +1 -1
- data/test/tilt_sasstemplate_test.rb +1 -1
- data/test/tilt_sigil_test.rb +41 -0
- data/test/tilt_stringtemplate_test.rb +4 -4
- data/test/tilt_template_test.rb +6 -0
- data/test/tilt_typescript_test.rb +2 -2
- data/test/tilt_wikiclothtemplate_test.rb +3 -3
- data/tilt.gemspec +8 -2
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a64944bf1560252694d8d31faccc2441a4c35dc
|
4
|
+
data.tar.gz: a1513a4660e965009d7bb91d48241cc3065d693a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b4ae89e41a1e6bab214b9d72eba0e656b08385e521a043de35da9bc8a1d7fbe14705165bd8c0c4bbfa346f0f82b6816f1c780a17cc894dfcd810be8e447cce7
|
7
|
+
data.tar.gz: 291502cb76dd404e9ae5c53283b262063af0fc503a209d05370b627b793a62a29f77420e159f8ac389baf884c0316fb6bb14230df53dd9ec093efb64e9d23fac
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## 2.0.6 (2017-01-26)
|
2
|
+
|
3
|
+
* Add support for LiveScript (#286, @Announcement Jacob Francis Powers)
|
4
|
+
* Add support for Sigil (#302, winebarrel)
|
5
|
+
* Add support for Erubi (#308, jeremyevans)
|
6
|
+
* Add support for options in Liquid (#298, #299, laCour)
|
7
|
+
* Always sort locals by strings (#307, jeremyevans)
|
8
|
+
|
9
|
+
* Fix test warnings (#305, amatsuda)
|
10
|
+
* Fix indentation (#293, yui-knk)
|
11
|
+
* Use SVG badges in README (#294, vasinov)
|
12
|
+
* Fix typo and trailing space (#295, #296, karloescota)
|
13
|
+
|
1
14
|
## 2.0.5 (2016-06-02)
|
2
15
|
|
3
16
|
* Add support for reST using Pandoc (#284, mfenner)
|
@@ -98,4 +111,3 @@
|
|
98
111
|
* Support RDoc 3.10 (#112, timfel)
|
99
112
|
* Always compile templates; remove old source evaluator (rtomayko)
|
100
113
|
* Less: Options are now being passed to the parser (#106, cowboyd)
|
101
|
-
|
data/Gemfile
CHANGED
@@ -20,13 +20,14 @@ group :primary do
|
|
20
20
|
if can_execjs
|
21
21
|
gem 'less'
|
22
22
|
gem 'coffee-script'
|
23
|
+
gem 'livescript'
|
23
24
|
gem 'babel-transpiler'
|
24
25
|
gem 'typescript-node'
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
28
29
|
platform :mri do
|
29
|
-
gem 'duktape', '~> 1.
|
30
|
+
gem 'duktape', '~> 1.3.0.6' if can_execjs
|
30
31
|
end
|
31
32
|
|
32
33
|
group :secondary do
|
@@ -64,4 +65,3 @@ end
|
|
64
65
|
platform :rbx do
|
65
66
|
gem 'rubysl'
|
66
67
|
end
|
67
|
-
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Tilt [![Build Status](https://secure.travis-ci.org/rtomayko/tilt.svg)](http://travis-ci.org/rtomayko/tilt) [![Dependency Status](https://gemnasium.com/rtomayko/tilt.
|
1
|
+
Tilt [![Build Status](https://secure.travis-ci.org/rtomayko/tilt.svg)](http://travis-ci.org/rtomayko/tilt) [![Dependency Status](https://gemnasium.com/rtomayko/tilt.svg)](https://gemnasium.com/rtomayko/tilt) [![Inline docs](http://inch-ci.org/github/rtomayko/tilt.svg)](http://inch-ci.org/github/rtomayko/tilt) [![Security](https://hakiri.io/github/rtomayko/tilt/master.svg)](https://hakiri.io/github/rtomayko/tilt/master)
|
2
2
|
====
|
3
3
|
|
4
4
|
**NOTE** The following file documents the current release of Tilt (2.0). See
|
@@ -29,6 +29,7 @@ Support for these template engines is included with the package:
|
|
29
29
|
| Asciidoctor | .ad, .adoc, .asciidoc | asciidoctor (>= 0.1.0) | Community |
|
30
30
|
| ERB | .erb, .rhtml | none (included ruby stdlib) | Tilt team |
|
31
31
|
| InterpolatedString | .str | none (included ruby core) | Tilt team |
|
32
|
+
| Erubi | .erb, .rhtml, .erubi | erubi | Community |
|
32
33
|
| Erubis | .erb, .rhtml, .erubis | erubis | Tilt team |
|
33
34
|
| Haml | .haml | haml | Tilt team |
|
34
35
|
| Sass | .sass | haml (< 3.1) or sass (>= 3.1) | Tilt team |
|
@@ -51,6 +52,8 @@ Support for these template engines is included with the package:
|
|
51
52
|
| Nokogiri | .nokogiri | nokogiri | Community |
|
52
53
|
| CoffeeScript | .coffee | coffee-script (+ javascript) | Tilt team |
|
53
54
|
| CoffeeScript (literate) | .litcoffee | coffee-script (>= 1.5.0) (+ javascript) | Tilt team |
|
55
|
+
| LiveScript | .ls | livescript (+ javascript) | Tilt team |
|
56
|
+
| TypeScript | .ts | typescript (+ javascript) | Tilt team |
|
54
57
|
| Creole (Wiki markup) | .wiki, .creole | creole | Community |
|
55
58
|
| WikiCloth (Wiki markup) | .wiki, .mediawiki, .mw | wikicloth | Community |
|
56
59
|
| Yajl | .yajl | yajl-ruby | Community |
|
@@ -58,6 +61,7 @@ Support for these template engines is included with the package:
|
|
58
61
|
| Prawn | .prawn | prawn (>= 2.0.0) | Community |
|
59
62
|
| Babel | .es6, .babel, .jsx | babel-transpiler | Tilt team |
|
60
63
|
| Opal | .rb | opal | Community |
|
64
|
+
| Sigil | .sigil | sigil | Community |
|
61
65
|
|
62
66
|
Every supported template engine has a *maintainer*. Note that this is the
|
63
67
|
maintainer of the Tilt integration, not the maintainer of the template engine
|
@@ -66,7 +70,7 @@ keeping backwards compatibility across Tilt version. Some integrations are
|
|
66
70
|
maintained by the *community*, which is handled in the following way:
|
67
71
|
|
68
72
|
- The Tilt team will liberally accept pull requests against the template
|
69
|
-
integration. It's up the community as a whole to make sure the integration
|
73
|
+
integration. It's up to the community as a whole to make sure the integration
|
70
74
|
stays consistent and backwards compatible over time.
|
71
75
|
- Test failures in community-maintained integrations will not be prioritized by
|
72
76
|
the Tilt team and a new version of Tilt might be released even though these
|
data/Rakefile
CHANGED
@@ -11,6 +11,7 @@ Rake::TestTask.new(:test) do |t|
|
|
11
11
|
t.test_files = FileList['test/*_test.rb']
|
12
12
|
t.ruby_opts = ['-Itest']
|
13
13
|
t.ruby_opts << '-rubygems' if defined? Gem
|
14
|
+
t.warning = false
|
14
15
|
end
|
15
16
|
|
16
17
|
# DOCUMENTATION =============================================================
|
data/docs/TEMPLATES.md
CHANGED
@@ -32,6 +32,7 @@ Tilt also includes support for CSS processors like [LessCSS][lesscss] and
|
|
32
32
|
* Scss - `Tilt::ScssTemplate`
|
33
33
|
* CoffeeScript - `Tilt::CoffeeScriptTemplate`
|
34
34
|
* Literate CoffeeScript - `Tilt::CoffeeScriptLiterateTemplate`
|
35
|
+
* LiveScript - `Tilt::LiveScriptTemplate`
|
35
36
|
* [Textile](#redcloth) - `Tilt::RedClothTemplate`
|
36
37
|
* reStructuredText - `Tilt::RstPandocTemplate`
|
37
38
|
* Creole - `Tilt::CreoleTemplate`
|
data/lib/tilt.rb
CHANGED
@@ -4,7 +4,7 @@ require 'tilt/template'
|
|
4
4
|
# Namespace for Tilt. This module is not intended to be included anywhere.
|
5
5
|
module Tilt
|
6
6
|
# Current version.
|
7
|
-
VERSION = '2.0.
|
7
|
+
VERSION = '2.0.6'
|
8
8
|
|
9
9
|
@default_mapping = Mapping.new
|
10
10
|
|
@@ -117,6 +117,7 @@ module Tilt
|
|
117
117
|
# ERB
|
118
118
|
register_lazy :ERBTemplate, 'tilt/erb', 'erb', 'rhtml'
|
119
119
|
register_lazy :ErubisTemplate, 'tilt/erubis', 'erb', 'rhtml', 'erubis'
|
120
|
+
register_lazy :ErubiTemplate, 'tilt/erubi', 'erb', 'rhtml', 'erubi'
|
120
121
|
|
121
122
|
# Markdown
|
122
123
|
register_lazy :BlueClothTemplate, 'tilt/bluecloth', 'markdown', 'mkd', 'md'
|
@@ -139,6 +140,7 @@ module Tilt
|
|
139
140
|
register_lazy :HamlTemplate, 'tilt/haml', 'haml'
|
140
141
|
register_lazy :LessTemplate, 'tilt/less', 'less'
|
141
142
|
register_lazy :LiquidTemplate, 'tilt/liquid', 'liquid'
|
143
|
+
register_lazy :LiveScriptTemplate, 'tilt/livescript','ls'
|
142
144
|
register_lazy :MarkabyTemplate, 'tilt/markaby', 'mab'
|
143
145
|
register_lazy :NokogiriTemplate, 'tilt/nokogiri', 'nokogiri'
|
144
146
|
register_lazy :PlainTemplate, 'tilt/plain', 'html'
|
@@ -149,6 +151,7 @@ module Tilt
|
|
149
151
|
register_lazy :RstPandocTemplate, 'tilt/rst-pandoc', 'rst'
|
150
152
|
register_lazy :SassTemplate, 'tilt/sass', 'sass'
|
151
153
|
register_lazy :ScssTemplate, 'tilt/sass', 'scss'
|
154
|
+
register_lazy :SigilTemplate, 'tilt/sigil', 'sigil'
|
152
155
|
register_lazy :StringTemplate, 'tilt/string', 'str'
|
153
156
|
register_lazy :TypeScriptTemplate, 'tilt/typescript', 'ts'
|
154
157
|
register_lazy :WikiClothTemplate, 'tilt/wikicloth', 'wiki', 'mediawiki', 'mw'
|
data/lib/tilt/builder.rb
CHANGED
data/lib/tilt/erubi.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'tilt/template'
|
2
|
+
require 'erubi'
|
3
|
+
|
4
|
+
module Tilt
|
5
|
+
# Erubi (a simplified version of Erubis) template implementation.
|
6
|
+
# See https://github.com/jeremyevans/erubi
|
7
|
+
#
|
8
|
+
# ErubiTemplate supports the following additional options, in addition
|
9
|
+
# to the options supported by the Erubi engine:
|
10
|
+
#
|
11
|
+
# :engine_class :: allows you to specify a custom engine class to use
|
12
|
+
# instead of the default (which is ::Erubi::Engine).
|
13
|
+
class ErubiTemplate < Template
|
14
|
+
def prepare
|
15
|
+
@options.merge!(:preamble => false, :postamble => false, :ensure=>true)
|
16
|
+
|
17
|
+
engine_class = @options[:engine_class] || Erubi::Engine
|
18
|
+
|
19
|
+
@engine = engine_class.new(data, @options)
|
20
|
+
@outvar = @engine.bufvar
|
21
|
+
|
22
|
+
# Remove dup after tilt supports frozen source.
|
23
|
+
@src = @engine.src.dup
|
24
|
+
|
25
|
+
@engine
|
26
|
+
end
|
27
|
+
|
28
|
+
def precompiled_template(locals)
|
29
|
+
@src
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/tilt/liquid.rb
CHANGED
@@ -17,7 +17,7 @@ module Tilt
|
|
17
17
|
# time when using this template engine.
|
18
18
|
class LiquidTemplate < Template
|
19
19
|
def prepare
|
20
|
-
@engine = ::Liquid::Template.parse(data)
|
20
|
+
@engine = ::Liquid::Template.parse(data, liquid_options)
|
21
21
|
end
|
22
22
|
|
23
23
|
def evaluate(scope, locals, &block)
|
@@ -34,5 +34,11 @@ module Tilt
|
|
34
34
|
def allows_script?
|
35
35
|
false
|
36
36
|
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def liquid_options
|
41
|
+
{ line_numbers: true }.merge options
|
42
|
+
end
|
37
43
|
end
|
38
44
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'tilt/template'
|
2
|
+
require 'livescript'
|
3
|
+
|
4
|
+
module Tilt
|
5
|
+
# LiveScript template implementation. See:
|
6
|
+
# http://livescript.net/
|
7
|
+
#
|
8
|
+
# LiveScript templates do not support object scopes, locals, or yield.
|
9
|
+
class LiveScriptTemplate < Template
|
10
|
+
self.default_mime_type = 'application/javascript'
|
11
|
+
|
12
|
+
def prepare
|
13
|
+
end
|
14
|
+
|
15
|
+
def evaluate(scope, locals, &block)
|
16
|
+
@output ||= LiveScript.compile(data, options)
|
17
|
+
end
|
18
|
+
|
19
|
+
def allows_script?
|
20
|
+
false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/tilt/sigil.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'open3'
|
2
|
+
require 'shellwords'
|
3
|
+
|
4
|
+
module Tilt
|
5
|
+
# Standalone string interpolator and template processor implementation in Go.
|
6
|
+
# see: https://github.com/gliderlabs/sigil
|
7
|
+
class SigilTemplate < Template
|
8
|
+
def prepare
|
9
|
+
end
|
10
|
+
|
11
|
+
def evaluate(scope, locals, &block)
|
12
|
+
variables = locals.map {|k, v| "#{k}=#{v}" }
|
13
|
+
|
14
|
+
cmd = ['sigil']
|
15
|
+
|
16
|
+
unless variables.empty?
|
17
|
+
cmd << '-p'
|
18
|
+
cmd.concat(variables)
|
19
|
+
end
|
20
|
+
|
21
|
+
out, err, status = Open3.capture3(*cmd, :stdin_data => data)
|
22
|
+
|
23
|
+
if status.success?
|
24
|
+
out.chomp
|
25
|
+
else
|
26
|
+
raise err.chomp.gsub('<stdin>', file)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def allows_script?
|
31
|
+
false
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/tilt/template.rb
CHANGED
@@ -5,8 +5,6 @@ module Tilt
|
|
5
5
|
TOPOBJECT = Object.superclass || Object
|
6
6
|
# @private
|
7
7
|
LOCK = Mutex.new
|
8
|
-
# @private
|
9
|
-
SYMBOL_ARRAY_SORTABLE = RUBY_VERSION >= '1.9'
|
10
8
|
|
11
9
|
# Base class for template implementations. Subclasses must implement
|
12
10
|
# the #prepare method and one of the #evaluate or #precompiled_template
|
@@ -158,11 +156,7 @@ module Tilt
|
|
158
156
|
# override render() may not support all features.
|
159
157
|
def evaluate(scope, locals, &block)
|
160
158
|
locals_keys = locals.keys
|
161
|
-
|
162
|
-
locals_keys.sort!
|
163
|
-
else
|
164
|
-
locals_keys.sort!{|x, y| x.to_s <=> y.to_s}
|
165
|
-
end
|
159
|
+
locals_keys.sort!{|x, y| x.to_s <=> y.to_s}
|
166
160
|
method = compiled_method(locals_keys)
|
167
161
|
method.bind(scope).call(locals, &block)
|
168
162
|
end
|
@@ -252,7 +246,7 @@ module Tilt
|
|
252
246
|
method_source = String.new
|
253
247
|
|
254
248
|
if method_source.respond_to?(:force_encoding)
|
255
|
-
method_source.force_encoding(source.encoding)
|
249
|
+
method_source.force_encoding(source.encoding)
|
256
250
|
end
|
257
251
|
|
258
252
|
method_source << <<-RUBY
|
@@ -30,7 +30,7 @@ begin
|
|
30
30
|
refute_match "(function() {", template.render
|
31
31
|
assert_equal "var name;\n\nname = \"Josh\";\n\nputs(\"Hello, \" + name);\n", template.render
|
32
32
|
|
33
|
-
|
33
|
+
template = @renderer.new(:no_wrap => true) { @code_with_variables}
|
34
34
|
refute_match "(function() {", template.render
|
35
35
|
assert_equal "var name;\n\nname = \"Josh\";\n\nputs(\"Hello, \" + name);\n", template.render
|
36
36
|
end
|
@@ -136,6 +136,6 @@ EOLIT
|
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
-
rescue LoadError
|
139
|
+
rescue LoadError
|
140
140
|
warn "Tilt::CoffeeScriptTemplate (disabled)"
|
141
141
|
end
|
data/test/tilt_csv_test.rb
CHANGED
@@ -42,7 +42,7 @@ begin
|
|
42
42
|
assert_kind_of NameError, boom
|
43
43
|
line = boom.backtrace.grep(/^test\.csv:/).first
|
44
44
|
assert line, "Backtrace didn't contain test.csv"
|
45
|
-
|
45
|
+
_file, line, _meth = line.split(":")
|
46
46
|
assert_equal '4', line
|
47
47
|
end
|
48
48
|
end
|
@@ -61,7 +61,7 @@ begin
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
rescue LoadError
|
64
|
+
rescue LoadError
|
65
65
|
warn "Tilt::CSVTemplate (disabled) please install 'fastercsv' if using ruby 1.8.x"
|
66
66
|
end
|
67
67
|
|
@@ -68,7 +68,7 @@ class ERBTemplateTest < Minitest::Test
|
|
68
68
|
assert_kind_of NameError, boom
|
69
69
|
line = boom.backtrace.grep(/^test\.erb:/).first
|
70
70
|
assert line, "Backtrace didn't contain test.erb"
|
71
|
-
|
71
|
+
_file, line, _meth = line.split(":")
|
72
72
|
assert_equal '13', line
|
73
73
|
end
|
74
74
|
end
|
@@ -83,7 +83,7 @@ class ERBTemplateTest < Minitest::Test
|
|
83
83
|
rescue => boom
|
84
84
|
assert_kind_of RuntimeError, boom
|
85
85
|
line = boom.backtrace.first
|
86
|
-
file, line,
|
86
|
+
file, line, _meth = line.split(":")
|
87
87
|
assert_equal 'test.erb', file
|
88
88
|
assert_equal '6', line
|
89
89
|
end
|
@@ -170,7 +170,7 @@ class CompiledERBTemplateTest < Minitest::Test
|
|
170
170
|
assert_kind_of NameError, boom
|
171
171
|
line = boom.backtrace.grep(/^test\.erb:/).first
|
172
172
|
assert line, "Backtrace didn't contain test.erb"
|
173
|
-
|
173
|
+
_file, line, _meth = line.split(":")
|
174
174
|
assert_equal '13', line
|
175
175
|
end
|
176
176
|
end
|
@@ -185,7 +185,7 @@ class CompiledERBTemplateTest < Minitest::Test
|
|
185
185
|
rescue => boom
|
186
186
|
assert_kind_of RuntimeError, boom
|
187
187
|
line = boom.backtrace.first
|
188
|
-
file, line,
|
188
|
+
file, line, _meth = line.split(":")
|
189
189
|
assert_equal 'test.erb', file
|
190
190
|
assert_equal '6', line
|
191
191
|
end
|
@@ -74,7 +74,7 @@ begin
|
|
74
74
|
assert_kind_of NameError, boom
|
75
75
|
line = boom.backtrace.grep(/^test\.erubis:/).first
|
76
76
|
assert line, "Backtrace didn't contain test.erubis"
|
77
|
-
|
77
|
+
_file, line, _meth = line.split(":")
|
78
78
|
assert_equal '13', line
|
79
79
|
end
|
80
80
|
end
|
@@ -89,7 +89,7 @@ begin
|
|
89
89
|
rescue => boom
|
90
90
|
assert_kind_of RuntimeError, boom
|
91
91
|
line = boom.backtrace.first
|
92
|
-
file, line,
|
92
|
+
file, line, _meth = line.split(":")
|
93
93
|
assert_equal 'test.erubis', file
|
94
94
|
assert_equal '6', line
|
95
95
|
end
|
@@ -132,11 +132,11 @@ begin
|
|
132
132
|
|
133
133
|
test "does not modify options argument" do
|
134
134
|
options_hash = {:escape_html => true}
|
135
|
-
|
135
|
+
Tilt::ErubisTemplate.new(nil, options_hash) { |t| "Hello World!" }
|
136
136
|
assert_equal({:escape_html => true}, options_hash)
|
137
137
|
end
|
138
138
|
end
|
139
|
-
rescue LoadError
|
139
|
+
rescue LoadError
|
140
140
|
warn "Tilt::ErubisTemplate (disabled)"
|
141
141
|
end
|
142
142
|
|
@@ -0,0 +1,158 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'tilt'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'tilt/erubi'
|
6
|
+
class ErubiTemplateTest < Minitest::Test
|
7
|
+
test "registered for '.erubi' files" do
|
8
|
+
assert_equal Tilt::ErubiTemplate, Tilt['test.erubi']
|
9
|
+
assert_equal Tilt::ErubiTemplate, Tilt['test.html.erubi']
|
10
|
+
end
|
11
|
+
|
12
|
+
test "registered above ERB and Erubis" do
|
13
|
+
%w[erb rhtml].each do |ext|
|
14
|
+
lazy = Tilt.lazy_map[ext]
|
15
|
+
erubi_idx = lazy.index { |klass, file| klass == 'Tilt::ErubiTemplate' }
|
16
|
+
erubis_idx = lazy.index { |klass, file| klass == 'Tilt::ErubisTemplate' }
|
17
|
+
erb_idx = lazy.index { |klass, file| klass == 'Tilt::ERBTemplate' }
|
18
|
+
assert erubi_idx < erubis_idx,
|
19
|
+
"#{erubi_idx} should be lower than #{erubis_idx}"
|
20
|
+
assert erubi_idx < erb_idx,
|
21
|
+
"#{erubi_idx} should be lower than #{erb_idx}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
test "preparing and evaluating templates on #render" do
|
26
|
+
template = Tilt::ErubiTemplate.new { |t| "Hello World!" }
|
27
|
+
assert_equal "Hello World!", template.render
|
28
|
+
end
|
29
|
+
|
30
|
+
test "can be rendered more than once" do
|
31
|
+
template = Tilt::ErubiTemplate.new { |t| "Hello World!" }
|
32
|
+
3.times { assert_equal "Hello World!", template.render }
|
33
|
+
end
|
34
|
+
|
35
|
+
test "passing locals" do
|
36
|
+
template = Tilt::ErubiTemplate.new { 'Hey <%= name %>!' }
|
37
|
+
assert_equal "Hey Joe!", template.render(Object.new, :name => 'Joe')
|
38
|
+
end
|
39
|
+
|
40
|
+
test "evaluating in an object scope" do
|
41
|
+
template = Tilt::ErubiTemplate.new { 'Hey <%= @name %>!' }
|
42
|
+
scope = Object.new
|
43
|
+
scope.instance_variable_set :@name, 'Joe'
|
44
|
+
assert_equal "Hey Joe!", template.render(scope)
|
45
|
+
end
|
46
|
+
|
47
|
+
class MockOutputVariableScope
|
48
|
+
attr_accessor :exposed_buffer
|
49
|
+
end
|
50
|
+
|
51
|
+
test "exposing the buffer to the template by default" do
|
52
|
+
template = Tilt::ErubiTemplate.new(nil, :bufvar=>'@_out_buf') { '<% self.exposed_buffer = @_out_buf %>hey' }
|
53
|
+
scope = MockOutputVariableScope.new
|
54
|
+
template.render(scope)
|
55
|
+
refute_nil scope.exposed_buffer
|
56
|
+
assert_equal scope.exposed_buffer, 'hey'
|
57
|
+
end
|
58
|
+
|
59
|
+
test "passing a block for yield" do
|
60
|
+
template = Tilt::ErubiTemplate.new { 'Hey <%= yield %>!' }
|
61
|
+
assert_equal "Hey Joe!", template.render { 'Joe' }
|
62
|
+
end
|
63
|
+
|
64
|
+
test "backtrace file and line reporting without locals" do
|
65
|
+
data = File.read(__FILE__).split("\n__END__\n").last
|
66
|
+
fail unless data[0] == ?<
|
67
|
+
template = Tilt::ErubiTemplate.new('test.erubis', 11) { data }
|
68
|
+
begin
|
69
|
+
template.render
|
70
|
+
fail 'should have raised an exception'
|
71
|
+
rescue => boom
|
72
|
+
assert_kind_of NameError, boom
|
73
|
+
line = boom.backtrace.grep(/^test\.erubis:/).first
|
74
|
+
assert line, "Backtrace didn't contain test.erubis"
|
75
|
+
_file, line, _meth = line.split(":")
|
76
|
+
assert_equal '13', line
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
test "backtrace file and line reporting with locals" do
|
81
|
+
data = File.read(__FILE__).split("\n__END__\n").last
|
82
|
+
fail unless data[0] == ?<
|
83
|
+
template = Tilt::ErubiTemplate.new('test.erubis', 1) { data }
|
84
|
+
begin
|
85
|
+
template.render(nil, :name => 'Joe', :foo => 'bar')
|
86
|
+
fail 'should have raised an exception'
|
87
|
+
rescue => boom
|
88
|
+
assert_kind_of RuntimeError, boom
|
89
|
+
line = boom.backtrace.first
|
90
|
+
file, line, _meth = line.split(":")
|
91
|
+
assert_equal 'test.erubis', file
|
92
|
+
assert_equal '6', line
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
test "erubis template options" do
|
97
|
+
template = Tilt::ErubiTemplate.new(nil, :escapefunc=> 'h') { 'Hey <%== @name %>!' }
|
98
|
+
scope = Object.new
|
99
|
+
def scope.h(s) s * 2 end
|
100
|
+
scope.instance_variable_set :@name, 'Joe'
|
101
|
+
assert_equal "Hey JoeJoe!", template.render(scope)
|
102
|
+
end
|
103
|
+
|
104
|
+
test "using an instance variable as the outvar" do
|
105
|
+
template = Tilt::ErubiTemplate.new(nil, :outvar => '@buf') { "<%= 1 + 1 %>" }
|
106
|
+
scope = Object.new
|
107
|
+
scope.instance_variable_set(:@buf, 'original value')
|
108
|
+
assert_equal '2', template.render(scope)
|
109
|
+
assert_equal 'original value', scope.instance_variable_get(:@buf)
|
110
|
+
end
|
111
|
+
|
112
|
+
test "using Erubi::CaptureEndEngine subclass via :engine_class option" do
|
113
|
+
require 'erubi/capture_end'
|
114
|
+
def self.bar
|
115
|
+
@a << "a"
|
116
|
+
yield
|
117
|
+
@a << 'b'
|
118
|
+
@a.upcase
|
119
|
+
end
|
120
|
+
template = Tilt::ErubiTemplate.new(nil, :engine_class => ::Erubi::CaptureEndEngine, :bufvar=>'@a') { 'c<%|= bar do %>d<%| end %>e' }
|
121
|
+
assert_equal "cADBe", template.render(self)
|
122
|
+
end
|
123
|
+
|
124
|
+
test "using :escape_html => true option" do
|
125
|
+
template = Tilt::ErubiTemplate.new(nil, :escape_html => true) { |t| %(<%= "<p>Hello World!</p>" %>) }
|
126
|
+
assert_equal "<p>Hello World!</p>", template.render
|
127
|
+
end
|
128
|
+
|
129
|
+
test "using :escape_html => false option" do
|
130
|
+
template = Tilt::ErubiTemplate.new(nil, :escape_html => false) { |t| %(<%= "<p>Hello World!</p>" %>) }
|
131
|
+
assert_equal "<p>Hello World!</p>", template.render
|
132
|
+
end
|
133
|
+
|
134
|
+
test "erubi default does not escape html" do
|
135
|
+
template = Tilt::ErubiTemplate.new { |t| %(<%= "<p>Hello World!</p>" %>) }
|
136
|
+
assert_equal "<p>Hello World!</p>", template.render
|
137
|
+
end
|
138
|
+
|
139
|
+
test "does not modify options argument" do
|
140
|
+
options_hash = {:escape_html => true}
|
141
|
+
Tilt::ErubiTemplate.new(nil, options_hash) { |t| "Hello World!" }
|
142
|
+
assert_equal({:escape_html => true}, options_hash)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
rescue LoadError
|
146
|
+
warn "Tilt::ErubiTemplate (disabled)"
|
147
|
+
end
|
148
|
+
|
149
|
+
__END__
|
150
|
+
<html>
|
151
|
+
<body>
|
152
|
+
<h1>Hey <%= name %>!</h1>
|
153
|
+
|
154
|
+
|
155
|
+
<p><% fail %></p>
|
156
|
+
</body>
|
157
|
+
</html>
|
158
|
+
|
@@ -55,7 +55,7 @@ class EtanniTemplateTest < Minitest::Test
|
|
55
55
|
assert_kind_of NameError, boom
|
56
56
|
line = boom.backtrace.grep(/^test\.etn:/).first
|
57
57
|
assert line, "Backtrace didn't contain test.etn"
|
58
|
-
|
58
|
+
_file, line, _meth = line.split(":")
|
59
59
|
assert_equal '13', line
|
60
60
|
end
|
61
61
|
end
|
@@ -70,7 +70,7 @@ class EtanniTemplateTest < Minitest::Test
|
|
70
70
|
rescue => boom
|
71
71
|
assert_kind_of RuntimeError, boom
|
72
72
|
line = boom.backtrace.first
|
73
|
-
file, line,
|
73
|
+
file, line, _meth = line.split(":")
|
74
74
|
assert_equal 'test.etn', file
|
75
75
|
assert_equal '6', line
|
76
76
|
end
|
@@ -141,7 +141,7 @@ class CompiledEtanniTemplateTest < Minitest::Test
|
|
141
141
|
line = boom.backtrace.first
|
142
142
|
line = boom.backtrace.grep(/^test\.etn:/).first
|
143
143
|
assert line, "Backtrace didn't contain test.etn"
|
144
|
-
|
144
|
+
_file, line, _meth = line.split(":")
|
145
145
|
assert_equal '13', line
|
146
146
|
end
|
147
147
|
end
|
@@ -156,7 +156,7 @@ class CompiledEtanniTemplateTest < Minitest::Test
|
|
156
156
|
rescue => boom
|
157
157
|
assert_kind_of RuntimeError, boom
|
158
158
|
line = boom.backtrace.first
|
159
|
-
file, line,
|
159
|
+
file, line, _meth = line.split(":")
|
160
160
|
assert_equal 'test.etn', file
|
161
161
|
assert_equal '6', line
|
162
162
|
end
|
@@ -61,7 +61,7 @@ begin
|
|
61
61
|
assert_kind_of NameError, boom
|
62
62
|
line = boom.backtrace.grep(/^test\.haml:/).first
|
63
63
|
assert line, "Backtrace didn't contain test.haml"
|
64
|
-
|
64
|
+
_file, line, _meth = line.split(":")
|
65
65
|
assert_equal '12', line
|
66
66
|
end
|
67
67
|
end
|
@@ -71,11 +71,11 @@ begin
|
|
71
71
|
fail unless data[0] == ?%
|
72
72
|
template = Tilt::HamlTemplate.new('test.haml') { data }
|
73
73
|
begin
|
74
|
-
|
74
|
+
template.render(Object.new, :name => 'Joe', :foo => 'bar')
|
75
75
|
rescue => boom
|
76
76
|
assert_kind_of MockError, boom
|
77
77
|
line = boom.backtrace.first
|
78
|
-
file, line,
|
78
|
+
file, line, _meth = line.split(":")
|
79
79
|
assert_equal 'test.haml', file
|
80
80
|
assert_equal '5', line
|
81
81
|
end
|
@@ -132,7 +132,7 @@ begin
|
|
132
132
|
assert_kind_of NameError, boom
|
133
133
|
line = boom.backtrace.grep(/^test\.haml:/).first
|
134
134
|
assert line, "Backtrace didn't contain test.haml"
|
135
|
-
|
135
|
+
_file, line, _meth = line.split(":")
|
136
136
|
assert_equal '12', line
|
137
137
|
end
|
138
138
|
end
|
@@ -142,17 +142,17 @@ begin
|
|
142
142
|
fail unless data[0] == ?%
|
143
143
|
template = Tilt::HamlTemplate.new('test.haml') { data }
|
144
144
|
begin
|
145
|
-
|
145
|
+
template.render(Scope.new, :name => 'Joe', :foo => 'bar')
|
146
146
|
rescue => boom
|
147
147
|
assert_kind_of MockError, boom
|
148
148
|
line = boom.backtrace.first
|
149
|
-
file, line,
|
149
|
+
file, line, _meth = line.split(":")
|
150
150
|
assert_equal 'test.haml', file
|
151
151
|
assert_equal '5', line
|
152
152
|
end
|
153
153
|
end
|
154
154
|
end
|
155
|
-
rescue LoadError
|
155
|
+
rescue LoadError
|
156
156
|
warn "Tilt::HamlTemplate (disabled)"
|
157
157
|
end
|
158
158
|
|
data/test/tilt_kramdown_test.rb
CHANGED
@@ -24,6 +24,15 @@ begin
|
|
24
24
|
assert_equal "Hey Joe!", template.render(nil, :name => 'Joe')
|
25
25
|
end
|
26
26
|
|
27
|
+
test "options can be set" do
|
28
|
+
err = assert_raises(Liquid::SyntaxError) do
|
29
|
+
options = { line_numbers: false, error_mode: :strict }
|
30
|
+
Tilt::LiquidTemplate.new(options) { "{{%%%}}" }.render
|
31
|
+
end
|
32
|
+
assert_equal 'Liquid syntax error: Unexpected character % in "{{%%%}}"',
|
33
|
+
err.message
|
34
|
+
end
|
35
|
+
|
27
36
|
# Object's passed as "scope" to LiquidTemplate may respond to
|
28
37
|
# #to_h with a Hash. The Hash's contents are merged underneath
|
29
38
|
# Tilt locals.
|
@@ -73,6 +82,6 @@ begin
|
|
73
82
|
end
|
74
83
|
end
|
75
84
|
|
76
|
-
rescue LoadError
|
85
|
+
rescue LoadError
|
77
86
|
warn "Tilt::LiquidTemplate (disabled)"
|
78
87
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'tilt'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'tilt/livescript'
|
6
|
+
|
7
|
+
class LiveScriptTemplateTest < Minitest::Test
|
8
|
+
setup do
|
9
|
+
@code_without_variables = "puts 'Hello, World!'\n"
|
10
|
+
@renderer = Tilt::LiveScriptTemplate
|
11
|
+
end
|
12
|
+
|
13
|
+
test "compiles and evaluates the template on #render" do
|
14
|
+
template = @renderer.new { |t| @code_without_variables }
|
15
|
+
assert_match "puts('Hello, World!');", template.render
|
16
|
+
end
|
17
|
+
|
18
|
+
test "can be rendered more than once" do
|
19
|
+
template = @renderer.new { |t| @code_without_variables }
|
20
|
+
3.times { assert_match "puts('Hello, World!');", template.render }
|
21
|
+
end
|
22
|
+
|
23
|
+
test "supports bare-option" do
|
24
|
+
template = @renderer.new(:bare => false) { |t| @code_without_variables }
|
25
|
+
assert_match "function", template.render
|
26
|
+
|
27
|
+
template = @renderer.new(:bare => true) { |t| @code_without_variables }
|
28
|
+
refute_match "function", template.render
|
29
|
+
end
|
30
|
+
|
31
|
+
test "is registered for '.ls' files" do
|
32
|
+
assert_equal @renderer, Tilt['test.ls']
|
33
|
+
end
|
34
|
+
end
|
35
|
+
rescue LoadError
|
36
|
+
warn "Tilt::LiveScriptTemplate (disabled)"
|
37
|
+
end
|
data/test/tilt_mapping_test.rb
CHANGED
data/test/tilt_markaby_test.rb
CHANGED
data/test/tilt_markdown_test.rb
CHANGED
@@ -95,7 +95,7 @@ begin
|
|
95
95
|
def test_smarty_pants_true
|
96
96
|
# Various versions of Redcarpet support various versions of Smart pants.
|
97
97
|
html = nrender "Hello ``World'' -- This is --- a test ...", :smartypants => true
|
98
|
-
assert_match
|
98
|
+
assert_match %r!<p>Hello “World(''|”) – This is — a test …<\/p>!, html
|
99
99
|
end
|
100
100
|
|
101
101
|
def test_renderer_options
|
@@ -58,10 +58,10 @@ begin
|
|
58
58
|
|
59
59
|
test "requires arguments without value (e.g. --standalone) to be passed as hash keys (:standalone => true)" do
|
60
60
|
template = Tilt::PandocTemplate.new(:standalone => true) { |t| "# This is a heading" }
|
61
|
-
assert_match
|
61
|
+
assert_match(/^<!DOCTYPE html.*<h1 id="this-is-a-heading">This is a heading<\/h1>.*<\/html>$/m, template.render)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
65
|
-
rescue LoadError
|
65
|
+
rescue LoadError
|
66
66
|
warn "Tilt::PandocTemplate (disabled)"
|
67
67
|
end
|
@@ -11,16 +11,16 @@ begin
|
|
11
11
|
test "preparing and evaluating the template with #render" do
|
12
12
|
template = Tilt::RDocTemplate.new { |t| "= Hello World!" }
|
13
13
|
result = template.render.strip
|
14
|
-
assert_match
|
15
|
-
assert_match
|
14
|
+
assert_match %r(<h1), result
|
15
|
+
assert_match %r(>Hello World!<), result
|
16
16
|
end
|
17
17
|
|
18
18
|
test "can be rendered more than once" do
|
19
19
|
template = Tilt::RDocTemplate.new { |t| "= Hello World!" }
|
20
20
|
3.times do
|
21
21
|
result = template.render.strip
|
22
|
-
assert_match
|
23
|
-
assert_match
|
22
|
+
assert_match %r(<h1), result
|
23
|
+
assert_match %r(>Hello World!<), result
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -38,17 +38,17 @@ begin
|
|
38
38
|
test "smartypants when :smart is set" do
|
39
39
|
template = Tilt::RedcarpetTemplate.new(:smartypants => true) { |t|
|
40
40
|
"OKAY -- 'Smarty Pants'" }
|
41
|
-
assert_match
|
41
|
+
assert_match %r!<p>OKAY – ('|‘)Smarty Pants('|’)<\/p>!,
|
42
42
|
template.render
|
43
43
|
end
|
44
44
|
|
45
45
|
test "smartypants with a rendererer instance" do
|
46
46
|
template = Tilt::RedcarpetTemplate.new(:renderer => Redcarpet::Render::HTML.new(:hard_wrap => true), :smartypants => true) { |t|
|
47
47
|
"OKAY -- 'Smarty Pants'" }
|
48
|
-
assert_match
|
48
|
+
assert_match %r!<p>OKAY – ('|‘)Smarty Pants('|’)<\/p>!,
|
49
49
|
template.render
|
50
50
|
end
|
51
51
|
end
|
52
|
-
rescue LoadError
|
52
|
+
rescue LoadError
|
53
53
|
warn "Tilt::RedcarpetTemplate (disabled)"
|
54
54
|
end
|
@@ -24,7 +24,7 @@ begin
|
|
24
24
|
test "doens't use markdown options" do
|
25
25
|
template = Tilt::RstPandocTemplate.new(:escape_html => true) { |t| "HELLO <blink>WORLD</blink>" }
|
26
26
|
err = assert_raises(RuntimeError) { template.render }
|
27
|
-
assert_match
|
27
|
+
assert_match %r(pandoc: unrecognized option `--escape-html), err.message
|
28
28
|
end
|
29
29
|
end
|
30
30
|
rescue LoadError => boom
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'tilt'
|
3
|
+
require 'tilt/sigil'
|
4
|
+
|
5
|
+
system('sigil -v')
|
6
|
+
|
7
|
+
if $?.success?
|
8
|
+
class SigilTemplateTest < Minitest::Test
|
9
|
+
test "registered for '.sigil' files" do
|
10
|
+
assert_equal Tilt::SigilTemplate, Tilt['test.sigil']
|
11
|
+
end
|
12
|
+
|
13
|
+
test "loading and evaluating templates on #render" do
|
14
|
+
template = Tilt::SigilTemplate.new { |t| "Hello World!" }
|
15
|
+
assert_equal "Hello World!", template.render
|
16
|
+
end
|
17
|
+
|
18
|
+
test "can be rendered more than once" do
|
19
|
+
template = Tilt::SigilTemplate.new { |t| "Hello World!" }
|
20
|
+
3.times { assert_equal "Hello World!", template.render }
|
21
|
+
end
|
22
|
+
|
23
|
+
test "passing locals" do
|
24
|
+
template = Tilt::SigilTemplate.new { 'Hey $name!' }
|
25
|
+
assert_equal "Hey Joe!", template.render(Object.new, :name => 'Joe')
|
26
|
+
end
|
27
|
+
|
28
|
+
test "error message" do
|
29
|
+
template = Tilt::SigilTemplate.new('test.sigil') { '{{undef_func}}' }
|
30
|
+
begin
|
31
|
+
template.render
|
32
|
+
fail 'should have raised an exception'
|
33
|
+
rescue => boom
|
34
|
+
assert_kind_of RuntimeError, boom
|
35
|
+
assert_equal 'template: test.sigil:1: function "undef_func" not defined', boom.message
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
else
|
40
|
+
warn "Tilt::SigilTemplate (disabled)"
|
41
|
+
end
|
@@ -51,7 +51,7 @@ class StringTemplateTest < Minitest::Test
|
|
51
51
|
assert_kind_of NameError, boom
|
52
52
|
line = boom.backtrace.grep(/^test\.str:/).first
|
53
53
|
assert line, "Backtrace didn't contain test.str"
|
54
|
-
|
54
|
+
_file, line, _meth = line.split(":")
|
55
55
|
assert_equal '13', line
|
56
56
|
end
|
57
57
|
end
|
@@ -66,7 +66,7 @@ class StringTemplateTest < Minitest::Test
|
|
66
66
|
rescue => boom
|
67
67
|
assert_kind_of RuntimeError, boom
|
68
68
|
line = boom.backtrace.first
|
69
|
-
file, line,
|
69
|
+
file, line, _meth = line.split(":")
|
70
70
|
assert_equal 'test.str', file
|
71
71
|
assert_equal '6', line
|
72
72
|
end
|
@@ -138,7 +138,7 @@ class CompiledStringTemplateTest < Minitest::Test
|
|
138
138
|
line = boom.backtrace.first
|
139
139
|
line = boom.backtrace.grep(/^test\.str:/).first
|
140
140
|
assert line, "Backtrace didn't contain test.str"
|
141
|
-
|
141
|
+
_file, line, _meth = line.split(":")
|
142
142
|
assert_equal '13', line
|
143
143
|
end
|
144
144
|
end
|
@@ -153,7 +153,7 @@ class CompiledStringTemplateTest < Minitest::Test
|
|
153
153
|
rescue => boom
|
154
154
|
assert_kind_of RuntimeError, boom
|
155
155
|
line = boom.backtrace.first
|
156
|
-
file, line,
|
156
|
+
file, line, _meth = line.split(":")
|
157
157
|
assert_equal 'test.str', file
|
158
158
|
assert_equal '6', line
|
159
159
|
end
|
data/test/tilt_template_test.rb
CHANGED
@@ -132,6 +132,12 @@ class TiltTemplateTest < Minitest::Test
|
|
132
132
|
assert inst.prepared?
|
133
133
|
end
|
134
134
|
|
135
|
+
test "template_source with locals of strings" do
|
136
|
+
inst = SourceGeneratingMockTemplate.new { |t| 'Hey #{name}!' }
|
137
|
+
assert_equal "Hey Joe!", inst.render(Object.new, 'name' => 'Joe', :name=>'Joe')
|
138
|
+
assert inst.prepared?
|
139
|
+
end
|
140
|
+
|
135
141
|
test "template_source with locals having non-variable keys raises error" do
|
136
142
|
inst = SourceGeneratingMockTemplate.new { |t| '1 + 2 = #{_answer}' }
|
137
143
|
err = assert_raises(RuntimeError) { inst.render(Object.new, 'ANSWER' => 3) }
|
@@ -21,7 +21,7 @@ begin
|
|
21
21
|
|
22
22
|
test "supports source map" do
|
23
23
|
template = Tilt::TypeScriptTemplate.new(inlineSourceMap: true) { @ts }
|
24
|
-
assert_match
|
24
|
+
assert_match %r(sourceMappingURL), template.render
|
25
25
|
end
|
26
26
|
|
27
27
|
test "can be rendered more than once" do
|
@@ -29,6 +29,6 @@ begin
|
|
29
29
|
3.times { assert_match @js, template.render }
|
30
30
|
end
|
31
31
|
end
|
32
|
-
rescue LoadError
|
32
|
+
rescue LoadError
|
33
33
|
warn "Tilt::TypeScriptTemplate (disabled)"
|
34
34
|
end
|
@@ -19,14 +19,14 @@ begin
|
|
19
19
|
|
20
20
|
test "compiles and evaluates the template on #render" do
|
21
21
|
template = Tilt::WikiClothTemplate.new { |t| "= Hello World! =" }
|
22
|
-
assert_match
|
22
|
+
assert_match(/<h1>.*Hello World!.*<\/h1>/m, template.render)
|
23
23
|
end
|
24
24
|
|
25
25
|
test "can be rendered more than once" do
|
26
26
|
template = Tilt::WikiClothTemplate.new { |t| "= Hello World! =" }
|
27
|
-
3.times { assert_match
|
27
|
+
3.times { assert_match(/<h1>.*Hello World!.*<\/h1>/m, template.render) }
|
28
28
|
end
|
29
29
|
end
|
30
|
-
rescue LoadError
|
30
|
+
rescue LoadError
|
31
31
|
warn "Tilt::WikiClothTemplate (disabled)"
|
32
32
|
end
|
data/tilt.gemspec
CHANGED
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
4
4
|
|
5
5
|
s.name = 'tilt'
|
6
|
-
s.version = '2.0.
|
7
|
-
s.date = '
|
6
|
+
s.version = '2.0.6'
|
7
|
+
s.date = '2017-01-26'
|
8
8
|
|
9
9
|
s.description = "Generic interface to multiple Ruby template engines"
|
10
10
|
s.summary = s.description
|
@@ -35,12 +35,14 @@ Gem::Specification.new do |s|
|
|
35
35
|
lib/tilt/csv.rb
|
36
36
|
lib/tilt/dummy.rb
|
37
37
|
lib/tilt/erb.rb
|
38
|
+
lib/tilt/erubi.rb
|
38
39
|
lib/tilt/erubis.rb
|
39
40
|
lib/tilt/etanni.rb
|
40
41
|
lib/tilt/haml.rb
|
41
42
|
lib/tilt/kramdown.rb
|
42
43
|
lib/tilt/less.rb
|
43
44
|
lib/tilt/liquid.rb
|
45
|
+
lib/tilt/livescript.rb
|
44
46
|
lib/tilt/mapping.rb
|
45
47
|
lib/tilt/markaby.rb
|
46
48
|
lib/tilt/maruku.rb
|
@@ -55,6 +57,7 @@ Gem::Specification.new do |s|
|
|
55
57
|
lib/tilt/redcloth.rb
|
56
58
|
lib/tilt/rst-pandoc.rb
|
57
59
|
lib/tilt/sass.rb
|
60
|
+
lib/tilt/sigil.rb
|
58
61
|
lib/tilt/string.rb
|
59
62
|
lib/tilt/template.rb
|
60
63
|
lib/tilt/typescript.rb
|
@@ -82,12 +85,14 @@ Gem::Specification.new do |s|
|
|
82
85
|
test/tilt_csv_test.rb
|
83
86
|
test/tilt_erbtemplate_test.rb
|
84
87
|
test/tilt_erubistemplate_test.rb
|
88
|
+
test/tilt_erubitemplate_test.rb
|
85
89
|
test/tilt_etannitemplate_test.rb
|
86
90
|
test/tilt_hamltemplate_test.rb
|
87
91
|
test/tilt_kramdown_test.rb
|
88
92
|
test/tilt_lesstemplate_test.less
|
89
93
|
test/tilt_lesstemplate_test.rb
|
90
94
|
test/tilt_liquidtemplate_test.rb
|
95
|
+
test/tilt_livescripttemplate_test.rb
|
91
96
|
test/tilt_mapping_test.rb
|
92
97
|
test/tilt_markaby_test.rb
|
93
98
|
test/tilt_markdown_test.rb
|
@@ -104,6 +109,7 @@ Gem::Specification.new do |s|
|
|
104
109
|
test/tilt_redclothtemplate_test.rb
|
105
110
|
test/tilt_rstpandoctemplate_test.rb
|
106
111
|
test/tilt_sasstemplate_test.rb
|
112
|
+
test/tilt_sigil_test.rb
|
107
113
|
test/tilt_stringtemplate_test.rb
|
108
114
|
test/tilt_template_test.rb
|
109
115
|
test/tilt_test.rb
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tilt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Tomayko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Generic interface to multiple Ruby template engines
|
14
14
|
email: r@tomayko.com
|
@@ -37,12 +37,14 @@ files:
|
|
37
37
|
- lib/tilt/csv.rb
|
38
38
|
- lib/tilt/dummy.rb
|
39
39
|
- lib/tilt/erb.rb
|
40
|
+
- lib/tilt/erubi.rb
|
40
41
|
- lib/tilt/erubis.rb
|
41
42
|
- lib/tilt/etanni.rb
|
42
43
|
- lib/tilt/haml.rb
|
43
44
|
- lib/tilt/kramdown.rb
|
44
45
|
- lib/tilt/less.rb
|
45
46
|
- lib/tilt/liquid.rb
|
47
|
+
- lib/tilt/livescript.rb
|
46
48
|
- lib/tilt/mapping.rb
|
47
49
|
- lib/tilt/markaby.rb
|
48
50
|
- lib/tilt/maruku.rb
|
@@ -57,6 +59,7 @@ files:
|
|
57
59
|
- lib/tilt/redcloth.rb
|
58
60
|
- lib/tilt/rst-pandoc.rb
|
59
61
|
- lib/tilt/sass.rb
|
62
|
+
- lib/tilt/sigil.rb
|
60
63
|
- lib/tilt/string.rb
|
61
64
|
- lib/tilt/template.rb
|
62
65
|
- lib/tilt/typescript.rb
|
@@ -84,12 +87,14 @@ files:
|
|
84
87
|
- test/tilt_csv_test.rb
|
85
88
|
- test/tilt_erbtemplate_test.rb
|
86
89
|
- test/tilt_erubistemplate_test.rb
|
90
|
+
- test/tilt_erubitemplate_test.rb
|
87
91
|
- test/tilt_etannitemplate_test.rb
|
88
92
|
- test/tilt_hamltemplate_test.rb
|
89
93
|
- test/tilt_kramdown_test.rb
|
90
94
|
- test/tilt_lesstemplate_test.less
|
91
95
|
- test/tilt_lesstemplate_test.rb
|
92
96
|
- test/tilt_liquidtemplate_test.rb
|
97
|
+
- test/tilt_livescripttemplate_test.rb
|
93
98
|
- test/tilt_mapping_test.rb
|
94
99
|
- test/tilt_markaby_test.rb
|
95
100
|
- test/tilt_markdown_test.rb
|
@@ -106,6 +111,7 @@ files:
|
|
106
111
|
- test/tilt_redclothtemplate_test.rb
|
107
112
|
- test/tilt_rstpandoctemplate_test.rb
|
108
113
|
- test/tilt_sasstemplate_test.rb
|
114
|
+
- test/tilt_sigil_test.rb
|
109
115
|
- test/tilt_stringtemplate_test.rb
|
110
116
|
- test/tilt_template_test.rb
|
111
117
|
- test/tilt_test.rb
|
@@ -155,11 +161,13 @@ test_files:
|
|
155
161
|
- test/tilt_csv_test.rb
|
156
162
|
- test/tilt_erbtemplate_test.rb
|
157
163
|
- test/tilt_erubistemplate_test.rb
|
164
|
+
- test/tilt_erubitemplate_test.rb
|
158
165
|
- test/tilt_etannitemplate_test.rb
|
159
166
|
- test/tilt_hamltemplate_test.rb
|
160
167
|
- test/tilt_kramdown_test.rb
|
161
168
|
- test/tilt_lesstemplate_test.rb
|
162
169
|
- test/tilt_liquidtemplate_test.rb
|
170
|
+
- test/tilt_livescripttemplate_test.rb
|
163
171
|
- test/tilt_mapping_test.rb
|
164
172
|
- test/tilt_markaby_test.rb
|
165
173
|
- test/tilt_markdown_test.rb
|
@@ -175,6 +183,7 @@ test_files:
|
|
175
183
|
- test/tilt_redclothtemplate_test.rb
|
176
184
|
- test/tilt_rstpandoctemplate_test.rb
|
177
185
|
- test/tilt_sasstemplate_test.rb
|
186
|
+
- test/tilt_sigil_test.rb
|
178
187
|
- test/tilt_stringtemplate_test.rb
|
179
188
|
- test/tilt_template_test.rb
|
180
189
|
- test/tilt_test.rb
|