ruby2html 1.3.2 → 1.3.3

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: 948558903cc3a21baf43c8d7a8133d8cf630476d9030a10b38646ce5e92535f7
4
- data.tar.gz: 769e3aad923a153b0aabf4392492bd44d0f231e784f5b5fffa9129329537b590
3
+ metadata.gz: bb194a11e2015f7caf7e2994f5db0c67fa9b8967c2e44906b3a036aba9eb1be6
4
+ data.tar.gz: e60ff3a75bc735e3b084d0f3b91503f151564f3c9d82c9721e8dbc281d6c2283
5
5
  SHA512:
6
- metadata.gz: 77a22c5c896f3cfae2986a279a8946478ff39bd94e68faddb32ee897156d6cc9bbd6c4024fbce7463cd2f37b78905e6fd4e9c4410267589d743b33141f5de9ad
7
- data.tar.gz: 7561cabe35deeae6ff40d0b2b692d9fc153b34145ea95920b2e1c9c63895f71d45b473506646bfe8f456905c34c9dbacf35e4547033b05a60d9d69fdfc285cef
6
+ metadata.gz: bea7e7d8965f80fdf3aed3f92ecbc49f14630da3e832dae868836cfdcf1f60f8a439e3a82c850586462fa68adb3a39dcc58d35821a7b9554e3df8e8115083a33
7
+ data.tar.gz: ba619ce95c33e4d96579bc4f423b2554a75160d11102d9f55dee7632ad7eb63d3e20bd21c3aaee4402a861e9f2e5b8a20aa08c03e3086654dec71072d42ff0f7
@@ -6,6 +6,10 @@ class FirstComponent < ApplicationComponent
6
6
  end
7
7
 
8
8
  def another_div
9
+ div do
10
+ "Item value: #{@item}"
11
+ end
12
+
9
13
  div class: 'another' do
10
14
  h2 'Another subheading from component'
11
15
  end
@@ -1,3 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  h1 'Third component'
4
+ div do
5
+ "Item value: #{@item}"
6
+ end
@@ -8,3 +8,6 @@ div @value
8
8
 
9
9
  link_to 'Home', root_url
10
10
  render partial: 'shared/navbar'
11
+ render partial: 'shared/footer'
12
+
13
+ div @value
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ h1 'footer'
@@ -9,7 +9,7 @@ module Ruby2html
9
9
  new.call(template, source)
10
10
  end
11
11
 
12
- def call(_template, source)
12
+ def call(template, source)
13
13
  <<-RUBY
14
14
  begin
15
15
  previous_renderer = Thread.current[:__ruby2html_renderer__]
@@ -17,7 +17,7 @@ module Ruby2html
17
17
  #{source}
18
18
  end
19
19
  Thread.current[:__ruby2html_renderer__] = renderer
20
- renderer.render
20
+ renderer.render_from_rails(#{template.identifier.inspect})
21
21
  ensure
22
22
  Thread.current[:__ruby2html_renderer__] = previous_renderer
23
23
  end
@@ -28,6 +28,15 @@ module Ruby2html
28
28
  @current_output = @output
29
29
  end
30
30
 
31
+ def render_from_rails(template_path)
32
+ result = render
33
+ return result unless annotate_rendered_view_with_filenames?
34
+
35
+ template_path = template_path.sub("#{Rails.root}/", '')
36
+
37
+ "<!-- BEGIN #{template_path} -->#{result}<!-- END #{template_path} -->".html_safe
38
+ end
39
+
31
40
  def render(*args, **options, &block)
32
41
  set_instance_variables
33
42
 
@@ -135,6 +144,11 @@ module Ruby2html
135
144
  CGI.escapeHTML(text.to_s)
136
145
  end
137
146
 
147
+ def annotate_rendered_view_with_filenames?
148
+ return @annotate_rendered_view_with_filenames if defined?(@annotate_rendered_view_with_filenames)
149
+ @annotate_rendered_view_with_filenames = Rails.application.config.action_view.annotate_rendered_view_with_filenames
150
+ end
151
+
138
152
  def set_instance_variables
139
153
  @context.instance_variables.each do |name|
140
154
  instance_variable_set(name, @context.instance_variable_get(name))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ruby2html
4
- VERSION = '1.3.2'
4
+ VERSION = '1.3.3'
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.3.2
4
+ version: 1.3.3
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-09 00:00:00.000000000 Z
11
+ date: 2024-08-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby2HTML empowers developers to write view logic in pure Ruby, seamlessly
14
14
  converting it into clean, well-formatted HTML. Enhance your templating workflow,
@@ -56,6 +56,7 @@ files:
56
56
  - app/views/layouts/mailer.text.erb
57
57
  - app/views/pwa/manifest.json.erb
58
58
  - app/views/pwa/service-worker.js
59
+ - app/views/shared/_footer.html.rb
59
60
  - app/views/shared/_navbar.html.erb
60
61
  - config.ru
61
62
  - config/application.rb