Skip to content

Commit

Permalink
Update Void Element List
Browse files Browse the repository at this point in the history
Latest Rails Edge no longer tracks void elements as a constant.
Instead of depending on this, we just hardcode the known void
list from the latest live html standard. (Dated 2024-02)

This also removes Ruby 3.0 from the supported list for two
reasons; It is EoL in March, Rails Edge no longer supports it.
  • Loading branch information
zacheryph authored and patbenatar committed Feb 26, 2024
1 parent b1d0d35 commit 2bad81b
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 88 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ jobs:
fail-fast: false
matrix:
gemfile: [rails_6_1, rails_7_0, rails_7_1, rails_master]
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
ruby: ['3.0', 3.1, 3.2, 3.3]
# quote version numbers, they are not "numbers"
ruby: ['3.1', '3.2', '3.3']
runs-on: ubuntu-latest
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: ruby
rvm:
- 3.0
- 3.1
- 3.2
- 3.3
Expand Down
184 changes: 106 additions & 78 deletions gemfiles/rails_master.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,94 +1,98 @@
GIT
remote: https://github.com/rails/rails.git
revision: 54c73577690e1ec81a79472ba98e28bb3e18703f
revision: 23af6f37a310e16916ca788837f4a7accb2cebad
branch: main
specs:
actioncable (7.1.0.alpha)
actionpack (= 7.1.0.alpha)
activesupport (= 7.1.0.alpha)
actioncable (7.2.0.alpha)
actionpack (= 7.2.0.alpha)
activesupport (= 7.2.0.alpha)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.1.0.alpha)
actionpack (= 7.1.0.alpha)
activejob (= 7.1.0.alpha)
activerecord (= 7.1.0.alpha)
activestorage (= 7.1.0.alpha)
activesupport (= 7.1.0.alpha)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.0.alpha)
actionpack (= 7.1.0.alpha)
actionview (= 7.1.0.alpha)
activejob (= 7.1.0.alpha)
activesupport (= 7.1.0.alpha)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.1.0.alpha)
actionview (= 7.1.0.alpha)
activesupport (= 7.1.0.alpha)
rack (~> 2.0, >= 2.2.0)
zeitwerk (~> 2.6)
actionmailbox (7.2.0.alpha)
actionpack (= 7.2.0.alpha)
activejob (= 7.2.0.alpha)
activerecord (= 7.2.0.alpha)
activestorage (= 7.2.0.alpha)
activesupport (= 7.2.0.alpha)
mail (>= 2.8.0)
actionmailer (7.2.0.alpha)
actionpack (= 7.2.0.alpha)
actionview (= 7.2.0.alpha)
activejob (= 7.2.0.alpha)
activesupport (= 7.2.0.alpha)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.2.0.alpha)
actionview (= 7.2.0.alpha)
activesupport (= 7.2.0.alpha)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.1.0.alpha)
actionpack (= 7.1.0.alpha)
activerecord (= 7.1.0.alpha)
activestorage (= 7.1.0.alpha)
activesupport (= 7.1.0.alpha)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actiontext (7.2.0.alpha)
actionpack (= 7.2.0.alpha)
activerecord (= 7.2.0.alpha)
activestorage (= 7.2.0.alpha)
activesupport (= 7.2.0.alpha)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.0.alpha)
activesupport (= 7.1.0.alpha)
actionview (7.2.0.alpha)
activesupport (= 7.2.0.alpha)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.1.0.alpha)
activesupport (= 7.1.0.alpha)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.2.0.alpha)
activesupport (= 7.2.0.alpha)
globalid (>= 0.3.6)
activemodel (7.1.0.alpha)
activesupport (= 7.1.0.alpha)
activerecord (7.1.0.alpha)
activemodel (= 7.1.0.alpha)
activesupport (= 7.1.0.alpha)
activestorage (7.1.0.alpha)
actionpack (= 7.1.0.alpha)
activejob (= 7.1.0.alpha)
activerecord (= 7.1.0.alpha)
activesupport (= 7.1.0.alpha)
activemodel (7.2.0.alpha)
activesupport (= 7.2.0.alpha)
activerecord (7.2.0.alpha)
activemodel (= 7.2.0.alpha)
activesupport (= 7.2.0.alpha)
timeout (>= 0.4.0)
activestorage (7.2.0.alpha)
actionpack (= 7.2.0.alpha)
activejob (= 7.2.0.alpha)
activerecord (= 7.2.0.alpha)
activesupport (= 7.2.0.alpha)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.1.0.alpha)
activesupport (7.2.0.alpha)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
rails (7.1.0.alpha)
actioncable (= 7.1.0.alpha)
actionmailbox (= 7.1.0.alpha)
actionmailer (= 7.1.0.alpha)
actionpack (= 7.1.0.alpha)
actiontext (= 7.1.0.alpha)
actionview (= 7.1.0.alpha)
activejob (= 7.1.0.alpha)
activemodel (= 7.1.0.alpha)
activerecord (= 7.1.0.alpha)
activestorage (= 7.1.0.alpha)
activesupport (= 7.1.0.alpha)
minitest (>= 5.1, < 5.22.0)
tzinfo (~> 2.0, >= 2.0.5)
rails (7.2.0.alpha)
actioncable (= 7.2.0.alpha)
actionmailbox (= 7.2.0.alpha)
actionmailer (= 7.2.0.alpha)
actionpack (= 7.2.0.alpha)
actiontext (= 7.2.0.alpha)
actionview (= 7.2.0.alpha)
activejob (= 7.2.0.alpha)
activemodel (= 7.2.0.alpha)
activerecord (= 7.2.0.alpha)
activestorage (= 7.2.0.alpha)
activesupport (= 7.2.0.alpha)
bundler (>= 1.15.0)
railties (= 7.1.0.alpha)
railties (7.1.0.alpha)
actionpack (= 7.1.0.alpha)
activesupport (= 7.1.0.alpha)
method_source
railties (= 7.2.0.alpha)
railties (7.2.0.alpha)
actionpack (= 7.2.0.alpha)
activesupport (= 7.2.0.alpha)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)

PATH
remote: ..
Expand All @@ -104,13 +108,18 @@ GEM
bundler
rake
thor (>= 0.14.0)
base64 (0.2.0)
bigdecimal (3.1.6)
builder (3.2.4)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
crass (1.0.6)
date (3.3.4)
diff-lcs (1.5.1)
drb (2.2.0)
ruby2_keywords
erubi (1.12.0)
ffi (1.16.3)
formatador (1.1.0)
Expand All @@ -132,7 +141,11 @@ GEM
rspec (>= 2.99.0, < 4.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
listen (3.8.0)
io-console (0.7.2)
irb (1.11.2)
rdoc
reline (>= 0.4.2)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.22.0)
Expand Down Expand Up @@ -173,12 +186,19 @@ GEM
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
psych (5.1.2)
stringio
puma (6.4.2)
nio4r (~> 2.0)
racc (1.7.3)
rack (2.2.8.1)
rack (3.0.9.1)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack (>= 1.3)
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
Expand All @@ -190,6 +210,10 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rdoc (6.6.2)
psych (>= 4.0.0)
reline (0.4.2)
io-console (~> 0.5)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
Expand All @@ -213,7 +237,8 @@ GEM
rspec-expectations (~> 3.12)
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (3.13.0)
rspec-support (3.13.1)
ruby2_keywords (0.0.5)
shellany (0.0.1)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
Expand All @@ -224,10 +249,13 @@ GEM
sprockets (>= 3.0.0)
sqlite3 (1.7.2-arm64-darwin)
sqlite3 (1.7.2-x86_64-linux)
stringio (3.1.0)
thor (1.3.0)
timeout (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
useragent (0.16.10)
webrick (1.8.1)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
Expand Down
9 changes: 3 additions & 6 deletions lib/rbexy/nodes/html_element.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
module Rbexy
module Nodes
class HTMLElement < AbstractElement
if ActionView.version >= Gem::Version.new("7.0.0")
KNOWN_VOID_ELEMENTS = ActionView::Helpers::TagHelper::TagBuilder::HTML_VOID_ELEMENTS.map(&:to_s).to_set
else
KNOWN_VOID_ELEMENTS = ActionView::Helpers::TagHelper::TagBuilder::VOID_ELEMENTS.map(&:to_s).to_set
end
# Referenced from https://html.spec.whatwg.org/#void-elements
HTML_VOID_ELEMENTS = %w(area base br col embed hr img input link meta source track wbr)

def precompile
nodes = []
Expand All @@ -24,7 +21,7 @@ def precompile
private

def void?
KNOWN_VOID_ELEMENTS.include?(name)
HTML_VOID_ELEMENTS.include?(name)
end

def precompile_open_tag
Expand Down
2 changes: 1 addition & 1 deletion rbexy.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
spec.summary = "A Ruby template language inspired by JSX"
spec.homepage = "https://github.com/patbenatar/rbexy"
spec.license = "MIT"
spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")

spec.metadata["allowed_push_host"] = "https://rubygems.org"

Expand Down

0 comments on commit 2bad81b

Please sign in to comment.