opulent 1.5.1 → 1.5.2

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
  SHA1:
3
- metadata.gz: e9300eb265cbd78d37b3320fa250ef12c91a2d54
4
- data.tar.gz: 924c5d00c448dcf16a099273cac90dac1bfbdfdb
3
+ metadata.gz: e3de4d4452a9fce9f5c1d1917cea3d219e46315c
4
+ data.tar.gz: ed9f2ce680cdaa2307004f17f25576e10e3fc634
5
5
  SHA512:
6
- metadata.gz: 6d94c1b6835f811ad431a1eba7c3b2c5913d2c68ed900915343c1608227386f70d90fc92dbca90e2a72ca98bdf5da4057780a08342f82f0ec116a3f41ff03f26
7
- data.tar.gz: efa2e8bfc1e6a552b54cf34ba0e67af139cca11751e505d22706631a38da93810ee4e9503d831453da68730564497813844a6275f18b6d4b6ba24224df4eeb21
6
+ metadata.gz: 7c0c0890404d3a84b89c8d04443d1c89630c6ac7b5d06761b094dadca117595e33c87e16e37e288aef91c2cc54212d329166fad64db13b037ca3c0e6c5217db3
7
+ data.tar.gz: 54fdd8b31913ceb54705f65e97c9bd9f513c80dd9405450f250bc44d6674e12857720311f2df76823eb489519bebb024895b2ceeeb33573981c6b773cde71ecb
@@ -99,7 +99,7 @@ module Opulent
99
99
  text.lines.inject('') do |_, line|
100
100
  indent + line
101
101
  end
102
- end
102
+ end
103
103
 
104
104
  # Give an explicit error report where an unexpected sequence of tokens
105
105
  # appears and give indications on how to solve it
@@ -39,6 +39,10 @@ module Opulent
39
39
  @template = Compiler.new.compile @nodes
40
40
  end
41
41
 
42
+ # Read input as file or string input
43
+ #
44
+ # @param input [Object]
45
+ #
42
46
  def read(input)
43
47
  if input.is_a? Symbol
44
48
  @file = File.expand_path get_eval_file input
@@ -79,8 +83,9 @@ module Opulent
79
83
  scope.local_variable_set key, value
80
84
  end
81
85
 
86
+ # Evaluate the template in the given scope (context)
82
87
  begin
83
- # Evaluate the template in the given scope (context)
88
+ p "HELLO", @template
84
89
  eval @template, scope
85
90
  rescue ::SyntaxError => e
86
91
  raise SyntaxError, e.message
@@ -81,9 +81,9 @@ module Opulent
81
81
  opulent = Opulent.new
82
82
  if @layout
83
83
  output = proc do
84
- opulent.render_file(@layout, @locals) do
84
+ opulent.render_file(@layout, @locals) {
85
85
  opulent.render_file(@input, @locals) {}
86
- end
86
+ }
87
87
  end[]
88
88
  else
89
89
  output = proc do
@@ -64,7 +64,7 @@ module Opulent
64
64
  # nodes and definitions
65
65
  root @root
66
66
 
67
- [@root, @definitions]
67
+ return @root, @definitions
68
68
  end
69
69
 
70
70
  # Check and accept or reject a given token as long as we have tokens
@@ -122,7 +122,7 @@ module Opulent
122
122
  # @param token [RegEx] Token to be checked by the parser
123
123
  #
124
124
  def lookahead_next_line(token)
125
- return unless @code[@i + 1]
125
+ return nil unless @code[@i + 1]
126
126
 
127
127
  # Check if we match the token to the current line.
128
128
  @code[@i + 1].match Tokens[token]
@@ -157,6 +157,7 @@ module Opulent
157
157
  text.lines.inject('') do |_, line|
158
158
  indent + line
159
159
  end
160
+ text
160
161
  end
161
162
 
162
163
  # Give an explicit error report where an unexpected sequence of tokens
@@ -41,7 +41,7 @@ module Opulent
41
41
  # support, custom scopes, proper encoding, and support for template
42
42
  # compilation.
43
43
  #
44
- def precompiled_template(locals = {})
44
+ def precompiled_template(_locals = {})
45
45
  @engine.template
46
46
  end
47
47
  end
@@ -25,7 +25,7 @@ module Opulent
25
25
  trailing_whitespace: /\A(\-\>)/,
26
26
 
27
27
  # Self enclosing node
28
- self_enclosing: %r{\A\/(.*)},
28
+ self_enclosing: /\A\/(.*)/,
29
29
 
30
30
  # Definition
31
31
  def: /\Adef +/,
@@ -50,7 +50,7 @@ module Opulent
50
50
  inline_child: /\A *\> */,
51
51
 
52
52
  # Comments
53
- comment: %r{\A\/},
53
+ comment: /\A\//,
54
54
 
55
55
  # Intepreted filters
56
56
  filter: /\A\:[a-zA-Z]([\-\_]?[a-zA-Z0-9]+)*/,
@@ -1,4 +1,4 @@
1
1
  # @Opulent
2
2
  module Opulent
3
- VERSION = '1.5.1'
3
+ VERSION = '1.5.2'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opulent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Grozav