streamlined 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dcc0a9b6b0ecfe8dea09c22adf936d6de78a260fc5948670b7d5f650d08f2a9c
4
- data.tar.gz: 340bb32a6e17eb18b34d9ceeda061890cf1209f7d9777451542e98e612057a7e
3
+ metadata.gz: f997f37e68f2febf5c8b7b73366cd75cdccae74942b55cef25ed133748086c29
4
+ data.tar.gz: 22a5a7db25b97311c38892f675a52dcbfd29e971a95da94b2aec24909e270920
5
5
  SHA512:
6
- metadata.gz: 13c5d919ca388018eaade16466e3e74f58a289a6fbfc632d948ec45c22f40d784b5a657e1c61f76780263766c22fc896a12f06e2d593a3c3874a1bafeeb1683e
7
- data.tar.gz: 8bdbf7d17cec2924d09e3597844080bba08c01d962f3c0d3bbf3ac9cb4ad89a7fde4feedc83b49d0fd05de22a3ce6b7b62acf4ca6a57577b819a0142595c7264
6
+ metadata.gz: 7b1708ddd3a081021f4d31aef3d6e63ede1f4f6b10325a31f58ad72d5ca7bb1bc9a48d19c58900bd82e866649cac6bd232061d4875f0a0af0f2b421e759cecc2
7
+ data.tar.gz: bc0e305ea12bf8858d4a75e081154511fef321ae8a80acb670cd0a80e1ea90d8011e3a34c9c95849347ee10dbd8cc041d1a02b4cfe3781951dc87f36bdad3b6d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.6.0] - 2024-09-07
6
+
7
+ - Use much faster `CGI.escapeHTML` for escaping text
8
+
9
+ ## [0.5.2] - 2024-04-06
10
+
11
+ - And we need that same fix for `text` too
12
+
5
13
  ## [0.5.1] - 2024-04-06
6
14
 
7
15
  - Fix logic bug in `html`
data/Gemfile.lock CHANGED
@@ -1,97 +1,98 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- streamlined (0.5.1)
4
+ streamlined (0.6.0)
5
5
  serbea (>= 2.1)
6
6
  zeitwerk (~> 2.5)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (7.1.3.2)
11
+ activesupport (7.2.1)
12
12
  base64
13
13
  bigdecimal
14
- concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ concurrent-ruby (~> 1.0, >= 1.3.1)
15
15
  connection_pool (>= 2.2.5)
16
16
  drb
17
17
  i18n (>= 1.6, < 2)
18
+ logger (>= 1.4.2)
18
19
  minitest (>= 5.1)
19
- mutex_m
20
- tzinfo (~> 2.0)
20
+ securerandom (>= 0.3)
21
+ tzinfo (~> 2.0, >= 2.0.5)
21
22
  ansi (1.5.0)
22
23
  ast (2.4.2)
23
24
  backport (1.2.0)
24
25
  base64 (0.2.0)
25
26
  benchmark (0.3.0)
26
- bigdecimal (3.1.7)
27
- builder (3.2.4)
28
- concurrent-ruby (1.2.3)
27
+ bigdecimal (3.1.8)
28
+ builder (3.3.0)
29
+ concurrent-ruby (1.3.4)
29
30
  connection_pool (2.4.1)
30
31
  diff-lcs (1.5.1)
31
32
  drb (2.2.1)
32
33
  e2mmap (0.1.0)
33
- erubi (1.12.0)
34
- i18n (1.14.4)
34
+ erubi (1.13.0)
35
+ i18n (1.14.5)
35
36
  concurrent-ruby (~> 1.0)
36
- jaro_winkler (1.5.6)
37
+ jaro_winkler (1.6.0)
37
38
  json (2.7.2)
38
39
  kramdown (2.4.0)
39
40
  rexml
40
41
  kramdown-parser-gfm (1.1.0)
41
42
  kramdown (~> 2.0)
42
43
  language_server-protocol (3.17.0.3)
43
- minitest (5.22.3)
44
- minitest-reporters (1.6.1)
44
+ logger (1.6.1)
45
+ minitest (5.25.1)
46
+ minitest-reporters (1.7.1)
45
47
  ansi
46
48
  builder
47
49
  minitest (>= 5.0)
48
50
  ruby-progressbar
49
- mutex_m (0.2.0)
50
- nokogiri (1.16.3-arm64-darwin)
51
+ nokogiri (1.16.7-arm64-darwin)
51
52
  racc (~> 1.4)
52
- nokogiri (1.16.3-x86_64-linux)
53
+ nokogiri (1.16.7-x86_64-linux)
53
54
  racc (~> 1.4)
54
- parallel (1.24.0)
55
- parser (3.3.0.5)
55
+ parallel (1.26.3)
56
+ parser (3.3.5.0)
56
57
  ast (~> 2.4.1)
57
58
  racc
58
- racc (1.7.3)
59
+ racc (1.8.1)
59
60
  rails-dom-testing (2.2.0)
60
61
  activesupport (>= 5.0.0)
61
62
  minitest
62
63
  nokogiri (>= 1.6)
63
64
  rainbow (3.1.1)
64
- rake (13.2.0)
65
+ rake (13.2.1)
65
66
  rbs (2.8.4)
66
- regexp_parser (2.9.0)
67
+ regexp_parser (2.9.2)
67
68
  reverse_markdown (2.1.1)
68
69
  nokogiri
69
- rexml (3.2.6)
70
- rubocop (1.62.1)
70
+ rexml (3.3.7)
71
+ rubocop (1.66.1)
71
72
  json (~> 2.3)
72
73
  language_server-protocol (>= 3.17.0)
73
74
  parallel (~> 1.10)
74
75
  parser (>= 3.3.0.2)
75
76
  rainbow (>= 2.2.2, < 4.0)
76
- regexp_parser (>= 1.8, < 3.0)
77
- rexml (>= 3.2.5, < 4.0)
78
- rubocop-ast (>= 1.31.1, < 2.0)
77
+ regexp_parser (>= 2.4, < 3.0)
78
+ rubocop-ast (>= 1.32.2, < 2.0)
79
79
  ruby-progressbar (~> 1.7)
80
80
  unicode-display_width (>= 2.4.0, < 3.0)
81
- rubocop-ast (1.31.2)
82
- parser (>= 3.3.0.4)
83
- rubocop-bridgetown (0.4.1)
81
+ rubocop-ast (1.32.3)
82
+ parser (>= 3.3.1.0)
83
+ rubocop-bridgetown (0.5.0)
84
84
  rubocop (~> 1.23)
85
85
  rubocop-performance (~> 1.12)
86
86
  rubocop-minitest (0.20.1)
87
87
  rubocop (>= 0.90, < 2.0)
88
- rubocop-performance (1.21.0)
88
+ rubocop-performance (1.21.1)
89
89
  rubocop (>= 1.48.1, < 2.0)
90
90
  rubocop-ast (>= 1.31.1, < 2.0)
91
91
  rubocop-rake (0.6.0)
92
92
  rubocop (~> 1.0)
93
93
  ruby-progressbar (1.13.0)
94
- serbea (2.1.0)
94
+ securerandom (0.3.1)
95
+ serbea (2.2.0)
95
96
  erubi (>= 1.10)
96
97
  tilt (~> 2.0)
97
98
  solargraph (0.50.0)
@@ -110,13 +111,13 @@ GEM
110
111
  thor (~> 1.0)
111
112
  tilt (~> 2.0)
112
113
  yard (~> 0.9, >= 0.9.24)
113
- thor (1.3.1)
114
- tilt (2.3.0)
114
+ thor (1.3.2)
115
+ tilt (2.4.0)
115
116
  tzinfo (2.0.6)
116
117
  concurrent-ruby (~> 1.0)
117
118
  unicode-display_width (2.5.0)
118
- yard (0.9.36)
119
- zeitwerk (2.6.13)
119
+ yard (0.9.37)
120
+ zeitwerk (2.6.18)
120
121
 
121
122
  PLATFORMS
122
123
  arm64-darwin-21
@@ -7,6 +7,12 @@ module Streamlined
7
7
  module TouchableProc
8
8
  attr_accessor :touched
9
9
 
10
+ def self.run_through_pipeline(in_context_binding, input, callback)
11
+ Serbea::Pipeline.new(in_context_binding, input).tap { _1.instance_exec(&callback) }.then do |pipeline|
12
+ -> { pipeline.value }
13
+ end
14
+ end
15
+
10
16
  def touch
11
17
  self.touched = true
12
18
  self
@@ -75,25 +81,21 @@ module Streamlined
75
81
  # @param value [String] the attribute value
76
82
  # @return [String]
77
83
  def attribute_segment(attr, value)
78
- "#{attr}=#{value.to_s.encode(xml: :attr)}"
84
+ "#{attr}=\"#{CGI.escapeHTML(value.to_s)}\""
79
85
  end
80
86
 
81
87
  def text(callback, piping = nil)
82
- callback = Serbea::Pipeline.new(binding, callback).tap { _1.instance_exec(&piping) } if piping
88
+ callback = TouchableProc.run_through_pipeline(binding, callback, piping) if piping
83
89
 
84
90
  (callback.is_a?(Proc) ? callback.touch : callback).to_s.then do |str|
85
91
  next str if str.html_safe?
86
92
 
87
- str.encode(xml: :attr).gsub(%r{\A"|"\Z}, "")
93
+ CGI.escapeHTML(str)
88
94
  end
89
95
  end
90
96
 
91
97
  def html(callback, piping = nil)
92
- if piping
93
- callback = Serbea::Pipeline.new(binding, callback).tap { _1.instance_exec(&piping) }.then do |pipeline|
94
- -> { pipeline.value }
95
- end
96
- end
98
+ callback = TouchableProc.run_through_pipeline(binding, callback, piping) if piping
97
99
 
98
100
  callback.html_safe.touch
99
101
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Streamlined
4
- VERSION = "0.5.1"
4
+ VERSION = "0.6.0"
5
5
  end
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.5.1
4
+ version: 0.6.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: 2024-04-06 00:00:00.000000000 Z
11
+ date: 2024-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: serbea