ruby2html 1.5.4 → 1.5.6
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/lib/gem/ruby2html/rails_components/form_with.rb +1 -1
- data/lib/gem/ruby2html/railtie.rb +14 -14
- data/lib/gem/ruby2html/render.rb +5 -13
- data/lib/gem/ruby2html/version.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: cf4f778793e40575fb653f419b9d0f9f0f7e82cb3f639181bcec3d1017ffd495
|
4
|
+
data.tar.gz: 4aae6941eed39fd2ea969ce0ed80ddfb73ca52e8b06d5ebf969e2a925446702a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab5c2ece6828903693aaf318ba342e99fb50ef9aeb2d1d79a68ee627e19d411cfb6beca021e6cb26698a646092a3bd7136746a8eb07d3b26525db24f120da3a1
|
7
|
+
data.tar.gz: cc432a7c9ad78536b3aac8a3826d603f64f1d2809ee3610ce2d77b3c307c38bbad272cf1bdde6ed97d4480201038f351690e5dbcc5f9b286d06a90cbcca5eee6
|
@@ -70,7 +70,7 @@ module Ruby2html
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def authenticity_token_tag
|
73
|
-
@render.input(type: 'hidden', name: 'authenticity_token', value: @context.
|
73
|
+
@render.input(type: 'hidden', name: 'authenticity_token', value: @context.form_authenticity_token)
|
74
74
|
end
|
75
75
|
|
76
76
|
def utf8_enforcer_tag
|
@@ -6,23 +6,23 @@ module Ruby2html
|
|
6
6
|
self.default_format = :html
|
7
7
|
|
8
8
|
def self.call(template, source)
|
9
|
-
new.call(template, source)
|
10
|
-
end
|
11
|
-
|
12
|
-
def call(template, source)
|
13
9
|
<<-RUBY
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
10
|
+
begin
|
11
|
+
previous_renderer = Thread.current[:__ruby2html_renderer__]
|
12
|
+
renderer = Ruby2html::Render.new(self) do
|
13
|
+
#{source}
|
14
|
+
end
|
15
|
+
Thread.current[:__ruby2html_renderer__] = renderer
|
16
|
+
renderer.__render_from_rails(#{template.identifier.inspect})
|
17
|
+
ensure
|
18
|
+
Thread.current[:__ruby2html_renderer__] = previous_renderer
|
19
|
+
end
|
24
20
|
RUBY
|
25
21
|
end
|
22
|
+
|
23
|
+
def self.handles_encoding?
|
24
|
+
true
|
25
|
+
end
|
26
26
|
end
|
27
27
|
|
28
28
|
class Railtie < Rails::Railtie
|
data/lib/gem/ruby2html/render.rb
CHANGED
@@ -41,9 +41,8 @@ module Ruby2html
|
|
41
41
|
def render(*args, **options, &block)
|
42
42
|
set_instance_variables
|
43
43
|
|
44
|
-
if !args.empty? || !options.empty? || block_given?
|
45
|
-
|
46
|
-
end
|
44
|
+
return plain @context.render(*args, **options, &block) if !args.empty? || !options.empty? || block_given?
|
45
|
+
|
47
46
|
instance_exec(&@root)
|
48
47
|
result = @output.string
|
49
48
|
|
@@ -67,8 +66,7 @@ module Ruby2html
|
|
67
66
|
attributes = options
|
68
67
|
|
69
68
|
tag_content = StringIO.new
|
70
|
-
tag_content <<
|
71
|
-
tag_content << name
|
69
|
+
tag_content << "<#{name}"
|
72
70
|
tag_content << attributes_to_s(attributes)
|
73
71
|
|
74
72
|
if VOID_ELEMENTS.include?(name)
|
@@ -87,9 +85,7 @@ module Ruby2html
|
|
87
85
|
tag_content << escape_html(content)
|
88
86
|
end
|
89
87
|
|
90
|
-
tag_content <<
|
91
|
-
tag_content << name
|
92
|
-
tag_content << '>'
|
88
|
+
tag_content << "</#{name}>"
|
93
89
|
end
|
94
90
|
|
95
91
|
@current_output << tag_content.string
|
@@ -132,11 +128,7 @@ module Ruby2html
|
|
132
128
|
|
133
129
|
result = StringIO.new
|
134
130
|
attributes.compact.each do |k, v|
|
135
|
-
result <<
|
136
|
-
result << k.to_s
|
137
|
-
result << '="'
|
138
|
-
result << escape_html(v)
|
139
|
-
result << '"'
|
131
|
+
result << " #{k}=\"#{escape_html(v)}\""
|
140
132
|
end
|
141
133
|
result.string
|
142
134
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby2html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sebi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlbeautifier
|
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
requirements: []
|
71
|
-
rubygems_version: 3.5.
|
71
|
+
rubygems_version: 3.5.17
|
72
72
|
signing_key:
|
73
73
|
specification_version: 4
|
74
74
|
summary: Transform Ruby code into beautiful, structured HTML
|