serbea 2.0.0 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1afdeb44daa8b1b9cd20c73ec82ebd02defc8d7322247cdc65870279b380450
4
- data.tar.gz: 9e7371768fd0cab610e26c9b15020d6320d3d8f78a9f805e56c08d3dcec26ddd
3
+ metadata.gz: cbaec081de265cae08c41dbcbfe2ea7686447ff169d8756f45ea446d756a4519
4
+ data.tar.gz: 40d58553c10c8c10299064ce1ae88a030b947ac6c0b92aea8e8c9282cca7ac16
5
5
  SHA512:
6
- metadata.gz: 352d91c0845ee77c0fc4cbea9953f3d9f63fcc230ad2f6f9fc52cbba64bd6da409482a6e2c5e032c39f853acd1c0f62042869a13f9a34a88c74387825b433fc1
7
- data.tar.gz: fde8baf367844161f6f6afcd10c29450673d56871e67949cb831f0d7c86b2a163b644a80e171ffa4d0a104ef549cfa7201dacf7ea6d6522305bfc6aa82ca8ffc
6
+ metadata.gz: e4762251bb0285d122b59ac3611cbda5afdfedb6c075f97b2746456ce6be3fffd6362a82967d9bbedbc8fa092649f9e8240de293e58826dd79e4128be15c4922
7
+ data.tar.gz: 3e224dbdf536ac4f8207a217cb216151ce5609c3be8e984971470267cce69b7c1ab85fa3f6c88f95467fcc553d7f6f790ef5ba54563647203b114d4221a8800c
@@ -13,7 +13,7 @@ jobs:
13
13
  runs-on: ubuntu-latest
14
14
  strategy:
15
15
  matrix:
16
- ruby_version: [2.7.2, 3.0.0]
16
+ ruby_version: [2.7.2, 3.0.0, 3.2.0]
17
17
  continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
18
18
  # Has to be top level to cache properly
19
19
  env:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.0
4
+
5
+ - Remove Active Support as a dependency
6
+ - This now provides rudimentary support of `html_safe` mechanics. Note that
7
+ it does NOT handle _any_ additional String methods. It simply allows cloning a string via `html_safe` to mark it safe, and `html_safe?` to query if it's safe.
8
+ - This _might_ be a breaking change, but likely not if you're using Serbea along with Rails or Bridgetown. To restore previous functionality manually, just install the `activesupport` gem and `require "active_support/core_ext/string/output_safety"` before you require the Serbea gem.
9
+
3
10
  ## 2.0.0
4
11
 
5
12
  - Add plain ol' Ruby pipeline functionality
@@ -1,4 +1,15 @@
1
- require "active_support/core_ext/string/output_safety"
1
+ unless "".respond_to?(:html_safe)
2
+ # The simplest HTML safety "polyfill" around
3
+ class String
4
+ def html_safe
5
+ self.class.new(self).tap { _1.instance_variable_set(:@html_safe, true) }
6
+ end
7
+
8
+ def html_safe?
9
+ instance_variable_get(:@html_safe) == true
10
+ end
11
+ end
12
+ end
2
13
 
3
14
  module Serbea
4
15
  module Helpers
@@ -10,7 +21,7 @@ module Serbea
10
21
  previous_buffer_state = @_erbout
11
22
  @_erbout = Serbea::OutputBuffer.new
12
23
  result = yield(*args)
13
- result = @_erbout.presence || result
24
+ result = @_erbout.empty? ? result : @_erbout
14
25
  @_erbout = previous_buffer_state
15
26
 
16
27
  Serbea::OutputBuffer === result ? result.html_safe : result
@@ -36,7 +47,7 @@ module Serbea
36
47
  end
37
48
 
38
49
  def h(input)
39
- ERB::Util.h(input.to_s)
50
+ Erubi.h(input.to_s)
40
51
  end
41
52
  alias_method :escape, :h
42
53
 
@@ -1,6 +1,4 @@
1
1
  require "set"
2
- require "active_support/core_ext/string/output_safety"
3
- require "active_support/core_ext/object/blank"
4
2
 
5
3
  module Serbea
6
4
  class Pipeline
@@ -36,7 +34,7 @@ module Serbea
36
34
  full_template = "{{ #{template} | assign_to: :output }}"
37
35
 
38
36
  tmpl = Tilt::SerbeaTemplate.new { full_template }
39
- tmpl.render(pipeline_obj, locals.presence || kwargs)
37
+ tmpl.render(pipeline_obj, locals.empty? ? kwargs : locals)
40
38
 
41
39
  pipeline_obj.output
42
40
  end
@@ -49,7 +47,7 @@ module Serbea
49
47
  # @return [Proc]
50
48
  def self.output_processor
51
49
  @output_processor ||= lambda do |input|
52
- (!input.html_safe? && self.autoescape) ? ERB::Util.h(input) : input.html_safe
50
+ (!input.html_safe? && self.autoescape) ? Erubi.h(input) : input.html_safe
53
51
  end
54
52
  end
55
53
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Serbea
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
  end
data/serbea.gemspec CHANGED
@@ -16,7 +16,6 @@ Gem::Specification.new do |spec|
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|spec|features|docs|serbea-rails)/!) }
17
17
  spec.require_paths = ["lib"]
18
18
 
19
- spec.add_runtime_dependency("activesupport", ">= 6.0")
20
19
  spec.add_runtime_dependency("erubi", ">= 1.10")
21
20
  spec.add_runtime_dependency("tilt", "~> 2.0")
22
21
 
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serbea
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.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: 2023-09-21 00:00:00.000000000 Z
11
+ date: 2023-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: activesupport
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '6.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '6.0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: erubi
29
15
  requirement: !ruby/object:Gem::Requirement