serbea 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/serbea.rb +0 -1
- data/lib/serbea/helpers.rb +9 -3
- data/lib/serbea/pipeline.rb +11 -3
- data/lib/serbea/rails_support.rb +0 -12
- data/lib/serbea/template_engine.rb +1 -1
- data/lib/version.rb +1 -1
- data/serbea.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edd4caa76947988e564a917a9457014cfe194d53ec8b0edf1aae5479ea8b9cf4
|
4
|
+
data.tar.gz: e93987c1eb193535cf47fc7dc57b412407d5ad6a832bc8ffd5966bc7bbc5c322
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e59b9abc02d1f2a272bef3adf5239fb385bde5924ad4c3a2bb2f8efe6ec11caab6cf2a4b2901fc9ea59821e119b8ea7fb9dc700a4e22773b535633284da89afe
|
7
|
+
data.tar.gz: 1bddcc5a82fa3cd62ceead72600ec621e6fcad08d2e3a6c58041cca972505917c19f89b2861514599feef93f9449c0eec78b7fbb69de97135fd2aefebcc4bab8
|
data/lib/serbea.rb
CHANGED
data/lib/serbea/helpers.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "active_support/core_ext/string/output_safety"
|
2
|
+
|
1
3
|
module Serbea
|
2
4
|
module Helpers
|
3
5
|
def self.included(mod)
|
@@ -20,7 +22,7 @@ module Serbea
|
|
20
22
|
@_erbout = previous_buffer_state
|
21
23
|
@output_buffer = previous_ob_state
|
22
24
|
|
23
|
-
result.
|
25
|
+
result.html_safe
|
24
26
|
end
|
25
27
|
|
26
28
|
def pipeline(context, value)
|
@@ -32,11 +34,15 @@ module Serbea
|
|
32
34
|
end
|
33
35
|
|
34
36
|
def h(input)
|
35
|
-
|
36
|
-
result.respond_to?(:html_safe) ? result.html_safe : result
|
37
|
+
ERB::Util.h(input.to_s)
|
37
38
|
end
|
38
39
|
alias_method :escape, :h
|
39
40
|
|
41
|
+
def safe(input)
|
42
|
+
input.to_s.html_safe
|
43
|
+
end
|
44
|
+
alias_method :raw, :safe
|
45
|
+
|
40
46
|
def prepend(old_string, new_string)
|
41
47
|
"#{new_string}#{old_string}"
|
42
48
|
end
|
data/lib/serbea/pipeline.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "active_support/core_ext/string/output_safety"
|
2
|
+
|
1
3
|
module Serbea
|
2
4
|
class Pipeline
|
3
5
|
def self.exec(template, input: (no_input_passed = true; nil), include_helpers: nil)
|
@@ -27,11 +29,17 @@ module Serbea
|
|
27
29
|
end
|
28
30
|
def self.output_processor
|
29
31
|
@output_processor ||= lambda do |input|
|
30
|
-
|
31
|
-
input
|
32
|
+
(!input.html_safe? && self.autoescape) ? ERB::Util.h(input) : input.html_safe
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
36
|
+
def self.autoescape=(config_boolean)
|
37
|
+
@autoescape = config_boolean
|
38
|
+
end
|
39
|
+
def self.autoescape
|
40
|
+
@autoescape.nil? ? true : @autoescape
|
41
|
+
end
|
42
|
+
|
35
43
|
def self.raise_on_missing_filters=(config_boolean)
|
36
44
|
@raise_on_missing_filters = config_boolean
|
37
45
|
end
|
@@ -85,7 +93,7 @@ module Serbea
|
|
85
93
|
end
|
86
94
|
|
87
95
|
def to_s
|
88
|
-
self.class.output_processor.call @value.to_s
|
96
|
+
self.class.output_processor.call(@value.is_a?(String) ? @value : @value.to_s)
|
89
97
|
end
|
90
98
|
end
|
91
99
|
end
|
data/lib/serbea/rails_support.rb
CHANGED
@@ -16,19 +16,7 @@ module Serbea
|
|
16
16
|
|
17
17
|
new.compile(template, source)
|
18
18
|
end
|
19
|
-
|
20
|
-
# def cache_fragment(block, name = {}, options = nil)
|
21
|
-
# @view.fragment_for(block, name, options) do
|
22
|
-
# eval("_hamlout.buffer", block.binding)
|
23
|
-
# end
|
24
|
-
# end
|
25
19
|
end
|
26
20
|
end
|
27
21
|
|
28
22
|
ActionView::Template.register_template_handler(:serb, Serbea::Plugin)
|
29
|
-
|
30
|
-
if defined?(ActionController::Base)
|
31
|
-
Serbea::Pipeline.output_processor = lambda do |input|
|
32
|
-
input.html_safe? ? input : ActionController::Base.helpers.strip_tags(input)
|
33
|
-
end
|
34
|
-
end
|
data/lib/version.rb
CHANGED
data/serbea.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serbea
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bridgetown Team
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '6.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '6.0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: tilt
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|