tilt 2.0.7 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile +3 -5
- data/lib/tilt.rb +2 -2
- data/lib/tilt/commonmarker.rb +1 -1
- data/lib/tilt/haml.rb +65 -37
- data/lib/tilt/template.rb +1 -0
- data/test/tilt_typescript_test.rb +4 -0
- data/tilt.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d73cf811e4d1767fcb602eef69ec1d957eb72919
|
4
|
+
data.tar.gz: 30723694d8d6d8f45d1b073d3cd1403358636414
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b94f99935c3135724349c3f6ff87f22b4dea1569b0be12624c5f7728721b10587c924030d176d3b53ad54a087acc683556ab47983ed0eb1ba3ab960c4ea1898
|
7
|
+
data.tar.gz: 84ea12c485ab60ad8255dfb2a5b26ac4879353290219346de4ac3351b9049ef79bdba3e00380009d9ca0e513edc3c9abf5437b17c0a22d051c4c5946b06db5ab
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## master
|
2
|
+
|
3
|
+
## 2.0.8 (2017-07-24)
|
4
|
+
|
5
|
+
* Register .tsx for TypeScript (#315, backus)
|
6
|
+
* Use Haml 5's new API (#312, k0kubun)
|
7
|
+
* Use correct parser options for CommonMarker (#320, rewritten)
|
8
|
+
* Suppress warnings when no locals are used (#304, amatsuda)
|
9
|
+
* Haml: Accept `outvar` (#317, k0kubun)
|
10
|
+
|
1
11
|
## 2.0.7 (2017-03-19)
|
2
12
|
|
3
13
|
* Do not modify BasicObject during template compilation on ruby 2.0+ (#309, jeremyevans)
|
data/Gemfile
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
+
gemspec
|
4
|
+
|
3
5
|
gem 'rake'
|
4
6
|
gem 'minitest', '~> 5.0'
|
5
7
|
|
@@ -12,7 +14,7 @@ can_execjs = (RUBY_VERSION >= '1.9.3')
|
|
12
14
|
|
13
15
|
group :primary do
|
14
16
|
gem 'builder'
|
15
|
-
gem 'haml', '>= 2.
|
17
|
+
gem 'haml', '>= 4' if RUBY_VERSION >= '2.0.0'
|
16
18
|
gem 'erubis'
|
17
19
|
gem 'markaby'
|
18
20
|
gem 'sass'
|
@@ -61,7 +63,3 @@ group :secondary do
|
|
61
63
|
end
|
62
64
|
end
|
63
65
|
|
64
|
-
## WHY do I have to do this?!?
|
65
|
-
platform :rbx do
|
66
|
-
gem 'rubysl'
|
67
|
-
end
|
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.8'
|
8
8
|
|
9
9
|
@default_mapping = Mapping.new
|
10
10
|
|
@@ -153,7 +153,7 @@ module Tilt
|
|
153
153
|
register_lazy :ScssTemplate, 'tilt/sass', 'scss'
|
154
154
|
register_lazy :SigilTemplate, 'tilt/sigil', 'sigil'
|
155
155
|
register_lazy :StringTemplate, 'tilt/string', 'str'
|
156
|
-
register_lazy :TypeScriptTemplate, 'tilt/typescript', 'ts'
|
156
|
+
register_lazy :TypeScriptTemplate, 'tilt/typescript', 'ts', 'tsx'
|
157
157
|
register_lazy :WikiClothTemplate, 'tilt/wikicloth', 'wiki', 'mediawiki', 'mw'
|
158
158
|
register_lazy :YajlTemplate, 'tilt/yajl', 'yajl'
|
159
159
|
|
data/lib/tilt/commonmarker.rb
CHANGED
data/lib/tilt/haml.rb
CHANGED
@@ -7,51 +7,79 @@ module Tilt
|
|
7
7
|
class HamlTemplate < Template
|
8
8
|
self.default_mime_type = 'text/html'
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
# `Gem::Version.correct?` may return false because of Haml::VERSION #=> "3.1.8 (Separated Sally)". After Haml 4, it's always correct.
|
11
|
+
if Gem::Version.correct?(Haml::VERSION) && Gem::Version.new(Haml::VERSION) >= Gem::Version.new('5.0.0.beta.2')
|
12
|
+
def prepare
|
13
|
+
options = {}.update(@options).update(filename: eval_file, line: line)
|
14
|
+
if options.include?(:outvar)
|
15
|
+
options[:buffer] = options.delete(:outvar)
|
16
|
+
options[:save_buffer] = true
|
17
|
+
end
|
18
|
+
@engine = ::Haml::TempleEngine.new(options)
|
19
|
+
@engine.compile(data)
|
20
|
+
end
|
17
21
|
|
18
|
-
|
22
|
+
def evaluate(scope, locals, &block)
|
23
|
+
raise ArgumentError, 'invalid scope: must not be frozen' if scope.frozen?
|
19
24
|
super
|
20
|
-
else
|
21
|
-
@engine.render(scope, locals, &block)
|
22
25
|
end
|
23
|
-
end
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
@engine.precompiled
|
30
|
-
end
|
31
|
-
|
32
|
-
def precompiled_preamble(locals)
|
33
|
-
local_assigns = super
|
34
|
-
@engine.instance_eval do
|
35
|
-
<<-RUBY
|
36
|
-
begin
|
37
|
-
extend Haml::Helpers
|
38
|
-
_hamlout = @haml_buffer = Haml::Buffer.new(@haml_buffer, #{options_for_buffer.inspect})
|
39
|
-
_erbout = _hamlout.buffer
|
27
|
+
def precompiled_template(locals)
|
28
|
+
@engine.precompiled_with_ambles(
|
29
|
+
[],
|
30
|
+
after_preamble: <<-RUBY
|
40
31
|
__in_erb_template = true
|
41
32
|
_haml_locals = locals
|
42
|
-
|
43
|
-
|
33
|
+
RUBY
|
34
|
+
)
|
35
|
+
end
|
36
|
+
else # Following definitions are for Haml <= 4 and deprecated.
|
37
|
+
def prepare
|
38
|
+
options = @options.merge(:filename => eval_file, :line => line)
|
39
|
+
@engine = ::Haml::Engine.new(data, options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def evaluate(scope, locals, &block)
|
43
|
+
raise ArgumentError, 'invalid scope: must not be frozen' if scope.frozen?
|
44
|
+
|
45
|
+
if @engine.respond_to?(:precompiled_method_return_value, true)
|
46
|
+
super
|
47
|
+
else
|
48
|
+
@engine.render(scope, locals, &block)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Precompiled Haml source. Taken from the precompiled_with_ambles
|
53
|
+
# method in Haml::Precompiler:
|
54
|
+
# http://github.com/nex3/haml/blob/master/lib/haml/precompiler.rb#L111-126
|
55
|
+
def precompiled_template(locals)
|
56
|
+
@engine.precompiled
|
57
|
+
end
|
58
|
+
|
59
|
+
def precompiled_preamble(locals)
|
60
|
+
local_assigns = super
|
61
|
+
@engine.instance_eval do
|
62
|
+
<<-RUBY
|
63
|
+
begin
|
64
|
+
extend Haml::Helpers
|
65
|
+
_hamlout = @haml_buffer = Haml::Buffer.new(@haml_buffer, #{options_for_buffer.inspect})
|
66
|
+
_erbout = _hamlout.buffer
|
67
|
+
__in_erb_template = true
|
68
|
+
_haml_locals = locals
|
69
|
+
#{local_assigns}
|
70
|
+
RUBY
|
71
|
+
end
|
44
72
|
end
|
45
|
-
end
|
46
73
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
74
|
+
def precompiled_postamble(locals)
|
75
|
+
@engine.instance_eval do
|
76
|
+
<<-RUBY
|
77
|
+
#{precompiled_method_return_value}
|
78
|
+
ensure
|
79
|
+
@haml_buffer = @haml_buffer.upper if @haml_buffer
|
80
|
+
end
|
81
|
+
RUBY
|
82
|
+
end
|
55
83
|
end
|
56
84
|
end
|
57
85
|
end
|
data/lib/tilt/template.rb
CHANGED
@@ -14,6 +14,10 @@ begin
|
|
14
14
|
assert_equal Tilt::TypeScriptTemplate, Tilt['test.ts']
|
15
15
|
end
|
16
16
|
|
17
|
+
test "is registered for '.tsx' files" do
|
18
|
+
assert_equal Tilt::TypeScriptTemplate, Tilt['test.tsx']
|
19
|
+
end
|
20
|
+
|
17
21
|
test "compiles and evaluates the template on #render" do
|
18
22
|
template = Tilt::TypeScriptTemplate.new { @ts }
|
19
23
|
assert_match @js, template.render
|
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 = '2017-
|
6
|
+
s.version = '2.0.8'
|
7
|
+
s.date = '2017-07-24'
|
8
8
|
|
9
9
|
s.description = "Generic interface to multiple Ruby template engines"
|
10
10
|
s.summary = s.description
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Tomayko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Generic interface to multiple Ruby template engines
|
14
14
|
email: r@tomayko.com
|
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
version: '0'
|
146
146
|
requirements: []
|
147
147
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.6.
|
148
|
+
rubygems_version: 2.6.11
|
149
149
|
signing_key:
|
150
150
|
specification_version: 2
|
151
151
|
summary: Generic interface to multiple Ruby template engines
|