streamlined 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +2 -2
- data/README.md +2 -2
- data/lib/roda/plugins/streamlined.rb +27 -0
- data/lib/streamlined/helpers.rb +3 -1
- data/lib/streamlined/version.rb +1 -1
- data/lib/streamlined.rb +5 -1
- data/streamlined.gemspec +2 -2
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05f5b1f3f4076db6a1199096cd1da0c78594161b4fadb12bbd5e8777a7d5993f
|
4
|
+
data.tar.gz: 1db72d9247ae8d7d5f1b2c49de47c30c8b7341cc50bac7f434386d9ac8eb5555
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6539b91a92c00001129658a57d139f19672ea07be9ea54a38d1fa04dc2579e7d98d40d439d49a9d24d9a9207228733f03fb8756651fcfefa0e34acc2054d5e42
|
7
|
+
data.tar.gz: 045c5edea6a3f743461ae9fa0a5918867daeb8b59e7ac643576bb3c624a16ed3a1d5e360e1280c8514514c66eff91e01664757b464298912ba7abbf465a43322
|
data/.rubocop.yml
CHANGED
@@ -7,7 +7,7 @@ inherit_gem:
|
|
7
7
|
rubocop-bridgetown: .rubocop.yml
|
8
8
|
|
9
9
|
AllCops:
|
10
|
-
TargetRubyVersion: 3.
|
10
|
+
TargetRubyVersion: 3.1
|
11
11
|
NewCops: enable
|
12
12
|
|
13
13
|
Exclude:
|
@@ -45,6 +45,9 @@ Metrics/MethodLength:
|
|
45
45
|
Exclude:
|
46
46
|
- test/**/*.rb
|
47
47
|
|
48
|
+
Naming/BlockForwarding:
|
49
|
+
Enabled: false
|
50
|
+
|
48
51
|
# Disabled to aid in template readability
|
49
52
|
Style/NestedParenthesizedCalls:
|
50
53
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
## [Unreleased]
|
4
4
|
|
5
|
+
## [0.4.0] — 2024-04-04
|
6
|
+
|
7
|
+
- Provide Roda plugin to mix in Streamlined helpers.
|
8
|
+
|
9
|
+
## [0.3.1] - 2023-11-10
|
10
|
+
|
11
|
+
- Ensure false or nil values for attributes avoid rendering attributes at all
|
12
|
+
|
13
|
+
## [0.3.0] - 2023-11-07
|
14
|
+
|
15
|
+
- Fix escaping bug due to bad test
|
16
|
+
|
5
17
|
## [0.2.0] - 2023-11-07
|
6
18
|
|
7
19
|
- Back out of more complicated `render_in` mechanics
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
streamlined (0.
|
4
|
+
streamlined (0.4.0)
|
5
5
|
serbea (>= 2.1)
|
6
6
|
zeitwerk (~> 2.5)
|
7
7
|
|
@@ -81,7 +81,7 @@ GEM
|
|
81
81
|
unicode-display_width (>= 2.4.0, < 3.0)
|
82
82
|
rubocop-ast (1.30.0)
|
83
83
|
parser (>= 3.2.1.0)
|
84
|
-
rubocop-bridgetown (0.4.
|
84
|
+
rubocop-bridgetown (0.4.1)
|
85
85
|
rubocop (~> 1.23)
|
86
86
|
rubocop-performance (~> 1.12)
|
87
87
|
rubocop-minitest (0.20.1)
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Streamlined
|
2
2
|
|
3
|
-
|
3
|
+
HTML fragment and component rendering for Ruby using streamlined procs & heredocs with safety checks via RuboCop. Bridgetown, Roda, and Rails all supported.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -10,7 +10,7 @@ Add Streamlined to your application's Gemfile by running:
|
|
10
10
|
bundle add streamlined
|
11
11
|
```
|
12
12
|
|
13
|
-
(If you're using Bridgetown, it's bundled in for Bridgetown
|
13
|
+
(If you're using Bridgetown, it's bundled in for Bridgetown 2.0…coming soon)
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Roda
|
4
|
+
module RodaPlugins
|
5
|
+
module Streamlined
|
6
|
+
module CheckForStreamlined
|
7
|
+
def self.===(other)
|
8
|
+
other.is_a?(Proc) && other.respond_to?(:touched) && other.touched
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
module InstanceMethods
|
13
|
+
include ::Streamlined::Helpers
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.load_dependencies(app, _opts = OPTS)
|
17
|
+
app.plugin :custom_block_results
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.configure(app, _opts = OPTS)
|
21
|
+
app.handle_block_result CheckForStreamlined, &:to_s
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
register_plugin :streamlined, Streamlined
|
26
|
+
end
|
27
|
+
end
|
data/lib/streamlined/helpers.rb
CHANGED
@@ -44,10 +44,12 @@ module Streamlined
|
|
44
44
|
# @param prefix_space [Boolean] add a starting space if attributes are present,
|
45
45
|
# useful in tag builders
|
46
46
|
# @return [String]
|
47
|
-
def html_attributes(options = nil, prefix_space: false, **kwargs)
|
47
|
+
def html_attributes(options = nil, prefix_space: false, **kwargs) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
48
48
|
options ||= kwargs
|
49
49
|
segments = []
|
50
50
|
options.each do |attr, option|
|
51
|
+
next if option == false || option.nil?
|
52
|
+
|
51
53
|
attr = dashed(attr)
|
52
54
|
if option.is_a?(Hash)
|
53
55
|
option = option.transform_keys { |key| "#{attr}-#{dashed(key)}" }
|
data/lib/streamlined/version.rb
CHANGED
data/lib/streamlined.rb
CHANGED
@@ -4,6 +4,7 @@ require "serbea/helpers" # primarily just for HTML safety polyfill
|
|
4
4
|
require "serbea/pipeline"
|
5
5
|
require "zeitwerk"
|
6
6
|
loader = Zeitwerk::Loader.for_gem
|
7
|
+
loader.ignore("#{__dir__}/roda")
|
7
8
|
loader.setup
|
8
9
|
|
9
10
|
module Streamlined
|
@@ -11,6 +12,9 @@ module Streamlined
|
|
11
12
|
end
|
12
13
|
|
13
14
|
if defined?(Bridgetown)
|
14
|
-
Bridgetown.initializer :streamlined do
|
15
|
+
Bridgetown.initializer :streamlined do |config|
|
16
|
+
config.roda do |app|
|
17
|
+
app.plugin :streamlined
|
18
|
+
end
|
15
19
|
end
|
16
20
|
end
|
data/streamlined.gemspec
CHANGED
@@ -8,10 +8,10 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.author = "Bridgetown Team"
|
9
9
|
spec.email = "maintainers@bridgetownrb.com"
|
10
10
|
|
11
|
-
spec.summary = "
|
11
|
+
spec.summary = "HTML fragment & component rendering for Ruby using streamlined procs & heredocs."
|
12
12
|
spec.homepage = "https://github.com/bridgetownrb/streamlined"
|
13
13
|
spec.license = "MIT"
|
14
|
-
spec.required_ruby_version = ">= 3.
|
14
|
+
spec.required_ruby_version = ">= 3.1"
|
15
15
|
spec.metadata["rubygems_mfa_required"] = "true"
|
16
16
|
|
17
17
|
# Specify which files should be added to the gem when it is released.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: streamlined
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bridgetown Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: serbea
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- bin/rake
|
58
58
|
- bin/rubocop
|
59
59
|
- bin/setup
|
60
|
+
- lib/roda/plugins/streamlined.rb
|
60
61
|
- lib/streamlined.rb
|
61
62
|
- lib/streamlined/helpers.rb
|
62
63
|
- lib/streamlined/renderable.rb
|
@@ -75,7 +76,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
75
76
|
requirements:
|
76
77
|
- - ">="
|
77
78
|
- !ruby/object:Gem::Version
|
78
|
-
version: '3.
|
79
|
+
version: '3.1'
|
79
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
81
|
requirements:
|
81
82
|
- - ">="
|
@@ -85,5 +86,5 @@ requirements: []
|
|
85
86
|
rubygems_version: 3.3.3
|
86
87
|
signing_key:
|
87
88
|
specification_version: 4
|
88
|
-
summary:
|
89
|
+
summary: HTML fragment & component rendering for Ruby using streamlined procs & heredocs.
|
89
90
|
test_files: []
|