serbea 0.1.2 → 0.1.3
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/lib/serbea.rb +11 -1
- data/lib/serbea/rails_support.rb +6 -2
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aecb61cdb61e1b9fce6cc6784ba1e020aaac8e36539033b85f7a7857e17527a7
|
4
|
+
data.tar.gz: 1baf5cb65378c902583f0e527a26299817c2cff7ee904e3941143faa1eb0ca19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d376bf5d53c9cd3582e339fa652d0f09a6eb803be65226273a8855adac59bf22e5d3ef5dd1d22a6d1185ce3c0a79d331165a364c2fcb3fb0e6180927e05a807
|
7
|
+
data.tar.gz: a75ddb6a3dcf214760d9ca417b60be208a5f85259debd55a4c683a926a497e3a3a6529200e547108861481487ed9a55549dfacde0eefb76dc5813e2a53932ca0
|
data/lib/serbea.rb
CHANGED
@@ -29,6 +29,16 @@ end
|
|
29
29
|
|
30
30
|
module Serbea
|
31
31
|
class Pipeline
|
32
|
+
def self.output_processor=(processor)
|
33
|
+
@output_processor = processor
|
34
|
+
end
|
35
|
+
def self.output_processor
|
36
|
+
@output_processor ||= lambda do |input|
|
37
|
+
# no-op
|
38
|
+
input
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
32
42
|
def initialize(context, value)
|
33
43
|
@context = context
|
34
44
|
@value = value
|
@@ -49,7 +59,7 @@ module Serbea
|
|
49
59
|
end
|
50
60
|
|
51
61
|
def to_s
|
52
|
-
@value.to_s
|
62
|
+
self.class.output_processor.call @value.to_s
|
53
63
|
end
|
54
64
|
|
55
65
|
def raise_on_missing_filters; false; end
|
data/lib/serbea/rails_support.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
3
|
+
# inspired by https://github.com/haml/haml/blob/main/lib/haml/plugin.rb
|
4
4
|
module Serbea
|
5
5
|
|
6
6
|
# This module makes Serbea work with Rails using the template handler API.
|
@@ -25,4 +25,8 @@ module Serbea
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
ActionView::Template.register_template_handler(:serb, Serbea::Plugin)
|
28
|
+
ActionView::Template.register_template_handler(:serb, Serbea::Plugin)
|
29
|
+
|
30
|
+
Serbea::Pipeline.output_processor = lambda do |input|
|
31
|
+
input.html_safe? ? input : ActionController::Base.helpers.strip_tags(input)
|
32
|
+
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serbea
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bridgetown Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: erubi
|