serbea 0.1.2 → 0.1.3

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: c4839efc17aef1ac9f742179335e692cdb592555453b06230309e0411b21d2d6
4
- data.tar.gz: 147247721c682b47baf20c74864f488e877ae7ab1b1625c7c5866f3e9111008a
3
+ metadata.gz: aecb61cdb61e1b9fce6cc6784ba1e020aaac8e36539033b85f7a7857e17527a7
4
+ data.tar.gz: 1baf5cb65378c902583f0e527a26299817c2cff7ee904e3941143faa1eb0ca19
5
5
  SHA512:
6
- metadata.gz: 2f816f6c1551f0173fd101d945d7e6d9ee1b3f7f928df5d3ada210ce00c721d61c43fb891ac9600f68e33cab219d55e81cd686df2ea52038db4b9268139db9da
7
- data.tar.gz: 621c7813892d0ee0b0837f9cbb60eb0dd85c397992389f929070b25aa79b475bfe8c476ce3a13a430773228447093d8f34e7bf4814ce11757201a6cd20adc1b2
6
+ metadata.gz: 1d376bf5d53c9cd3582e339fa652d0f09a6eb803be65226273a8855adac59bf22e5d3ef5dd1d22a6d1185ce3c0a79d331165a364c2fcb3fb0e6180927e05a807
7
+ data.tar.gz: a75ddb6a3dcf214760d9ca417b60be208a5f85259debd55a4c683a926a497e3a3a6529200e547108861481487ed9a55549dfacde0eefb76dc5813e2a53932ca0
@@ -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
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # copied from https://github.com/haml/haml/blob/main/lib/haml/plugin.rb
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
@@ -1,3 +1,3 @@
1
1
  module Serbea
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
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-14 00:00:00.000000000 Z
11
+ date: 2020-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubi