ruby2html 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.dockerignore +48 -0
- data/.rspec +2 -0
- data/.rubocop.yml +13 -0
- data/.ruby-version +1 -0
- data/Dockerfile +71 -0
- data/README.md +264 -0
- data/Rakefile +8 -0
- data/app/assets/config/manifest.js +2 -0
- data/app/assets/images/.keep +0 -0
- data/app/assets/stylesheets/application.css +15 -0
- data/app/channels/application_cable/channel.rb +6 -0
- data/app/channels/application_cable/connection.rb +6 -0
- data/app/components/application_component.rb +5 -0
- data/app/components/first_component.html.erb +9 -0
- data/app/components/first_component.rb +7 -0
- data/app/components/second_component.rb +12 -0
- data/app/controllers/application_controller.rb +7 -0
- data/app/controllers/concerns/.keep +0 -0
- data/app/controllers/home_controller.rb +12 -0
- data/app/helpers/application_helper.rb +4 -0
- data/app/jobs/application_job.rb +9 -0
- data/app/mailers/application_mailer.rb +6 -0
- data/app/models/application_record.rb +5 -0
- data/app/models/concerns/.keep +0 -0
- data/app/views/home/index.html.erb +36 -0
- data/app/views/layouts/application.html.erb +22 -0
- data/app/views/layouts/mailer.html.erb +13 -0
- data/app/views/layouts/mailer.text.erb +1 -0
- data/app/views/pwa/manifest.json.erb +22 -0
- data/app/views/pwa/service-worker.js +26 -0
- data/app/views/shared/_navbar.html.erb +1 -0
- data/config/application.rb +45 -0
- data/config/boot.rb +6 -0
- data/config/cable.yml +10 -0
- data/config/credentials.yml.enc +1 -0
- data/config/database.yml +32 -0
- data/config/environment.rb +7 -0
- data/config/environments/development.rb +83 -0
- data/config/environments/production.rb +104 -0
- data/config/environments/test.rb +69 -0
- data/config/initializers/assets.rb +14 -0
- data/config/initializers/content_security_policy.rb +27 -0
- data/config/initializers/filter_parameter_logging.rb +10 -0
- data/config/initializers/inflections.rb +18 -0
- data/config/initializers/permissions_policy.rb +15 -0
- data/config/locales/en.yml +31 -0
- data/config/puma.rb +56 -0
- data/config/routes.rb +17 -0
- data/config/storage.yml +34 -0
- data/config.ru +8 -0
- data/db/seeds.rb +11 -0
- data/lefthook.yml +8 -0
- data/lib/assets/.keep +0 -0
- data/lib/gem/ruby2html/component_helper.rb +9 -0
- data/lib/gem/ruby2html/rails_helper.rb +13 -0
- data/lib/gem/ruby2html/render.rb +134 -0
- data/lib/gem/ruby2html/version.rb +5 -0
- data/lib/gem/ruby2html.rb +9 -0
- data/lib/tasks/.keep +0 -0
- data/log/.keep +0 -0
- data/public/404.html +67 -0
- data/public/406-unsupported-browser.html +66 -0
- data/public/422.html +67 -0
- data/public/500.html +66 -0
- data/public/icon.png +0 -0
- data/public/icon.svg +3 -0
- data/public/robots.txt +1 -0
- 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
- metadata +120 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 57887705c24091d9cf76d5f1b7e41da4167077c9c61b5a408756af3804e0df1b
|
4
|
+
data.tar.gz: e27fa7060204b4da1c95998451a186cf84492e4a896440baa9ce78eceaaf6f9c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3267b43294cac4d37620a16076fbb97eaaf7d6e8c639b1b83e7b7657e597739617f5ee051c83a2d2394758a9ab19f0d9dd66243ad36eb2c4057308fec64d9ec2
|
7
|
+
data.tar.gz: 583b0c34f859915a57de3b7c1518ed7df16225eef381203c53b73fdf8664401567f564a5dd5c42b870b9b75d3c4f37f119dc7fae51b7707907ded372d97b52c7
|
data/.dockerignore
ADDED
@@ -0,0 +1,48 @@
|
|
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
ADDED
data/.rubocop.yml
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.3.3
|
data/Dockerfile
ADDED
@@ -0,0 +1,71 @@
|
|
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"]
|
data/README.md
ADDED
@@ -0,0 +1,264 @@
|
|
1
|
+
# Ruby2html 🔮✨
|
2
|
+
|
3
|
+
Transform your Ruby code into beautiful, structured HTML with ease! 🚀
|
4
|
+
|
5
|
+
## 🌟 What is Ruby2html?
|
6
|
+
|
7
|
+
Ruby2html is a magical gem that allows you to write your views in pure Ruby and automatically converts them into clean, well-formatted HTML. Say goodbye to messy ERB templates and hello to the full power of Ruby in your views! 🎉
|
8
|
+
|
9
|
+
## 🚀 Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'ruby2html'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle install
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install ruby2html
|
25
|
+
|
26
|
+
## 🎨 Usage
|
27
|
+
|
28
|
+
### In your ApplicationController
|
29
|
+
|
30
|
+
File: `app/controllers/application_controller.rb`
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
# frozen_string_literal: true
|
34
|
+
|
35
|
+
class ApplicationController < ActionController::Base
|
36
|
+
include Ruby2html::RailsHelper
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
### In your views
|
41
|
+
|
42
|
+
File: `app/views/your_view.html.erb`
|
43
|
+
|
44
|
+
Replace your ERB with beautiful Ruby code:
|
45
|
+
|
46
|
+
```erb
|
47
|
+
<%=
|
48
|
+
html(self) do
|
49
|
+
h1 class: 'main-title', 'data-controller': 'welcome' do
|
50
|
+
"Welcome to Ruby2html! 🎉"
|
51
|
+
end
|
52
|
+
div id: 'content', class: 'container' do
|
53
|
+
link_to 'Home Sweet Home 🏠', root_path, class: 'btn btn-primary', 'data-turbo': false
|
54
|
+
end
|
55
|
+
|
56
|
+
@items.each do |item|
|
57
|
+
h2 class: 'item-title', id: "item-#{item[:id]}" do
|
58
|
+
plain item[:title]
|
59
|
+
end
|
60
|
+
p class: 'item-description' do
|
61
|
+
plain item[:description]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
render partial: 'shared/navbar'
|
66
|
+
end
|
67
|
+
%>
|
68
|
+
```
|
69
|
+
|
70
|
+
### With ViewComponents
|
71
|
+
|
72
|
+
Ruby2html seamlessly integrates with ViewComponents, offering flexibility in how you define your component's HTML structure. You can use the `call` method with Ruby2html syntax, or stick with traditional `.erb` template files.
|
73
|
+
|
74
|
+
File: `app/components/application_component.rb`
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
# frozen_string_literal: true
|
78
|
+
|
79
|
+
class ApplicationComponent < ViewComponent::Base
|
80
|
+
include Ruby2html::ComponentHelper
|
81
|
+
end
|
82
|
+
```
|
83
|
+
|
84
|
+
#### Option 1: Using `call` method with Ruby2html
|
85
|
+
|
86
|
+
File: `app/components/greeting_component.rb`
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
# frozen_string_literal: true
|
90
|
+
|
91
|
+
class GreetingComponent < ApplicationComponent
|
92
|
+
def initialize(name)
|
93
|
+
@name = name
|
94
|
+
end
|
95
|
+
|
96
|
+
def call
|
97
|
+
html(self) do
|
98
|
+
h1 class: 'greeting', 'data-user': @name do
|
99
|
+
plain "Hello, #{@name}! 👋"
|
100
|
+
end
|
101
|
+
p class: 'welcome-message' do
|
102
|
+
plain 'Welcome to the wonderful world of Ruby2html!'
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
```
|
108
|
+
|
109
|
+
#### Option 2: Using traditional ERB template
|
110
|
+
|
111
|
+
File: `app/components/farewell_component.rb`
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
# frozen_string_literal: true
|
115
|
+
|
116
|
+
class FarewellComponent < ApplicationComponent
|
117
|
+
def initialize(name)
|
118
|
+
@name = name
|
119
|
+
end
|
120
|
+
end
|
121
|
+
```
|
122
|
+
|
123
|
+
File: `app/components/farewell_component.html.erb`
|
124
|
+
|
125
|
+
```erb
|
126
|
+
<div class="farewell">
|
127
|
+
<h2>Goodbye, <%= @name %>! 👋</h2>
|
128
|
+
<p>We hope you enjoyed using Ruby2html!</p>
|
129
|
+
|
130
|
+
<%=
|
131
|
+
html do
|
132
|
+
link_to 'Home', root_path, class: 'btn btn-primary', 'data-turbo': false
|
133
|
+
end
|
134
|
+
%>
|
135
|
+
</div>
|
136
|
+
```
|
137
|
+
|
138
|
+
This flexibility allows you to:
|
139
|
+
- Use Ruby2html syntax for new components or when refactoring existing ones
|
140
|
+
- Keep using familiar ERB templates where preferred
|
141
|
+
- Mix and match approaches within your application as needed
|
142
|
+
|
143
|
+
### More Component Examples
|
144
|
+
|
145
|
+
File: `app/components/first_component.rb`
|
146
|
+
|
147
|
+
```ruby
|
148
|
+
# frozen_string_literal: true
|
149
|
+
|
150
|
+
class FirstComponent < ApplicationComponent
|
151
|
+
def initialize
|
152
|
+
@item = 'Hello, World!'
|
153
|
+
end
|
154
|
+
|
155
|
+
def call
|
156
|
+
html(self) do
|
157
|
+
h1 id: 'first-component-title' do
|
158
|
+
plain 'first component'
|
159
|
+
end
|
160
|
+
div class: 'content-wrapper' do
|
161
|
+
h2 'A subheading'
|
162
|
+
end
|
163
|
+
p class: 'greeting-text', 'data-testid': 'greeting' do
|
164
|
+
plain @item
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
```
|
170
|
+
|
171
|
+
File: `app/components/second_component.rb`
|
172
|
+
|
173
|
+
```ruby
|
174
|
+
# frozen_string_literal: true
|
175
|
+
|
176
|
+
class SecondComponent < ApplicationComponent
|
177
|
+
def call
|
178
|
+
html(self) do
|
179
|
+
h1 class: 'my-class', id: 'second-component-title', 'data-controller': 'second' do
|
180
|
+
plain 'second component'
|
181
|
+
end
|
182
|
+
link_to 'Home', root_path, class: 'nav-link', 'data-turbo-frame': false
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
```
|
187
|
+
|
188
|
+
## Without Rails
|
189
|
+
```ruby
|
190
|
+
html = Ruby2html::Render.new(nil) do # nil is the context, you can use self or any other object
|
191
|
+
html do
|
192
|
+
h1 'Hello, World!'
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
puts html.render
|
197
|
+
```
|
198
|
+
|
199
|
+
## 🐢 Gradual Adoption
|
200
|
+
|
201
|
+
One of the best features of Ruby2html is that you don't need to rewrite all your views at once! You can adopt it gradually, mixing Ruby2html with your existing ERB templates. This allows for a smooth transition at your own pace.
|
202
|
+
|
203
|
+
### Mixed usage example
|
204
|
+
|
205
|
+
File: `app/views/your_mixed_view.html.erb`
|
206
|
+
|
207
|
+
```erb
|
208
|
+
<h1>Welcome to our gradually evolving page!</h1>
|
209
|
+
|
210
|
+
<%= render partial: 'legacy_erb_partial' %>
|
211
|
+
|
212
|
+
<%=
|
213
|
+
html(self) do
|
214
|
+
div class: 'ruby2html-section' do
|
215
|
+
h2 "This section is powered by Ruby2html!"
|
216
|
+
p "Isn't it beautiful? 😍"
|
217
|
+
end
|
218
|
+
end
|
219
|
+
%>
|
220
|
+
|
221
|
+
<%= render ModernComponent.new %>
|
222
|
+
|
223
|
+
<footer>
|
224
|
+
<!-- More legacy ERB code -->
|
225
|
+
</footer>
|
226
|
+
```
|
227
|
+
|
228
|
+
In this example, you can see how Ruby2html seamlessly integrates with existing ERB code. This approach allows you to:
|
229
|
+
|
230
|
+
- Keep your existing ERB templates and partials
|
231
|
+
- Gradually introduce Ruby2html in specific sections
|
232
|
+
- Use Ruby2html in new components while maintaining older ones
|
233
|
+
- Refactor your views at your own pace
|
234
|
+
|
235
|
+
Remember, there's no rush! You can keep your `.erb` files and Ruby2html code side by side until you're ready to fully transition. This flexibility ensures that adopting Ruby2html won't disrupt your existing workflow or require a massive rewrite of your application. 🌈
|
236
|
+
|
237
|
+
## 🛠 Development
|
238
|
+
|
239
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
240
|
+
|
241
|
+
## 🤝 Contributing
|
242
|
+
|
243
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/sebyx07/ruby2html. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/sebyx07/ruby2html/blob/master/CODE_OF_CONDUCT.md).
|
244
|
+
|
245
|
+
## 📜 License
|
246
|
+
|
247
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
248
|
+
|
249
|
+
## 🌈 Code of Conduct
|
250
|
+
|
251
|
+
Everyone interacting in the Ruby2html project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/sebyx07/ruby2html/blob/master/CODE_OF_CONDUCT.md).
|
252
|
+
|
253
|
+
## 🌟 Features
|
254
|
+
|
255
|
+
- Write views in pure Ruby 💎
|
256
|
+
- Seamless Rails integration 🛤️
|
257
|
+
- ViewComponent support with flexible template options 🧩
|
258
|
+
- Automatic HTML beautification 💅
|
259
|
+
- Easy addition of custom attributes and data attributes 🏷️
|
260
|
+
- Gradual adoption - mix with existing ERB templates 🐢
|
261
|
+
- Improved readability and maintainability 📚
|
262
|
+
- Full access to Ruby's power in your views 💪
|
263
|
+
|
264
|
+
Start writing your views in Ruby today and experience the magic of Ruby2html! ✨🔮
|
data/Rakefile
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
4
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
5
|
+
|
6
|
+
require_relative 'config/application'
|
7
|
+
|
8
|
+
Rails.application.load_tasks
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
|
6
|
+
* vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ApplicationController < ActionController::Base
|
4
|
+
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
|
5
|
+
allow_browser versions: :modern
|
6
|
+
include Ruby2html::RailsHelper
|
7
|
+
end
|
File without changes
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ApplicationJob < ActiveJob::Base
|
4
|
+
# Automatically retry jobs that encountered a deadlock
|
5
|
+
# retry_on ActiveRecord::Deadlocked
|
6
|
+
|
7
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
8
|
+
# discard_on ActiveJob::DeserializationError
|
9
|
+
end
|
File without changes
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<h1>Home</h1>
|
2
|
+
|
3
|
+
<%= render FirstComponent.new %>
|
4
|
+
<%= render SecondComponent.new %>
|
5
|
+
|
6
|
+
<%=
|
7
|
+
html(self) do
|
8
|
+
h1(id: 4) { plain "ok" }
|
9
|
+
h1 "ok"
|
10
|
+
h1 "ok"
|
11
|
+
h1 "ok"
|
12
|
+
h1 "ok"
|
13
|
+
h1 "ok"
|
14
|
+
div do
|
15
|
+
link_to 'home', root_path
|
16
|
+
end
|
17
|
+
link_to 'home', root_path
|
18
|
+
link_to 'home', root_path
|
19
|
+
|
20
|
+
render partial: 'shared/navbar'
|
21
|
+
|
22
|
+
@items.each do |item|
|
23
|
+
h1 item[:title]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
%>
|
27
|
+
|
28
|
+
<%= render partial: 'shared/navbar' %>
|
29
|
+
|
30
|
+
<%=
|
31
|
+
html(self) do
|
32
|
+
@items.each do |item|
|
33
|
+
h1 item[:title]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
%>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title><%= content_for(:title) || "Ruby2html" %></title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
<%= csp_meta_tag %>
|
9
|
+
|
10
|
+
<%= yield :head %>
|
11
|
+
|
12
|
+
<link rel="manifest" href="/manifest.json">
|
13
|
+
<link rel="icon" href="/icon.png" type="image/png">
|
14
|
+
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
15
|
+
<link rel="apple-touch-icon" href="/icon.png">
|
16
|
+
<%= stylesheet_link_tag "application" %>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<%= yield %>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"name": "Ruby2html",
|
3
|
+
"icons": [
|
4
|
+
{
|
5
|
+
"src": "/icon.png",
|
6
|
+
"type": "image/png",
|
7
|
+
"sizes": "512x512"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"src": "/icon.png",
|
11
|
+
"type": "image/png",
|
12
|
+
"sizes": "512x512",
|
13
|
+
"purpose": "maskable"
|
14
|
+
}
|
15
|
+
],
|
16
|
+
"start_url": "/",
|
17
|
+
"display": "standalone",
|
18
|
+
"scope": "/",
|
19
|
+
"description": "Ruby2html.",
|
20
|
+
"theme_color": "red",
|
21
|
+
"background_color": "red"
|
22
|
+
}
|