diff --git a/CHANGELOG.md b/CHANGELOG.md index 88bc779..2d5f76a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.15.0] - 2024-04-17 + +- Add compatibility fixes re: Streamlined + ## [0.14.0] - 2024-03-03 - Add Rodauth support in Bridgetown diff --git a/Gemfile.lock b/Gemfile.lock index 49e797e..9603677 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - lifeform (0.14.0) + lifeform (0.15.0) hash_with_dot_access (>= 1.2) sequel (>= 5.72) streamlined (>= 0.2.0) @@ -10,7 +10,7 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (7.1.1) + activesupport (7.1.3.2) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -23,41 +23,40 @@ GEM ansi (1.5.0) ast (2.4.2) backport (1.2.0) - base64 (0.1.1) - benchmark (0.2.1) - bigdecimal (3.1.4) + base64 (0.2.0) + benchmark (0.3.0) + bigdecimal (3.1.7) builder (3.2.4) - concurrent-ruby (1.2.2) + concurrent-ruby (1.2.3) connection_pool (2.4.1) - diff-lcs (1.5.0) - drb (2.1.1) - ruby2_keywords + diff-lcs (1.5.1) + drb (2.2.1) e2mmap (0.1.0) erubi (1.12.0) hash_with_dot_access (1.2.0) activesupport (>= 5.0.0, < 8.0) - i18n (1.14.1) + i18n (1.14.4) concurrent-ruby (~> 1.0) jaro_winkler (1.5.6) - json (2.6.3) + json (2.7.2) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) language_server-protocol (3.17.0.3) - minitest (5.20.0) + minitest (5.22.3) minitest-reporters (1.6.1) ansi builder minitest (>= 5.0) ruby-progressbar - mutex_m (0.1.2) - nokogiri (1.15.4-arm64-darwin) + mutex_m (0.2.0) + nokogiri (1.16.4-arm64-darwin) racc (~> 1.4) - nokogiri (1.15.4-x86_64-linux) + nokogiri (1.16.4-x86_64-linux) racc (~> 1.4) - parallel (1.23.0) - parser (3.2.2.4) + parallel (1.24.0) + parser (3.3.0.5) ast (~> 2.4.1) racc racc (1.7.3) @@ -66,37 +65,36 @@ GEM minitest nokogiri (>= 1.6) rainbow (3.1.1) - rake (13.1.0) - regexp_parser (2.8.2) + rake (13.2.1) + regexp_parser (2.9.0) reverse_markdown (2.1.1) nokogiri rexml (3.2.6) - rubocop (1.57.2) + rubocop (1.63.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.4) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.30.0) - parser (>= 3.2.1.0) - rubocop-bridgetown (0.4.1) + rubocop-ast (1.31.2) + parser (>= 3.3.0.4) + rubocop-bridgetown (0.5.0) rubocop (~> 1.23) rubocop-performance (~> 1.12) rubocop-minitest (0.20.1) rubocop (>= 0.90, < 2.0) - rubocop-performance (1.19.1) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) + rubocop-performance (1.21.0) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) ruby-progressbar (1.13.0) - ruby2_keywords (0.0.5) - sequel (5.74.0) + sequel (5.79.0) bigdecimal serbea (2.1.0) erubi (>= 1.10) @@ -116,16 +114,16 @@ GEM thor (~> 1.0) tilt (~> 2.0) yard (~> 0.9, >= 0.9.24) - streamlined (0.3.1) + streamlined (0.5.2) serbea (>= 2.1) zeitwerk (~> 2.5) - thor (1.3.0) + thor (1.3.1) tilt (2.3.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) - yard (0.9.34) - zeitwerk (2.6.12) + yard (0.9.36) + zeitwerk (2.6.13) PLATFORMS arm64-darwin-21 diff --git a/README.md b/README.md index 5eab563..263bbbc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Lifeform -Component-centric form object rendering for Ruby. Rails and Bridgetown both supported. +Component-centric form object rendering for Ruby. Bridgetown, Roda, and Rails all supported. ## Installation diff --git a/lib/lifeform/form.rb b/lib/lifeform/form.rb index f0096a8..eb72636 100644 --- a/lib/lifeform/form.rb +++ b/lib/lifeform/form.rb @@ -197,7 +197,7 @@ def template(&block) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComple form_tag = library::FORM_TAG parameters[:action] ||= url || (model ? helpers.send(self.class.const_get(:MODEL_PATH_HELPER), model) : nil) - html -> { <<~HTML # rubocop:disable Bridgetown/HTMLEscapedHeredoc + html -> { <<~HTML # rubocop:disable Bridgetown/InsecureHeredoc <#{form_tag} #{html_attributes attributes}> #{add_authenticity_token unless parameters[:method].to_s.casecmp("get").zero?} #{@method_tag&.() || ""} diff --git a/lib/lifeform/libraries/default/button.rb b/lib/lifeform/libraries/default/button.rb index 223c8f4..63414f4 100644 --- a/lib/lifeform/libraries/default/button.rb +++ b/lib/lifeform/libraries/default/button.rb @@ -24,17 +24,17 @@ def template(&block) return "" if !@if.nil? && !@if button_tag = dashed self.class.const_get(:BUTTON_TAG) - label_text = block ? capture(self, &block) : @label.is_a?(Proc) ? @label.pipe : @label # rubocop:disable Style/NestedTernaryOperator + label_text = block ? capture(self, &block) : @label - field_body = html -> { <<~HTML # rubocop:disable Bridgetown/HTMLEscapedHeredoc - <#{button_tag}#{html_attributes @attributes, prefix_space: true}>#{text -> { label_text }} + field_body = html -> { <<~HTML # rubocop:disable Bridgetown/InsecureHeredoc + <#{button_tag}#{html_attributes @attributes, prefix_space: true}>#{text label_text} HTML } return field_body unless self.class.const_get(:WRAPPER_TAG) wrapper_tag = dashed self.class.const_get(:WRAPPER_TAG) - html -> { <<~HTML # rubocop:disable Bridgetown/HTMLEscapedHeredoc + html -> { <<~HTML # rubocop:disable Bridgetown/InsecureHeredoc <#{wrapper_tag} #{html_attributes name: @attributes[:name]}>#{field_body} HTML } diff --git a/lib/lifeform/libraries/default/input.rb b/lib/lifeform/libraries/default/input.rb index 0c28f4b..aeb4455 100644 --- a/lib/lifeform/libraries/default/input.rb +++ b/lib/lifeform/libraries/default/input.rb @@ -41,13 +41,13 @@ def model_name def value_for_model = @model.send(attributes[:name]) def handle_labels - label_text = attributes[:label].is_a?(Proc) ? attributes[:label].pipe : attributes[:label] + label_text = attributes[:label] label_name = (attributes[:id] || attributes[:name]).to_s @attributes = attributes.filter_map { |k, v| [k, v] unless k == :label }.to_h -> { <<~HTML - + HTML } end @@ -58,7 +58,7 @@ def template(&block) # rubocop:disable Metrics/AbcSize input_tag = dashed self.class.const_get(:INPUT_TAG) closing_tag = input_tag != "input" - field_body = html -> { <<~HTML # rubocop:disable Bridgetown/HTMLEscapedHeredoc + field_body = html -> { <<~HTML # rubocop:disable Bridgetown/InsecureHeredoc #{html(@label || -> {}).to_s.strip} <#{input_tag} #{html_attributes type: @field_type.to_s, **@attributes}>#{ "" if closing_tag @@ -70,7 +70,7 @@ def template(&block) # rubocop:disable Metrics/AbcSize return field_body unless self.class.const_get(:WRAPPER_TAG) wrapper_tag = dashed self.class.const_get(:WRAPPER_TAG) - html -> { <<~HTML # rubocop:disable Bridgetown/HTMLEscapedHeredoc + html -> { <<~HTML # rubocop:disable Bridgetown/InsecureHeredoc <#{wrapper_tag} #{html_attributes name: @attributes[:name]}>#{field_body.to_s.strip} HTML } diff --git a/lib/lifeform/version.rb b/lib/lifeform/version.rb index 9eca542..b2ebba8 100644 --- a/lib/lifeform/version.rb +++ b/lib/lifeform/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Lifeform - VERSION = "0.14.0" + VERSION = "0.15.0" end diff --git a/test/test_lifeform.rb b/test/test_lifeform.rb index 0afcd7f..13ce480 100644 --- a/test/test_lifeform.rb +++ b/test/test_lifeform.rb @@ -21,7 +21,7 @@ class TestForm < Lifeform::Form class TestAutolayout < Lifeform::Form field :first_name, label: "First Name".html_safe, required: true - field :last_name, label: -> { "Last Name" }, goof: "Wow" + field :last_name, label: -> { "Last Name".html_safe }, goof: "Wow" field :age, library: :shoelace, label: "Your Age" field :submit, type: :submit_button, label: "Save".html_safe, class: "font-bold"