tilt 2.0.11 → 2.6.1
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/COPYING +1 -0
- data/bin/tilt +2 -120
- data/lib/tilt/_emacs_org.rb +2 -0
- data/lib/tilt/_handlebars.rb +2 -0
- data/lib/tilt/_jbuilder.rb +2 -0
- data/lib/tilt/_org.rb +2 -0
- data/lib/tilt/asciidoc.rb +11 -23
- data/lib/tilt/babel.rb +5 -13
- data/lib/tilt/builder.rb +18 -13
- data/lib/tilt/cli.rb +134 -0
- data/lib/tilt/coffee.rb +12 -31
- data/lib/tilt/commonmarker.rb +82 -75
- data/lib/tilt/creole.rb +10 -19
- data/lib/tilt/csv.rb +6 -18
- data/lib/tilt/erb.rb +23 -21
- data/lib/tilt/erubi.rb +29 -6
- data/lib/tilt/etanni.rb +5 -4
- data/lib/tilt/haml.rb +73 -65
- data/lib/tilt/kramdown.rb +8 -20
- data/lib/tilt/liquid.rb +10 -17
- data/lib/tilt/livescript.rb +8 -20
- data/lib/tilt/mapping.rb +228 -109
- data/lib/tilt/markaby.rb +5 -7
- data/lib/tilt/nokogiri.rb +11 -10
- data/lib/tilt/pandoc.rb +33 -51
- data/lib/tilt/pipeline.rb +19 -0
- data/lib/tilt/plain.rb +4 -15
- data/lib/tilt/prawn.rb +10 -25
- data/lib/tilt/radius.rb +15 -22
- data/lib/tilt/rdiscount.rb +17 -33
- data/lib/tilt/rdoc.rb +6 -35
- data/lib/tilt/redcarpet.rb +20 -75
- data/lib/tilt/redcloth.rb +9 -19
- data/lib/tilt/rst-pandoc.rb +7 -20
- data/lib/tilt/sass.rb +43 -43
- data/lib/tilt/slim.rb +5 -0
- data/lib/tilt/string.rb +9 -3
- data/lib/tilt/template.rb +392 -89
- data/lib/tilt/typescript.rb +11 -18
- data/lib/tilt/yajl.rb +5 -11
- data/lib/tilt.rb +68 -43
- metadata +21 -18
- data/lib/tilt/bluecloth.rb +0 -24
- data/lib/tilt/dummy.rb +0 -3
- data/lib/tilt/erubis.rb +0 -43
- data/lib/tilt/less.rb +0 -30
- data/lib/tilt/maruku.rb +0 -22
- data/lib/tilt/sigil.rb +0 -34
- data/lib/tilt/wikicloth.rb +0 -22
data/lib/tilt/yajl.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'template'
|
2
3
|
require 'yajl'
|
3
4
|
|
4
5
|
module Tilt
|
5
|
-
|
6
6
|
# Yajl Template implementation
|
7
7
|
#
|
8
8
|
# Yajl is a fast JSON parsing and encoding library for Ruby
|
@@ -40,14 +40,10 @@ module Tilt
|
|
40
40
|
# template.render(self)
|
41
41
|
#
|
42
42
|
class YajlTemplate < Template
|
43
|
-
|
44
43
|
self.default_mime_type = 'application/json'
|
45
44
|
|
46
|
-
def prepare
|
47
|
-
end
|
48
|
-
|
49
45
|
def evaluate(scope, locals, &block)
|
50
|
-
decorate
|
46
|
+
decorate(super)
|
51
47
|
end
|
52
48
|
|
53
49
|
def precompiled_preamble(locals)
|
@@ -60,10 +56,9 @@ module Tilt
|
|
60
56
|
end
|
61
57
|
|
62
58
|
def precompiled_template(locals)
|
63
|
-
data.to_str
|
59
|
+
@data.to_str
|
64
60
|
end
|
65
61
|
|
66
|
-
|
67
62
|
# Decorates the +json+ input according to given +options+.
|
68
63
|
#
|
69
64
|
# json - The json String to decorate.
|
@@ -71,7 +66,7 @@ module Tilt
|
|
71
66
|
#
|
72
67
|
# Returns the decorated String.
|
73
68
|
def decorate(json)
|
74
|
-
callback, variable = options[:callback], options[:variable]
|
69
|
+
callback, variable = @options[:callback], @options[:variable]
|
75
70
|
if callback && variable
|
76
71
|
"var #{variable} = #{json}; #{callback}(#{variable});"
|
77
72
|
elsif variable
|
@@ -83,5 +78,4 @@ module Tilt
|
|
83
78
|
end
|
84
79
|
end
|
85
80
|
end
|
86
|
-
|
87
81
|
end
|
data/lib/tilt.rb
CHANGED
@@ -1,73 +1,101 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'tilt/mapping'
|
3
|
+
require_relative 'tilt/template'
|
3
4
|
|
4
5
|
# Namespace for Tilt. This module is not intended to be included anywhere.
|
5
6
|
module Tilt
|
6
7
|
# Current version.
|
7
|
-
VERSION = '2.
|
8
|
+
VERSION = '2.6.1'
|
9
|
+
|
10
|
+
EMPTY_ARRAY = [].freeze
|
11
|
+
private_constant :EMPTY_ARRAY
|
12
|
+
|
13
|
+
EMPTY_HASH = {}.freeze
|
14
|
+
private_constant :EMPTY_HASH
|
8
15
|
|
9
16
|
@default_mapping = Mapping.new
|
17
|
+
@extract_fixed_locals = false
|
18
|
+
|
19
|
+
# Replace the default mapping with a finalized version of the default
|
20
|
+
# mapping. This can be done to improve performance after the template
|
21
|
+
# libraries you desire to use have already been loaded. Once this is
|
22
|
+
# is called, all attempts to modify the default mapping will fail.
|
23
|
+
# This also freezes Tilt itself.
|
24
|
+
def self.finalize!
|
25
|
+
return self if @default_mapping.is_a?(FinalizedMapping)
|
26
|
+
|
27
|
+
class << self
|
28
|
+
prepend(Module.new do
|
29
|
+
def lazy_map(*)
|
30
|
+
raise "Tilt.#{__callee__} not supported after Tilt.finalize! has been called"
|
31
|
+
end
|
32
|
+
alias register lazy_map
|
33
|
+
alias register_lazy lazy_map
|
34
|
+
alias register_pipeline lazy_map
|
35
|
+
alias prefer lazy_map
|
36
|
+
end)
|
37
|
+
end
|
10
38
|
|
11
|
-
|
12
|
-
|
13
|
-
|
39
|
+
@default_mapping = @default_mapping.finalized
|
40
|
+
|
41
|
+
freeze
|
14
42
|
end
|
15
43
|
|
16
44
|
# @private
|
17
45
|
def self.lazy_map
|
18
|
-
default_mapping.lazy_map
|
46
|
+
@default_mapping.lazy_map
|
19
47
|
end
|
20
48
|
|
21
49
|
# @see Tilt::Mapping#register
|
22
50
|
def self.register(template_class, *extensions)
|
23
|
-
default_mapping.register(template_class, *extensions)
|
51
|
+
@default_mapping.register(template_class, *extensions)
|
24
52
|
end
|
25
53
|
|
26
54
|
# @see Tilt::Mapping#register_lazy
|
27
55
|
def self.register_lazy(class_name, file, *extensions)
|
28
|
-
default_mapping.register_lazy(class_name, file, *extensions)
|
56
|
+
@default_mapping.register_lazy(class_name, file, *extensions)
|
29
57
|
end
|
30
58
|
|
31
|
-
# @
|
32
|
-
def self.
|
33
|
-
|
59
|
+
# @see Tilt::Mapping#register_pipeline
|
60
|
+
def self.register_pipeline(ext, options=EMPTY_HASH)
|
61
|
+
@default_mapping.register_pipeline(ext, options)
|
34
62
|
end
|
35
63
|
|
36
64
|
# @see Tilt::Mapping#registered?
|
37
65
|
def self.registered?(ext)
|
38
|
-
default_mapping.registered?(ext)
|
66
|
+
@default_mapping.registered?(ext)
|
39
67
|
end
|
40
68
|
|
41
69
|
# @see Tilt::Mapping#new
|
42
|
-
def self.new(file, line=nil, options=
|
43
|
-
default_mapping.new(file, line, options, &block)
|
70
|
+
def self.new(file, line=nil, options=nil, &block)
|
71
|
+
@default_mapping.new(file, line, options, &block)
|
44
72
|
end
|
45
73
|
|
46
74
|
# @see Tilt::Mapping#[]
|
47
75
|
def self.[](file)
|
48
|
-
default_mapping[file]
|
76
|
+
@default_mapping[file]
|
49
77
|
end
|
50
78
|
|
51
79
|
# @see Tilt::Mapping#template_for
|
52
80
|
def self.template_for(file)
|
53
|
-
default_mapping.template_for(file)
|
81
|
+
@default_mapping.template_for(file)
|
54
82
|
end
|
55
83
|
|
56
84
|
# @see Tilt::Mapping#templates_for
|
57
85
|
def self.templates_for(file)
|
58
|
-
default_mapping.templates_for(file)
|
86
|
+
@default_mapping.templates_for(file)
|
59
87
|
end
|
60
88
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
89
|
+
class << self
|
90
|
+
# @return [Tilt::Mapping] the main mapping object
|
91
|
+
attr_reader :default_mapping
|
92
|
+
|
93
|
+
# Whether to extract fixed locals from templates by scanning the
|
94
|
+
# template content.
|
95
|
+
attr_accessor :extract_fixed_locals
|
96
|
+
|
97
|
+
# Alias register as prefer for Tilt 1.x compatibility.
|
98
|
+
alias prefer register
|
71
99
|
end
|
72
100
|
|
73
101
|
# Extremely simple template cache implementation. Calling applications
|
@@ -110,18 +138,18 @@ module Tilt
|
|
110
138
|
@cache = {}
|
111
139
|
end
|
112
140
|
end
|
113
|
-
|
141
|
+
# :nocov:
|
142
|
+
# TILT3: Remove Tilt::Cache
|
143
|
+
deprecate_constant :Cache if respond_to?(:deprecate_constant, true)
|
144
|
+
# :nocov:
|
114
145
|
|
115
146
|
# Template Implementations ================================================
|
116
147
|
|
117
148
|
# ERB
|
118
149
|
register_lazy :ERBTemplate, 'tilt/erb', 'erb', 'rhtml'
|
119
|
-
register_lazy :ErubisTemplate, 'tilt/erubis', 'erb', 'rhtml', 'erubis'
|
120
150
|
register_lazy :ErubiTemplate, 'tilt/erubi', 'erb', 'rhtml', 'erubi'
|
121
151
|
|
122
152
|
# Markdown
|
123
|
-
register_lazy :BlueClothTemplate, 'tilt/bluecloth', 'markdown', 'mkd', 'md'
|
124
|
-
register_lazy :MarukuTemplate, 'tilt/maruku', 'markdown', 'mkd', 'md'
|
125
153
|
register_lazy :KramdownTemplate, 'tilt/kramdown', 'markdown', 'mkd', 'md'
|
126
154
|
register_lazy :RDiscountTemplate, 'tilt/rdiscount', 'markdown', 'mkd', 'md'
|
127
155
|
register_lazy :RedcarpetTemplate, 'tilt/redcarpet', 'markdown', 'mkd', 'md'
|
@@ -138,9 +166,8 @@ module Tilt
|
|
138
166
|
register_lazy :CreoleTemplate, 'tilt/creole', 'wiki', 'creole'
|
139
167
|
register_lazy :EtanniTemplate, 'tilt/etanni', 'etn', 'etanni'
|
140
168
|
register_lazy :HamlTemplate, 'tilt/haml', 'haml'
|
141
|
-
register_lazy :LessTemplate, 'tilt/less', 'less'
|
142
169
|
register_lazy :LiquidTemplate, 'tilt/liquid', 'liquid'
|
143
|
-
register_lazy :LiveScriptTemplate, 'tilt/livescript','ls'
|
170
|
+
register_lazy :LiveScriptTemplate, 'tilt/livescript','ls', 'livescript'
|
144
171
|
register_lazy :MarkabyTemplate, 'tilt/markaby', 'mab'
|
145
172
|
register_lazy :NokogiriTemplate, 'tilt/nokogiri', 'nokogiri'
|
146
173
|
register_lazy :PlainTemplate, 'tilt/plain', 'html'
|
@@ -151,17 +178,15 @@ module Tilt
|
|
151
178
|
register_lazy :RstPandocTemplate, 'tilt/rst-pandoc', 'rst'
|
152
179
|
register_lazy :SassTemplate, 'tilt/sass', 'sass'
|
153
180
|
register_lazy :ScssTemplate, 'tilt/sass', 'scss'
|
154
|
-
register_lazy :
|
181
|
+
register_lazy :SlimTemplate, 'tilt/slim', 'slim'
|
155
182
|
register_lazy :StringTemplate, 'tilt/string', 'str'
|
156
183
|
register_lazy :TypeScriptTemplate, 'tilt/typescript', 'ts', 'tsx'
|
157
|
-
register_lazy :WikiClothTemplate, 'tilt/wikicloth', 'wiki', 'mediawiki', 'mw'
|
158
184
|
register_lazy :YajlTemplate, 'tilt/yajl', 'yajl'
|
159
185
|
|
160
|
-
#
|
161
|
-
|
162
|
-
register_lazy 'Tilt::HandlebarsTemplate', 'tilt/
|
163
|
-
register_lazy 'Tilt::OrgTemplate', '
|
164
|
-
register_lazy 'Tilt::
|
165
|
-
register_lazy '
|
166
|
-
register_lazy 'Tilt::JbuilderTemplate', 'tilt/jbuilder', 'jbuilder'
|
186
|
+
# TILT3: Remove
|
187
|
+
# Deprecated lazy loading of external template engines
|
188
|
+
register_lazy 'Tilt::HandlebarsTemplate', 'tilt/_handlebars', 'handlebars', 'hbs'
|
189
|
+
register_lazy 'Tilt::OrgTemplate', 'tilt/_org', 'org'
|
190
|
+
register_lazy 'Tilt::OrgTemplate', 'tilt/_emacs_org', 'org'
|
191
|
+
register_lazy 'Tilt::JbuilderTemplate', 'tilt/_jbuilder', 'jbuilder'
|
167
192
|
end
|
metadata
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tilt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Tomayko
|
8
|
-
|
8
|
+
- Magnus Holm
|
9
|
+
- Jeremy Evans
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
13
|
dependencies: []
|
13
14
|
description: Generic interface to multiple Ruby template engines
|
14
|
-
email:
|
15
|
+
email: code@jeremyevans.net
|
15
16
|
executables:
|
16
17
|
- tilt
|
17
18
|
extensions: []
|
@@ -20,29 +21,30 @@ files:
|
|
20
21
|
- COPYING
|
21
22
|
- bin/tilt
|
22
23
|
- lib/tilt.rb
|
24
|
+
- lib/tilt/_emacs_org.rb
|
25
|
+
- lib/tilt/_handlebars.rb
|
26
|
+
- lib/tilt/_jbuilder.rb
|
27
|
+
- lib/tilt/_org.rb
|
23
28
|
- lib/tilt/asciidoc.rb
|
24
29
|
- lib/tilt/babel.rb
|
25
|
-
- lib/tilt/bluecloth.rb
|
26
30
|
- lib/tilt/builder.rb
|
31
|
+
- lib/tilt/cli.rb
|
27
32
|
- lib/tilt/coffee.rb
|
28
33
|
- lib/tilt/commonmarker.rb
|
29
34
|
- lib/tilt/creole.rb
|
30
35
|
- lib/tilt/csv.rb
|
31
|
-
- lib/tilt/dummy.rb
|
32
36
|
- lib/tilt/erb.rb
|
33
37
|
- lib/tilt/erubi.rb
|
34
|
-
- lib/tilt/erubis.rb
|
35
38
|
- lib/tilt/etanni.rb
|
36
39
|
- lib/tilt/haml.rb
|
37
40
|
- lib/tilt/kramdown.rb
|
38
|
-
- lib/tilt/less.rb
|
39
41
|
- lib/tilt/liquid.rb
|
40
42
|
- lib/tilt/livescript.rb
|
41
43
|
- lib/tilt/mapping.rb
|
42
44
|
- lib/tilt/markaby.rb
|
43
|
-
- lib/tilt/maruku.rb
|
44
45
|
- lib/tilt/nokogiri.rb
|
45
46
|
- lib/tilt/pandoc.rb
|
47
|
+
- lib/tilt/pipeline.rb
|
46
48
|
- lib/tilt/plain.rb
|
47
49
|
- lib/tilt/prawn.rb
|
48
50
|
- lib/tilt/radius.rb
|
@@ -52,17 +54,19 @@ files:
|
|
52
54
|
- lib/tilt/redcloth.rb
|
53
55
|
- lib/tilt/rst-pandoc.rb
|
54
56
|
- lib/tilt/sass.rb
|
55
|
-
- lib/tilt/
|
57
|
+
- lib/tilt/slim.rb
|
56
58
|
- lib/tilt/string.rb
|
57
59
|
- lib/tilt/template.rb
|
58
60
|
- lib/tilt/typescript.rb
|
59
|
-
- lib/tilt/wikicloth.rb
|
60
61
|
- lib/tilt/yajl.rb
|
61
|
-
homepage: https://github.com/
|
62
|
+
homepage: https://github.com/jeremyevans/tilt
|
62
63
|
licenses:
|
63
64
|
- MIT
|
64
|
-
metadata:
|
65
|
-
|
65
|
+
metadata:
|
66
|
+
bug_tracker_uri: https://github.com/jeremyevans/tilt/issues
|
67
|
+
changelog_uri: https://github.com/jeremyevans/tilt/blob/master/CHANGELOG.md
|
68
|
+
mailing_list_uri: https://github.com/jeremyevans/tilt/discussions
|
69
|
+
source_code_uri: https://github.com/jeremyevans/tilt
|
66
70
|
rdoc_options:
|
67
71
|
- "--line-numbers"
|
68
72
|
- "--inline-source"
|
@@ -76,15 +80,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
80
|
requirements:
|
77
81
|
- - ">="
|
78
82
|
- !ruby/object:Gem::Version
|
79
|
-
version: '0'
|
83
|
+
version: '2.0'
|
80
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
85
|
requirements:
|
82
86
|
- - ">="
|
83
87
|
- !ruby/object:Gem::Version
|
84
88
|
version: '0'
|
85
89
|
requirements: []
|
86
|
-
rubygems_version: 3.
|
87
|
-
|
88
|
-
specification_version: 2
|
90
|
+
rubygems_version: 3.6.7
|
91
|
+
specification_version: 4
|
89
92
|
summary: Generic interface to multiple Ruby template engines
|
90
93
|
test_files: []
|
data/lib/tilt/bluecloth.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'tilt/template'
|
2
|
-
require 'bluecloth'
|
3
|
-
|
4
|
-
module Tilt
|
5
|
-
# BlueCloth Markdown implementation. See:
|
6
|
-
# http://deveiate.org/projects/BlueCloth/
|
7
|
-
class BlueClothTemplate < Template
|
8
|
-
self.default_mime_type = 'text/html'
|
9
|
-
|
10
|
-
def prepare
|
11
|
-
@engine = BlueCloth.new(data, options)
|
12
|
-
@output = nil
|
13
|
-
end
|
14
|
-
|
15
|
-
def evaluate(scope, locals, &block)
|
16
|
-
@output ||= @engine.to_html
|
17
|
-
end
|
18
|
-
|
19
|
-
def allows_script?
|
20
|
-
false
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
data/lib/tilt/dummy.rb
DELETED
data/lib/tilt/erubis.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'tilt/erb'
|
2
|
-
require 'erubis'
|
3
|
-
|
4
|
-
module Tilt
|
5
|
-
# Erubis template implementation. See:
|
6
|
-
# http://www.kuwata-lab.com/erubis/
|
7
|
-
#
|
8
|
-
# ErubisTemplate supports the following additional options, which are not
|
9
|
-
# passed down to the Erubis engine:
|
10
|
-
#
|
11
|
-
# :engine_class allows you to specify a custom engine class to use
|
12
|
-
# instead of the default (which is ::Erubis::Eruby).
|
13
|
-
#
|
14
|
-
# :escape_html when true, ::Erubis::EscapedEruby will be used as
|
15
|
-
# the engine class instead of the default. All content
|
16
|
-
# within <%= %> blocks will be automatically html escaped.
|
17
|
-
class ErubisTemplate < ERBTemplate
|
18
|
-
def prepare
|
19
|
-
@outvar = options.delete(:outvar) || self.class.default_output_variable
|
20
|
-
@options.merge!(:preamble => false, :postamble => false, :bufvar => @outvar)
|
21
|
-
engine_class = options.delete(:engine_class)
|
22
|
-
engine_class = ::Erubis::EscapedEruby if options.delete(:escape_html)
|
23
|
-
@engine = (engine_class || ::Erubis::Eruby).new(data, options)
|
24
|
-
end
|
25
|
-
|
26
|
-
def precompiled_preamble(locals)
|
27
|
-
[super, "#{@outvar} = _buf = String.new"].join("\n")
|
28
|
-
end
|
29
|
-
|
30
|
-
def precompiled_postamble(locals)
|
31
|
-
[@outvar, super].join("\n")
|
32
|
-
end
|
33
|
-
|
34
|
-
# Erubis doesn't have ERB's line-off-by-one under 1.9 problem.
|
35
|
-
# Override and adjust back.
|
36
|
-
if RUBY_VERSION >= '1.9.0'
|
37
|
-
def precompiled(locals)
|
38
|
-
source, offset = super
|
39
|
-
[source, offset - 1]
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
data/lib/tilt/less.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'tilt/template'
|
2
|
-
require 'less'
|
3
|
-
|
4
|
-
module Tilt
|
5
|
-
# Lessscss template implementation. See:
|
6
|
-
# http://lesscss.org/
|
7
|
-
#
|
8
|
-
# Less templates do not support object scopes, locals, or yield.
|
9
|
-
class LessTemplate < Template
|
10
|
-
self.default_mime_type = 'text/css'
|
11
|
-
|
12
|
-
def prepare
|
13
|
-
if ::Less.const_defined? :Engine
|
14
|
-
@engine = ::Less::Engine.new(data)
|
15
|
-
else
|
16
|
-
parser = ::Less::Parser.new(options.merge :filename => eval_file, :line => line)
|
17
|
-
@engine = parser.parse(data)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def evaluate(scope, locals, &block)
|
22
|
-
@output ||= @engine.to_css(options)
|
23
|
-
end
|
24
|
-
|
25
|
-
def allows_script?
|
26
|
-
false
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
data/lib/tilt/maruku.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'tilt/template'
|
2
|
-
require 'maruku'
|
3
|
-
|
4
|
-
module Tilt
|
5
|
-
# Maruku markdown implementation. See:
|
6
|
-
# http://maruku.rubyforge.org/
|
7
|
-
class MarukuTemplate < Template
|
8
|
-
def prepare
|
9
|
-
@engine = Maruku.new(data, options)
|
10
|
-
@output = nil
|
11
|
-
end
|
12
|
-
|
13
|
-
def evaluate(scope, locals, &block)
|
14
|
-
@output ||= @engine.to_html
|
15
|
-
end
|
16
|
-
|
17
|
-
def allows_script?
|
18
|
-
false
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
data/lib/tilt/sigil.rb
DELETED
@@ -1,34 +0,0 @@
|
|
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/wikicloth.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'tilt/template'
|
2
|
-
require 'wikicloth'
|
3
|
-
|
4
|
-
module Tilt
|
5
|
-
# WikiCloth implementation. See:
|
6
|
-
# http://redcloth.org/
|
7
|
-
class WikiClothTemplate < Template
|
8
|
-
def prepare
|
9
|
-
@parser = options.delete(:parser) || WikiCloth::Parser
|
10
|
-
@engine = @parser.new options.merge(:data => data)
|
11
|
-
@output = nil
|
12
|
-
end
|
13
|
-
|
14
|
-
def evaluate(scope, locals, &block)
|
15
|
-
@output ||= @engine.to_html
|
16
|
-
end
|
17
|
-
|
18
|
-
def allows_script?
|
19
|
-
false
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|