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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73996980f3fc5dad7372d79b970912fafc75ae4da2663838f6af696c57be29aa
4
- data.tar.gz: d5eabe6bc2a70b461870e085ebfb9d628941e862e09b8e567b50e5dd4798f334
3
+ metadata.gz: 1d16e1fa13dfcc4f2b10dc287e5d4c150130c0760a8be00cf323287849132f49
4
+ data.tar.gz: 60ab217fb343de0d7af90cf4dc18592dc867f6bbad8ce31349901dc64e677390
5
5
  SHA512:
6
- metadata.gz: d281941782dbf85eae47f60d8918bd293ffd4e9f760e8725d0e3249faf638ddd42bc5652cfe9d1d3ccc7be0619a54fe9184a5f04a8ecfef186a17c43760ce6f4
7
- data.tar.gz: 8c652f07cafdd6026b81508442f6cee1d1bc8b9f87c946b53f90370b15f9da39017aeaeed27114d0c704e456010cce0a8ace18d3fd173ee6ed6b4755d1ead8d6
6
+ metadata.gz: ed744553b4a670b1de4a617a8d34d2ecd4fac83135795994f601b4873f9ef46763e2ec09d814881c4005a5f070ed530f35e4334998e0e3445a62d5025030a665
7
+ data.tar.gz: 3d875dc56647f48098b1ba129a05c5fa56a7be4294de207199fb5e7ca5ab41d19ce511585e4b0533a74b000e6671fb6e3a0dd54d7779e9e5ee27ae0003df0d0d
data/Gemfile CHANGED
@@ -4,3 +4,5 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in serbea.gemspec
6
6
  gemspec
7
+
8
+ gem "erubi", github: "jaredcwhite/erubi", branch: "config-literal-prefix"
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.libs << "test"
6
- t.libs << "lib"
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
@@ -9,7 +9,13 @@ require "serbea/component_renderer"
9
9
  module Tilt
10
10
  class SerbeaTemplate < ErubiTemplate
11
11
  def prepare
12
- @options.merge!(outvar: "@_erbout", bufval: "Serbea::Buffer.new", engine_class: Serbea::TemplateEngine)
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
 
@@ -29,9 +29,27 @@ module Serbea
29
29
  Pipeline.new(context, value)
30
30
  end
31
31
 
32
- def helper(name, &block)
33
- self.class.send(:define_method, name, &block)
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
 
@@ -1,3 +1,3 @@
1
1
  module Serbea
2
- VERSION = "0.6.3"
2
+ VERSION = "0.6.4"
3
3
  end
@@ -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.3
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-29 00:00:00.000000000 Z
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