tilt 2.6.1 → 2.8.0
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 -1
- data/lib/tilt/asciidoc.rb +12 -5
- data/lib/tilt/babel.rb +5 -0
- data/lib/tilt/builder.rb +4 -0
- data/lib/tilt/coffee.rb +14 -4
- data/lib/tilt/commonmarker.rb +65 -0
- data/lib/tilt/csv.rb +35 -25
- data/lib/tilt/erb.rb +67 -2
- data/lib/tilt/erubi.rb +41 -8
- data/lib/tilt/etanni.rb +7 -0
- data/lib/tilt/haml.rb +67 -1
- data/lib/tilt/kramdown.rb +47 -1
- data/lib/tilt/liquid.rb +66 -10
- data/lib/tilt/livescript.rb +11 -4
- data/lib/tilt/mapping.rb +8 -8
- data/lib/tilt/markaby.rb +11 -2
- data/lib/tilt/nokogiri.rb +13 -2
- data/lib/tilt/pandoc.rb +43 -1
- data/lib/tilt/pipeline.rb +6 -1
- data/lib/tilt/plain.rb +5 -1
- data/lib/tilt/prawn.rb +17 -6
- data/lib/tilt/radius.rb +55 -0
- data/lib/tilt/rdiscount.rb +65 -6
- data/lib/tilt/rdoc.rb +33 -3
- data/lib/tilt/redcarpet.rb +42 -0
- data/lib/tilt/redcloth.rb +28 -1
- data/lib/tilt/rst-pandoc.rb +24 -1
- data/lib/tilt/sass.rb +16 -3
- data/lib/tilt/slim.rb +13 -0
- data/lib/tilt/string.rb +10 -2
- data/lib/tilt/template.rb +5 -5
- data/lib/tilt/typescript.rb +5 -0
- data/lib/tilt/yajl.rb +46 -36
- data/lib/tilt.rb +1 -2
- metadata +3 -3
- data/lib/tilt/creole.rb +0 -16
data/lib/tilt/yajl.rb
CHANGED
|
@@ -1,44 +1,54 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# = Yajl
|
|
4
|
+
#
|
|
5
|
+
# Yajl Template implementation
|
|
6
|
+
#
|
|
7
|
+
# Yajl is a fast JSON parsing and encoding library for Ruby
|
|
8
|
+
#
|
|
9
|
+
# The template source is evaluated as a Ruby string,
|
|
10
|
+
# and the result is converted #to_json.
|
|
11
|
+
#
|
|
12
|
+
# === Example
|
|
13
|
+
#
|
|
14
|
+
# # This is a template example.
|
|
15
|
+
# # The template can contain any Ruby statement.
|
|
16
|
+
# tpl <<-EOS
|
|
17
|
+
# @counter = 0
|
|
18
|
+
#
|
|
19
|
+
# # The json variable represents the buffer
|
|
20
|
+
# # and holds the data to be serialized into json.
|
|
21
|
+
# # It defaults to an empty hash, but you can override it at any time.
|
|
22
|
+
# json = {
|
|
23
|
+
# :"user#{@counter += 1}" => { :name => "Joshua Peek", :id => @counter },
|
|
24
|
+
# :"user#{@counter += 1}" => { :name => "Ryan Tomayko", :id => @counter },
|
|
25
|
+
# :"user#{@counter += 1}" => { :name => "Simone Carletti", :id => @counter },
|
|
26
|
+
# }
|
|
27
|
+
#
|
|
28
|
+
# # Since the json variable is a Hash,
|
|
29
|
+
# # you can use conditional statements or any other Ruby statement
|
|
30
|
+
# # to populate it.
|
|
31
|
+
# json[:"user#{@counter += 1}"] = { :name => "Unknown" } if 1 == 2
|
|
32
|
+
#
|
|
33
|
+
# # The last line doesn't affect the returned value.
|
|
34
|
+
# nil
|
|
35
|
+
# EOS
|
|
36
|
+
#
|
|
37
|
+
# template = Tilt::YajlTemplate.new { tpl }
|
|
38
|
+
# template.render(self)
|
|
39
|
+
#
|
|
40
|
+
# === See also
|
|
41
|
+
#
|
|
42
|
+
# * https://github.com/brianmario/yajl-ruby
|
|
43
|
+
#
|
|
44
|
+
# === Related module
|
|
45
|
+
#
|
|
46
|
+
# * Tilt::YajlTemplate
|
|
47
|
+
|
|
2
48
|
require_relative 'template'
|
|
3
49
|
require 'yajl'
|
|
4
50
|
|
|
5
51
|
module Tilt
|
|
6
|
-
# Yajl Template implementation
|
|
7
|
-
#
|
|
8
|
-
# Yajl is a fast JSON parsing and encoding library for Ruby
|
|
9
|
-
# See https://github.com/brianmario/yajl-ruby
|
|
10
|
-
#
|
|
11
|
-
# The template source is evaluated as a Ruby string,
|
|
12
|
-
# and the result is converted #to_json.
|
|
13
|
-
#
|
|
14
|
-
# == Example
|
|
15
|
-
#
|
|
16
|
-
# # This is a template example.
|
|
17
|
-
# # The template can contain any Ruby statement.
|
|
18
|
-
# tpl <<-EOS
|
|
19
|
-
# @counter = 0
|
|
20
|
-
#
|
|
21
|
-
# # The json variable represents the buffer
|
|
22
|
-
# # and holds the data to be serialized into json.
|
|
23
|
-
# # It defaults to an empty hash, but you can override it at any time.
|
|
24
|
-
# json = {
|
|
25
|
-
# :"user#{@counter += 1}" => { :name => "Joshua Peek", :id => @counter },
|
|
26
|
-
# :"user#{@counter += 1}" => { :name => "Ryan Tomayko", :id => @counter },
|
|
27
|
-
# :"user#{@counter += 1}" => { :name => "Simone Carletti", :id => @counter },
|
|
28
|
-
# }
|
|
29
|
-
#
|
|
30
|
-
# # Since the json variable is a Hash,
|
|
31
|
-
# # you can use conditional statements or any other Ruby statement
|
|
32
|
-
# # to populate it.
|
|
33
|
-
# json[:"user#{@counter += 1}"] = { :name => "Unknown" } if 1 == 2
|
|
34
|
-
#
|
|
35
|
-
# # The last line doesn't affect the returned value.
|
|
36
|
-
# nil
|
|
37
|
-
# EOS
|
|
38
|
-
#
|
|
39
|
-
# template = Tilt::YajlTemplate.new { tpl }
|
|
40
|
-
# template.render(self)
|
|
41
|
-
#
|
|
42
52
|
class YajlTemplate < Template
|
|
43
53
|
self.default_mime_type = 'application/json'
|
|
44
54
|
|
data/lib/tilt.rb
CHANGED
|
@@ -5,7 +5,7 @@ require_relative 'tilt/template'
|
|
|
5
5
|
# Namespace for Tilt. This module is not intended to be included anywhere.
|
|
6
6
|
module Tilt
|
|
7
7
|
# Current version.
|
|
8
|
-
VERSION = '2.
|
|
8
|
+
VERSION = '2.8.0'
|
|
9
9
|
|
|
10
10
|
EMPTY_ARRAY = [].freeze
|
|
11
11
|
private_constant :EMPTY_ARRAY
|
|
@@ -163,7 +163,6 @@ module Tilt
|
|
|
163
163
|
register_lazy :CSVTemplate, 'tilt/csv', 'rcsv'
|
|
164
164
|
register_lazy :CoffeeScriptTemplate, 'tilt/coffee', 'coffee'
|
|
165
165
|
register_lazy :CoffeeScriptLiterateTemplate, 'tilt/coffee', 'litcoffee'
|
|
166
|
-
register_lazy :CreoleTemplate, 'tilt/creole', 'wiki', 'creole'
|
|
167
166
|
register_lazy :EtanniTemplate, 'tilt/etanni', 'etn', 'etanni'
|
|
168
167
|
register_lazy :HamlTemplate, 'tilt/haml', 'haml'
|
|
169
168
|
register_lazy :LiquidTemplate, 'tilt/liquid', 'liquid'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tilt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Tomayko
|
|
@@ -31,7 +31,6 @@ files:
|
|
|
31
31
|
- lib/tilt/cli.rb
|
|
32
32
|
- lib/tilt/coffee.rb
|
|
33
33
|
- lib/tilt/commonmarker.rb
|
|
34
|
-
- lib/tilt/creole.rb
|
|
35
34
|
- lib/tilt/csv.rb
|
|
36
35
|
- lib/tilt/erb.rb
|
|
37
36
|
- lib/tilt/erubi.rb
|
|
@@ -67,6 +66,7 @@ metadata:
|
|
|
67
66
|
changelog_uri: https://github.com/jeremyevans/tilt/blob/master/CHANGELOG.md
|
|
68
67
|
mailing_list_uri: https://github.com/jeremyevans/tilt/discussions
|
|
69
68
|
source_code_uri: https://github.com/jeremyevans/tilt
|
|
69
|
+
documentation_uri: https://tilt.jeremyevans.net
|
|
70
70
|
rdoc_options:
|
|
71
71
|
- "--line-numbers"
|
|
72
72
|
- "--inline-source"
|
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
88
|
version: '0'
|
|
89
89
|
requirements: []
|
|
90
|
-
rubygems_version:
|
|
90
|
+
rubygems_version: 4.0.10
|
|
91
91
|
specification_version: 4
|
|
92
92
|
summary: Generic interface to multiple Ruby template engines
|
|
93
93
|
test_files: []
|
data/lib/tilt/creole.rb
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'creole'
|
|
4
|
-
|
|
5
|
-
warn 'tilt/creole is deprecated, as creole requires modifying string literals', uplevel: 1
|
|
6
|
-
|
|
7
|
-
allowed_opts = [:allowed_schemes, :extensions, :no_escape].freeze
|
|
8
|
-
|
|
9
|
-
# Creole implementation. See: http://www.wikicreole.org/
|
|
10
|
-
Tilt::CreoleTemplate = Tilt::StaticTemplate.subclass do
|
|
11
|
-
opts = {}
|
|
12
|
-
allowed_opts.each do |k|
|
|
13
|
-
opts[k] = @options[k] if @options[k]
|
|
14
|
-
end
|
|
15
|
-
Creole::Parser.new(@data, opts).to_html
|
|
16
|
-
end
|