serbea 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Rakefile +5 -3
- data/lib/serbea.rb +7 -1
- data/lib/serbea/helpers.rb +20 -2
- data/lib/serbea/template_engine.rb +2 -2
- data/lib/version.rb +1 -1
- data/serbea.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d16e1fa13dfcc4f2b10dc287e5d4c150130c0760a8be00cf323287849132f49
|
4
|
+
data.tar.gz: 60ab217fb343de0d7af90cf4dc18592dc867f6bbad8ce31349901dc64e677390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed744553b4a670b1de4a617a8d34d2ecd4fac83135795994f601b4873f9ef46763e2ec09d814881c4005a5f070ed530f35e4334998e0e3445a62d5025030a665
|
7
|
+
data.tar.gz: 3d875dc56647f48098b1ba129a05c5fa56a7be4294de207199fb5e7ca5ab41d19ce511585e4b0533a74b000e6671fb6e3a0dd54d7779e9e5ee27ae0003df0d0d
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rake/testtask"
|
3
|
+
require "bundler"
|
4
|
+
|
5
|
+
Bundler.setup
|
3
6
|
|
4
7
|
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.
|
6
|
-
t.
|
7
|
-
t.test_files = FileList["test/**/test_*.rb"]
|
8
|
+
t.test_files = FileList["test/test.rb"]
|
9
|
+
t.warning = false
|
8
10
|
end
|
9
11
|
|
10
12
|
task :default => :test
|
data/lib/serbea.rb
CHANGED
@@ -9,7 +9,13 @@ require "serbea/component_renderer"
|
|
9
9
|
module Tilt
|
10
10
|
class SerbeaTemplate < ErubiTemplate
|
11
11
|
def prepare
|
12
|
-
@options.merge!(
|
12
|
+
@options.merge!(
|
13
|
+
outvar: "@_erbout",
|
14
|
+
bufval: "Serbea::Buffer.new",
|
15
|
+
literal_prefix: "{%",
|
16
|
+
literal_postfix: "%}",
|
17
|
+
engine_class: Serbea::TemplateEngine
|
18
|
+
)
|
13
19
|
super
|
14
20
|
end
|
15
21
|
|
data/lib/serbea/helpers.rb
CHANGED
@@ -29,9 +29,27 @@ module Serbea
|
|
29
29
|
Pipeline.new(context, value)
|
30
30
|
end
|
31
31
|
|
32
|
-
def helper(name, &
|
33
|
-
self.class.
|
32
|
+
def helper(name, &helper_block)
|
33
|
+
self.class.define_method(name) do |*args, &block|
|
34
|
+
previous_buffer_state = @_erbout
|
35
|
+
@_erbout = Serbea::Buffer.new
|
36
|
+
|
37
|
+
# For compatibility with ActionView, not used by Bridgetown normally
|
38
|
+
previous_ob_state = @output_buffer
|
39
|
+
@output_buffer = Serbea::Buffer.new
|
40
|
+
|
41
|
+
result = helper_block.call(*args, &block)
|
42
|
+
if @output_buffer != ""
|
43
|
+
# use Rails' ActionView buffer if present
|
44
|
+
result = @output_buffer
|
45
|
+
end
|
46
|
+
@_erbout = previous_buffer_state
|
47
|
+
@output_buffer = previous_ob_state
|
48
|
+
|
49
|
+
result.is_a?(String) ? result.html_safe : result
|
50
|
+
end
|
34
51
|
end
|
52
|
+
alias_method :macro, :helper
|
35
53
|
|
36
54
|
def h(input)
|
37
55
|
ERB::Util.h(input.to_s)
|
@@ -127,8 +127,8 @@ module Serbea
|
|
127
127
|
|
128
128
|
buff << text
|
129
129
|
if code.length > 0
|
130
|
-
code.sub!
|
131
|
-
code.sub!
|
130
|
+
code.sub!(/^\{%@/, "")
|
131
|
+
code.sub!(/%}$/, "")
|
132
132
|
unless ["end", ""].include? code.strip
|
133
133
|
original_line_length = code.lines.size
|
134
134
|
|
data/lib/version.rb
CHANGED
data/serbea.gemspec
CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|spec|features)/!) }
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
+
spec.add_runtime_dependency("rake", "~> 13.0")
|
19
20
|
spec.add_runtime_dependency("erubi", "~> 1.9")
|
20
21
|
spec.add_runtime_dependency("activesupport", "~> 6.0")
|
21
22
|
spec.add_runtime_dependency("tilt", "~> 2.0")
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serbea
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
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-10-
|
11
|
+
date: 2020-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '13.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '13.0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: erubi
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|