ruby2html 1.5.4 → 1.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7e4ace849a6799ec0dd9c793678a6eefcf62c1b0ccf8ed2de53a4d3c18c352a
4
- data.tar.gz: cad377858ea7819014d67638191d1b22567584796e7372212c7a2dcd90046196
3
+ metadata.gz: cf4f778793e40575fb653f419b9d0f9f0f7e82cb3f639181bcec3d1017ffd495
4
+ data.tar.gz: 4aae6941eed39fd2ea969ce0ed80ddfb73ca52e8b06d5ebf969e2a925446702a
5
5
  SHA512:
6
- metadata.gz: 34aef0821511553c2ef86498f9adf10d42668cd3a04cadbde09adfc79eb4410220932d3ff99dc22261119a6efd7e20914b791c5ecca546564e3cb4a6b870b594
7
- data.tar.gz: a1afad1a03be0bd3cadcd901fb34193007eb490ec619717d1550e4d63f72718a630e656021ad8dc39ba52e03759a839203b93b7d271f249b4a0476dfa9eae7d4
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.session[:_csrf_token])
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
- begin
15
- previous_renderer = Thread.current[:__ruby2html_renderer__]
16
- renderer = Ruby2html::Render.new(self) do
17
- #{source}
18
- end
19
- Thread.current[:__ruby2html_renderer__] = renderer
20
- renderer.__render_from_rails(#{template.identifier.inspect})
21
- ensure
22
- Thread.current[:__ruby2html_renderer__] = previous_renderer
23
- end
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
@@ -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
- return plain @context.render(*args, **options, &block)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ruby2html
4
- VERSION = '1.5.4'
4
+ VERSION = '1.5.6'
5
5
  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
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-12 00:00:00.000000000 Z
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.11
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