ruby2html 1.5.3 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gem/ruby2html/rails_components/form_with.rb +1 -1
- data/lib/gem/ruby2html/railtie.rb +14 -10
- data/lib/gem/ruby2html/render.rb +5 -13
- data/lib/gem/ruby2html/version.rb +1 -1
- data/ruby2html.gemspec +33 -0
- metadata +3 -77
- data/.dockerignore +0 -48
- data/.rspec +0 -2
- data/.rubocop.yml +0 -16
- data/.ruby-version +0 -1
- data/Dockerfile +0 -71
- data/README.md +0 -318
- data/Rakefile +0 -8
- data/app/assets/config/manifest.js +0 -2
- data/app/assets/images/.keep +0 -0
- data/app/assets/stylesheets/application.css +0 -15
- data/app/channels/application_cable/channel.rb +0 -6
- data/app/channels/application_cable/connection.rb +0 -6
- data/app/components/application_component.rb +0 -5
- data/app/components/first_component.html.rb +0 -11
- data/app/components/first_component.rb +0 -19
- data/app/components/second_component.rb +0 -12
- data/app/components/third_component/third_component.html.rb +0 -6
- data/app/components/third_component.rb +0 -7
- data/app/controllers/application_controller.rb +0 -7
- data/app/controllers/benchmark_controller.rb +0 -48
- data/app/controllers/concerns/.keep +0 -0
- data/app/controllers/home_controller.rb +0 -16
- data/app/helpers/application_helper.rb +0 -4
- data/app/jobs/application_job.rb +0 -9
- data/app/mailers/application_mailer.rb +0 -6
- data/app/models/application_record.rb +0 -5
- data/app/models/concerns/.keep +0 -0
- data/app/views/benchmark/normal_html.html.erb +0 -31
- data/app/views/benchmark/ruby_2html.html.rb +0 -33
- data/app/views/home/form.html.rb +0 -14
- data/app/views/home/index.html.erb +0 -43
- data/app/views/home/rb_files.html.rb +0 -18
- data/app/views/layouts/application.html.erb +0 -21
- data/app/views/layouts/mailer.html.erb +0 -13
- data/app/views/layouts/mailer.text.erb +0 -1
- data/app/views/pwa/manifest.json.erb +0 -22
- data/app/views/pwa/service-worker.js +0 -26
- data/app/views/shared/_footer.html.rb +0 -3
- data/app/views/shared/_navbar.html.erb +0 -1
- data/config/application.rb +0 -45
- data/config/boot.rb +0 -6
- data/config/cable.yml +0 -10
- data/config/credentials.yml.enc +0 -1
- data/config/database.yml +0 -32
- data/config/environment.rb +0 -7
- data/config/environments/development.rb +0 -85
- data/config/environments/production.rb +0 -104
- data/config/environments/test.rb +0 -69
- data/config/initializers/assets.rb +0 -14
- data/config/initializers/content_security_policy.rb +0 -27
- data/config/initializers/filter_parameter_logging.rb +0 -10
- data/config/initializers/inflections.rb +0 -18
- data/config/initializers/permissions_policy.rb +0 -15
- data/config/locales/en.yml +0 -31
- data/config/puma.rb +0 -56
- data/config/routes.rb +0 -23
- data/config/storage.yml +0 -34
- data/config.ru +0 -8
- data/db/seeds.rb +0 -11
- data/lefthook.yml +0 -8
- data/lib/assets/.keep +0 -0
- data/lib/tasks/.keep +0 -0
- data/log/.keep +0 -0
- data/public/404.html +0 -67
- data/public/406-unsupported-browser.html +0 -66
- data/public/422.html +0 -67
- data/public/500.html +0 -66
- data/public/icon.png +0 -0
- data/public/icon.svg +0 -3
- data/public/robots.txt +0 -1
- data/storage/.keep +0 -0
- data/tmp/.keep +0 -0
- data/tmp/pids/.keep +0 -0
- data/tmp/storage/.keep +0 -0
- data/vendor/.keep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25986366d74cfc6ab633d56affe1237d3fe796af18942954ea76a3db524d4371
|
4
|
+
data.tar.gz: 590ebdf14101a46c9421770c1de0427c8db0aaa36e21e6a77a4349eee99d3a18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ca7d36a57c334b40e4244f06de1e037ed16d7ae3c70dbd0e6754decf8ff16e1277351d1514993cda2095e8013ffeb7283b87954ec415b29977e6ea9cf2f78e0
|
7
|
+
data.tar.gz: fde8daef7e52baf0bf51a7772121f1459287f7d1400b9f5984c1c8a331841cab5c74de90778dec5e0600f8a10df0d88fe4e223b3cd3f15afbb0c2c4db424be00
|
@@ -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
|
@@ -11,18 +11,22 @@ module Ruby2html
|
|
11
11
|
|
12
12
|
def call(template, source)
|
13
13
|
<<-RUBY
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
24
24
|
RUBY
|
25
25
|
end
|
26
|
+
|
27
|
+
def self.handles_encoding?
|
28
|
+
true
|
29
|
+
end
|
26
30
|
end
|
27
31
|
|
28
32
|
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
|
data/ruby2html.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/gem/ruby2html/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'ruby2html'
|
7
|
+
spec.version = Ruby2html::VERSION
|
8
|
+
spec.authors = ['sebi']
|
9
|
+
spec.email = ['gore.sebyx@yahoo.com']
|
10
|
+
|
11
|
+
spec.summary = 'Transform Ruby code into beautiful, structured HTML'
|
12
|
+
spec.description = 'Ruby2HTML empowers developers to write view logic in pure Ruby, ' \
|
13
|
+
'seamlessly converting it into clean, well-formatted HTML. ' \
|
14
|
+
'Enhance your templating workflow, improve readability, and ' \
|
15
|
+
'leverage the full power of Ruby in your views. ' \
|
16
|
+
'Features include Rails integration, custom component support, ' \
|
17
|
+
'and automatic HTML beautification.'
|
18
|
+
spec.homepage = 'https://github.com/sebyx07/ruby2html'
|
19
|
+
spec.license = 'MIT'
|
20
|
+
spec.required_ruby_version = '>= 3.0.0'
|
21
|
+
|
22
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
23
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
24
|
+
|
25
|
+
# Specify which files should be added to the gem when it is released.
|
26
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
27
|
+
gemspec = File.basename(__FILE__)
|
28
|
+
|
29
|
+
spec.files = Dir.glob('{lib}/gem/**/*') + [gemspec]
|
30
|
+
spec.require_paths = ['lib/gem']
|
31
|
+
|
32
|
+
spec.add_dependency 'htmlbeautifier', '>= 1.4'
|
33
|
+
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.5
|
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
|
@@ -34,67 +34,6 @@ executables: []
|
|
34
34
|
extensions: []
|
35
35
|
extra_rdoc_files: []
|
36
36
|
files:
|
37
|
-
- ".dockerignore"
|
38
|
-
- ".rspec"
|
39
|
-
- ".rubocop.yml"
|
40
|
-
- ".ruby-version"
|
41
|
-
- Dockerfile
|
42
|
-
- README.md
|
43
|
-
- Rakefile
|
44
|
-
- app/assets/config/manifest.js
|
45
|
-
- app/assets/images/.keep
|
46
|
-
- app/assets/stylesheets/application.css
|
47
|
-
- app/channels/application_cable/channel.rb
|
48
|
-
- app/channels/application_cable/connection.rb
|
49
|
-
- app/components/application_component.rb
|
50
|
-
- app/components/first_component.html.rb
|
51
|
-
- app/components/first_component.rb
|
52
|
-
- app/components/second_component.rb
|
53
|
-
- app/components/third_component.rb
|
54
|
-
- app/components/third_component/third_component.html.rb
|
55
|
-
- app/controllers/application_controller.rb
|
56
|
-
- app/controllers/benchmark_controller.rb
|
57
|
-
- app/controllers/concerns/.keep
|
58
|
-
- app/controllers/home_controller.rb
|
59
|
-
- app/helpers/application_helper.rb
|
60
|
-
- app/jobs/application_job.rb
|
61
|
-
- app/mailers/application_mailer.rb
|
62
|
-
- app/models/application_record.rb
|
63
|
-
- app/models/concerns/.keep
|
64
|
-
- app/views/benchmark/normal_html.html.erb
|
65
|
-
- app/views/benchmark/ruby_2html.html.rb
|
66
|
-
- app/views/home/form.html.rb
|
67
|
-
- app/views/home/index.html.erb
|
68
|
-
- app/views/home/rb_files.html.rb
|
69
|
-
- app/views/layouts/application.html.erb
|
70
|
-
- app/views/layouts/mailer.html.erb
|
71
|
-
- app/views/layouts/mailer.text.erb
|
72
|
-
- app/views/pwa/manifest.json.erb
|
73
|
-
- app/views/pwa/service-worker.js
|
74
|
-
- app/views/shared/_footer.html.rb
|
75
|
-
- app/views/shared/_navbar.html.erb
|
76
|
-
- config.ru
|
77
|
-
- config/application.rb
|
78
|
-
- config/boot.rb
|
79
|
-
- config/cable.yml
|
80
|
-
- config/credentials.yml.enc
|
81
|
-
- config/database.yml
|
82
|
-
- config/environment.rb
|
83
|
-
- config/environments/development.rb
|
84
|
-
- config/environments/production.rb
|
85
|
-
- config/environments/test.rb
|
86
|
-
- config/initializers/assets.rb
|
87
|
-
- config/initializers/content_security_policy.rb
|
88
|
-
- config/initializers/filter_parameter_logging.rb
|
89
|
-
- config/initializers/inflections.rb
|
90
|
-
- config/initializers/permissions_policy.rb
|
91
|
-
- config/locales/en.yml
|
92
|
-
- config/puma.rb
|
93
|
-
- config/routes.rb
|
94
|
-
- config/storage.yml
|
95
|
-
- db/seeds.rb
|
96
|
-
- lefthook.yml
|
97
|
-
- lib/assets/.keep
|
98
37
|
- lib/gem/ruby2html.rb
|
99
38
|
- lib/gem/ruby2html/component_helper.rb
|
100
39
|
- lib/gem/ruby2html/html_beautifier_middleware.rb
|
@@ -107,20 +46,7 @@ files:
|
|
107
46
|
- lib/gem/ruby2html/railtie.rb
|
108
47
|
- lib/gem/ruby2html/render.rb
|
109
48
|
- lib/gem/ruby2html/version.rb
|
110
|
-
-
|
111
|
-
- log/.keep
|
112
|
-
- public/404.html
|
113
|
-
- public/406-unsupported-browser.html
|
114
|
-
- public/422.html
|
115
|
-
- public/500.html
|
116
|
-
- public/icon.png
|
117
|
-
- public/icon.svg
|
118
|
-
- public/robots.txt
|
119
|
-
- storage/.keep
|
120
|
-
- tmp/.keep
|
121
|
-
- tmp/pids/.keep
|
122
|
-
- tmp/storage/.keep
|
123
|
-
- vendor/.keep
|
49
|
+
- ruby2html.gemspec
|
124
50
|
homepage: https://github.com/sebyx07/ruby2html
|
125
51
|
licenses:
|
126
52
|
- MIT
|
data/.dockerignore
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
|
2
|
-
|
3
|
-
# Ignore git directory.
|
4
|
-
/.git/
|
5
|
-
/.gitignore
|
6
|
-
|
7
|
-
# Ignore bundler config.
|
8
|
-
/.bundle
|
9
|
-
|
10
|
-
# Ignore all environment files (except templates).
|
11
|
-
/.env*
|
12
|
-
!/.env*.erb
|
13
|
-
|
14
|
-
# Ignore all default key files.
|
15
|
-
/config/master.key
|
16
|
-
/config/credentials/*.key
|
17
|
-
|
18
|
-
# Ignore all logfiles and tempfiles.
|
19
|
-
/log/*
|
20
|
-
/tmp/*
|
21
|
-
!/log/.keep
|
22
|
-
!/tmp/.keep
|
23
|
-
|
24
|
-
# Ignore pidfiles, but keep the directory.
|
25
|
-
/tmp/pids/*
|
26
|
-
!/tmp/pids/.keep
|
27
|
-
|
28
|
-
# Ignore storage (uploaded files in development and any SQLite databases).
|
29
|
-
/storage/*
|
30
|
-
!/storage/.keep
|
31
|
-
/tmp/storage/*
|
32
|
-
!/tmp/storage/.keep
|
33
|
-
|
34
|
-
# Ignore assets.
|
35
|
-
/node_modules/
|
36
|
-
/app/assets/builds/*
|
37
|
-
!/app/assets/builds/.keep
|
38
|
-
/public/assets
|
39
|
-
|
40
|
-
# Ignore CI service files.
|
41
|
-
/.github
|
42
|
-
|
43
|
-
# Ignore development files
|
44
|
-
/.devcontainer
|
45
|
-
|
46
|
-
# Ignore Docker-related files
|
47
|
-
/.dockerignore
|
48
|
-
/Dockerfile*
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
inherit_gem:
|
2
|
-
rubocop-rails_config:
|
3
|
-
- config/rails.yml
|
4
|
-
|
5
|
-
AllCops:
|
6
|
-
TargetRubyVersion: 3.0
|
7
|
-
|
8
|
-
Style/ClassAndModuleChildren:
|
9
|
-
EnforcedStyle: nested
|
10
|
-
|
11
|
-
Lint/Debugger:
|
12
|
-
Enabled: true
|
13
|
-
|
14
|
-
Style/StringLiterals:
|
15
|
-
Enabled: true
|
16
|
-
EnforcedStyle: single_quotes
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
3.3.3
|
data/Dockerfile
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
# syntax = docker/dockerfile:1
|
2
|
-
|
3
|
-
# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
|
4
|
-
# docker build -t my-app .
|
5
|
-
# docker run -d -p 80:80 -p 443:443 --name my-app -e RAILS_MASTER_KEY=<value from config/master.key> my-app
|
6
|
-
|
7
|
-
# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
|
8
|
-
|
9
|
-
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
|
10
|
-
ARG RUBY_VERSION=3.3.3
|
11
|
-
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
|
12
|
-
|
13
|
-
# Rails app lives here
|
14
|
-
WORKDIR /rails
|
15
|
-
|
16
|
-
# Install base packages
|
17
|
-
RUN apt-get update -qq && \
|
18
|
-
apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 libvips && \
|
19
|
-
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
20
|
-
|
21
|
-
# Set production environment
|
22
|
-
ENV RAILS_ENV="production" \
|
23
|
-
BUNDLE_DEPLOYMENT="1" \
|
24
|
-
BUNDLE_PATH="/usr/local/bundle" \
|
25
|
-
BUNDLE_WITHOUT="development"
|
26
|
-
|
27
|
-
# Throw-away build stage to reduce size of final image
|
28
|
-
FROM base AS build
|
29
|
-
|
30
|
-
# Install packages needed to build gems
|
31
|
-
RUN apt-get update -qq && \
|
32
|
-
apt-get install --no-install-recommends -y build-essential git pkg-config && \
|
33
|
-
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
34
|
-
|
35
|
-
# Install application gems
|
36
|
-
COPY Gemfile Gemfile.lock ./
|
37
|
-
RUN bundle install && \
|
38
|
-
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
|
39
|
-
bundle exec bootsnap precompile --gemfile
|
40
|
-
|
41
|
-
# Copy application code
|
42
|
-
COPY . .
|
43
|
-
|
44
|
-
# Precompile bootsnap code for faster boot times
|
45
|
-
RUN bundle exec bootsnap precompile app/ lib/
|
46
|
-
|
47
|
-
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
|
48
|
-
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
# Final stage for app image
|
54
|
-
FROM base
|
55
|
-
|
56
|
-
# Copy built artifacts: gems, application
|
57
|
-
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
|
58
|
-
COPY --from=build /rails /rails
|
59
|
-
|
60
|
-
# Run and own only the runtime files as a non-root user for security
|
61
|
-
RUN groupadd --system --gid 1000 rails && \
|
62
|
-
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
|
63
|
-
chown -R rails:rails db log storage tmp
|
64
|
-
USER 1000:1000
|
65
|
-
|
66
|
-
# Entrypoint prepares the database.
|
67
|
-
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
|
68
|
-
|
69
|
-
# Start the server by default, this can be overwritten at runtime
|
70
|
-
EXPOSE 3000
|
71
|
-
CMD ["./bin/rails", "server"]
|