tilt 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tilt/commonmarker.rb +83 -42
- data/lib/tilt/erubis.rb +2 -0
- data/lib/tilt/etanni.rb +2 -2
- data/lib/tilt/maruku.rb +2 -0
- data/lib/tilt/sass.rb +15 -6
- data/lib/tilt/wikicloth.rb +2 -0
- data/lib/tilt.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9bb9bafc29e9442fed0bf862fb442ea6efaa97c2881b7b958361f0ef7095aaa
|
4
|
+
data.tar.gz: f25db1d4c05ef3b20c5fabefa4eb664e702f51f8d9821b0c44f5f5404ade4c3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc69e05565c5b007fbaaddc7636d6298fc9930c42d1e029834b752236309d97024132118bb723817c5c192cad1f1cef01e278ce4fc46629dac706d0ec4fdd6a2
|
7
|
+
data.tar.gz: 702e18b78c3e9b21e1abe86671bbe6f2427db44b05be4941c1693f30070f1de028af5324294d693bdeda130da603ecfd5c98dcefbce7ca21f7e7f6df5a249b97
|
data/lib/tilt/commonmarker.rb
CHANGED
@@ -2,53 +2,94 @@
|
|
2
2
|
require_relative 'template'
|
3
3
|
require 'commonmarker'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
].freeze
|
5
|
+
if defined?(::Commonmarker)
|
6
|
+
aliases = {
|
7
|
+
:smartypants => :smart
|
8
|
+
}.freeze
|
9
|
+
parse_opts = [
|
10
|
+
:smart,
|
11
|
+
:default_info_string,
|
12
|
+
].freeze
|
13
|
+
render_opts = [
|
14
|
+
:hardbreaks,
|
15
|
+
:github_pre_lang,
|
16
|
+
:width,
|
17
|
+
:unsafe,
|
18
|
+
:escape,
|
19
|
+
:sourcepos,
|
20
|
+
].freeze
|
21
|
+
exts = [
|
22
|
+
:strikethrough,
|
23
|
+
:tagfilter,
|
24
|
+
:table,
|
25
|
+
:autolink,
|
26
|
+
:tasklist,
|
27
|
+
:superscript,
|
28
|
+
:header_ids,
|
29
|
+
:footnotes,
|
30
|
+
:description_lists,
|
31
|
+
:front_matter_delimiter,
|
32
|
+
:shortcodes,
|
33
|
+
].freeze
|
35
34
|
|
35
|
+
Tilt::CommonMarkerTemplate = Tilt::StaticTemplate.subclass do
|
36
|
+
parse_options = @options.select { |key, _| parse_opts.include?(key.downcase) }.transform_keys(&:downcase)
|
37
|
+
parse_options.merge!(@options.select { |key, _| aliases.has_key?(key) }.transform_keys { |key| aliases[key] })
|
38
|
+
render_options = @options.select { |key, _| render_opts.include?(key.downcase) }.transform_keys(&:downcase)
|
39
|
+
extensions = @options.select { |key, _| exts.include?(key) }.transform_keys(&:downcase)
|
36
40
|
|
37
|
-
|
38
|
-
extensions = exts.select do |extension|
|
39
|
-
@options[extension]
|
41
|
+
Commonmarker.to_html(@data, options: { parse: parse_options, render: render_options, extension: extensions })
|
40
42
|
end
|
43
|
+
# :nocov:
|
44
|
+
else
|
45
|
+
aliases = {
|
46
|
+
:smartypants => :SMART
|
47
|
+
}.freeze
|
48
|
+
parse_opts = [
|
49
|
+
:FOOTNOTES,
|
50
|
+
:LIBERAL_HTML_TAG,
|
51
|
+
:SMART,
|
52
|
+
:smartypants,
|
53
|
+
:STRIKETHROUGH_DOUBLE_TILDE,
|
54
|
+
:UNSAFE,
|
55
|
+
:VALIDATE_UTF8,
|
56
|
+
].freeze
|
57
|
+
render_opts = [
|
58
|
+
:FOOTNOTES,
|
59
|
+
:FULL_INFO_STRING,
|
60
|
+
:GITHUB_PRE_LANG,
|
61
|
+
:HARDBREAKS,
|
62
|
+
:NOBREAKS,
|
63
|
+
:SAFE, # Removed in v0.18.0 (2018-10-17)
|
64
|
+
:SOURCEPOS,
|
65
|
+
:TABLE_PREFER_STYLE_ATTRIBUTES,
|
66
|
+
:UNSAFE,
|
67
|
+
].freeze
|
68
|
+
exts = [
|
69
|
+
:autolink,
|
70
|
+
:strikethrough,
|
71
|
+
:table,
|
72
|
+
:tagfilter,
|
73
|
+
:tasklist,
|
74
|
+
].freeze
|
41
75
|
|
42
|
-
|
43
|
-
|
44
|
-
@options[
|
45
|
-
end.map! do |option|
|
46
|
-
aliases[option] || option
|
76
|
+
Tilt::CommonMarkerTemplate = Tilt::StaticTemplate.subclass do
|
77
|
+
extensions = exts.select do |extension|
|
78
|
+
@options[extension]
|
47
79
|
end
|
48
80
|
|
49
|
-
|
50
|
-
|
51
|
-
|
81
|
+
parse_options, render_options = [parse_opts, render_opts].map do |opts|
|
82
|
+
opts = opts.select do |option|
|
83
|
+
@options[option]
|
84
|
+
end.map! do |option|
|
85
|
+
aliases[option] || option
|
86
|
+
end
|
87
|
+
|
88
|
+
opts = :DEFAULT unless opts.any?
|
89
|
+
opts
|
90
|
+
end
|
52
91
|
|
53
|
-
|
92
|
+
CommonMarker.render_doc(@data, parse_options, extensions).to_html(render_options, extensions)
|
93
|
+
end
|
54
94
|
end
|
95
|
+
# :nocov:
|
data/lib/tilt/erubis.rb
CHANGED
data/lib/tilt/etanni.rb
CHANGED
@@ -5,7 +5,7 @@ module Tilt
|
|
5
5
|
class EtanniTemplate < Template
|
6
6
|
def prepare
|
7
7
|
separator = data.hash.abs
|
8
|
-
chomp = "<<#{separator}.chomp
|
8
|
+
chomp = "<<#{separator}.chomp"
|
9
9
|
start = "\n_out_ << #{chomp}\n"
|
10
10
|
stop = "\n#{separator}\n"
|
11
11
|
replacement = "#{stop}\\1#{start}"
|
@@ -13,7 +13,7 @@ module Tilt
|
|
13
13
|
temp = @data.strip
|
14
14
|
temp.gsub!(/<\?r\s+(.*?)\s+\?>/m, replacement)
|
15
15
|
|
16
|
-
@code = "_out_ = [<<#{separator}.chomp
|
16
|
+
@code = "_out_ = [<<#{separator}.chomp]\n#{temp}#{stop}_out_.join"
|
17
17
|
end
|
18
18
|
|
19
19
|
def precompiled_template(locals)
|
data/lib/tilt/maruku.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
require_relative 'template'
|
3
3
|
require 'maruku'
|
4
4
|
|
5
|
+
warn 'tilt/maruku is deprecated, as maruku requires modifying string literals', uplevel: 1
|
6
|
+
|
5
7
|
# Maruku markdown implementation. See: https://github.com/bhollis/maruku
|
6
8
|
Tilt::MarukuTemplate = Tilt::StaticTemplate.subclass do
|
7
9
|
Maruku.new(@data, @options).to_html
|
data/lib/tilt/sass.rb
CHANGED
@@ -13,6 +13,13 @@ module Tilt
|
|
13
13
|
# :nocov:
|
14
14
|
require 'uri'
|
15
15
|
|
16
|
+
ALLOWED_KEYS = (defined?(::Sass::Compiler) ? ::Sass::Compiler : ::Sass::Embedded).
|
17
|
+
instance_method(:compile_string).
|
18
|
+
parameters.
|
19
|
+
map{|k, v| v if k == :key}.
|
20
|
+
compact rescue nil
|
21
|
+
private_constant :ALLOWED_KEYS
|
22
|
+
|
16
23
|
private
|
17
24
|
|
18
25
|
def _prepare_output
|
@@ -22,9 +29,11 @@ module Tilt
|
|
22
29
|
def sass_options
|
23
30
|
path = File.absolute_path(eval_file)
|
24
31
|
path = '/' + path unless path.start_with?('/')
|
25
|
-
|
26
|
-
|
27
|
-
|
32
|
+
opts = @options.dup
|
33
|
+
opts[:url] = ::URI::File.build([nil, ::URI::DEFAULT_PARSER.escape(path)]).to_s
|
34
|
+
opts[:syntax] = :indented
|
35
|
+
opts.delete_if{|k| !ALLOWED_KEYS.include?(k)} if ALLOWED_KEYS
|
36
|
+
opts
|
28
37
|
end
|
29
38
|
rescue LoadError => err
|
30
39
|
begin
|
@@ -61,9 +70,9 @@ module Tilt
|
|
61
70
|
private
|
62
71
|
|
63
72
|
def sass_options
|
64
|
-
super
|
65
|
-
|
66
|
-
|
73
|
+
opts = super
|
74
|
+
opts[:syntax] = :scss
|
75
|
+
opts
|
67
76
|
end
|
68
77
|
end
|
69
78
|
end
|
data/lib/tilt/wikicloth.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
require_relative 'template'
|
3
3
|
require 'wikicloth'
|
4
4
|
|
5
|
+
warn 'tilt/wikicloth is deprecated, as wikicloth requires modifying string literals', uplevel: 1
|
6
|
+
|
5
7
|
# WikiCloth implementation. See: https://github.com/nricciar/wikicloth
|
6
8
|
Tilt::WikiClothTemplate = Tilt::StaticTemplate.subclass do
|
7
9
|
parser = @options.delete(:parser) || WikiCloth::Parser
|
data/lib/tilt.rb
CHANGED
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.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Tomayko
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-06-27 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Generic interface to multiple Ruby template engines
|
16
16
|
email: code@jeremyevans.net
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
|
-
rubygems_version: 3.
|
95
|
+
rubygems_version: 3.5.9
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: Generic interface to multiple Ruby template engines
|