opulent 1.7.6 → 1.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/benchmarks/run-benchmarks.rb +1 -1
- data/lib/opulent/compiler/buffer.rb +2 -2
- data/lib/opulent/engine.rb +8 -2
- data/lib/opulent/parser.rb +2 -2
- data/lib/opulent/settings.rb +11 -11
- data/lib/opulent/template.rb +1 -0
- data/lib/opulent/tokens.rb +4 -3
- data/lib/opulent/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6c5d6d50befc28fa099ba8dc76859816d590fc4
|
4
|
+
data.tar.gz: 05e2764b0e1aeb3e7f457769bf4f883805a37e79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48cdc428d01132ce3fb26d0823701a10bd5f3a9aa3816c00774c87a434674eae6627c0c4395b0e5d5617576841cc69e3995f5ffab03d2a8abd8eefb981045162
|
7
|
+
data.tar.gz: 9e977e449021c5dc7c3ab9099b512445ab611f5b26b08c33767215f31dd9af79b99e64fbcafb65be122284cd328bb27de6417e481c8a3c5e9eb1c9ee09ca29ce
|
@@ -332,7 +332,7 @@ module Opulent
|
|
332
332
|
if escape
|
333
333
|
buffer code
|
334
334
|
else
|
335
|
-
buffer_escape code
|
335
|
+
buffer_escape code
|
336
336
|
end
|
337
337
|
when /\A([\\#]?[^#\\]*([#\\][^\\#\{][^#\\]*)*)/
|
338
338
|
string_remaining = $'
|
@@ -340,7 +340,7 @@ module Opulent
|
|
340
340
|
|
341
341
|
# Static text
|
342
342
|
if escape && string_current =~ Utils::ESCAPE_HTML_PATTERN
|
343
|
-
buffer_escape "\
|
343
|
+
buffer_escape "\"#{string_current.gsub '"', '\"'}\""
|
344
344
|
else
|
345
345
|
buffer_freeze string_current
|
346
346
|
end
|
data/lib/opulent/engine.rb
CHANGED
@@ -67,8 +67,14 @@ module Opulent
|
|
67
67
|
end
|
68
68
|
|
69
69
|
# Set input local variables in current scope
|
70
|
-
|
71
|
-
|
70
|
+
if RUBY_VERSION.start_with?('1.9', '2.0')
|
71
|
+
locals.each do |key, value|
|
72
|
+
eval "#{key} = #{value.inspect}", scope
|
73
|
+
end
|
74
|
+
else
|
75
|
+
locals.each do |key, value|
|
76
|
+
scope.local_variable_set key, value
|
77
|
+
end
|
72
78
|
end
|
73
79
|
|
74
80
|
# Evaluate the template in the given scope (context)
|
data/lib/opulent/parser.rb
CHANGED
@@ -55,7 +55,7 @@ module Opulent
|
|
55
55
|
#
|
56
56
|
def parse(code)
|
57
57
|
# Split the code into lines and parse them one by one
|
58
|
-
@code = code.lines
|
58
|
+
@code = code.lines.to_a
|
59
59
|
|
60
60
|
# Current line index
|
61
61
|
@i = -1
|
@@ -110,7 +110,7 @@ module Opulent
|
|
110
110
|
end
|
111
111
|
|
112
112
|
# Apply definitions to each case of the control node
|
113
|
-
if
|
113
|
+
if [:if, :unless, :case].include? node[@type]
|
114
114
|
node[@children].each do |array|
|
115
115
|
process_definitions[array]
|
116
116
|
end
|
data/lib/opulent/settings.rb
CHANGED
@@ -6,7 +6,7 @@ module Opulent
|
|
6
6
|
BUFFER = :@_opulent_buffer
|
7
7
|
|
8
8
|
# Default Opulent file extension
|
9
|
-
FILE_EXTENSION = '.op'
|
9
|
+
FILE_EXTENSION = '.op'.freeze
|
10
10
|
|
11
11
|
# Default yield target which is used for child block replacements
|
12
12
|
DEFAULT_EACH_KEY = :key
|
@@ -15,19 +15,20 @@ module Opulent
|
|
15
15
|
DEFAULT_EACH_VALUE = :value
|
16
16
|
|
17
17
|
# List of self enclosing node elements
|
18
|
-
SELF_ENCLOSING =
|
19
|
-
img link input meta br hr area base col command
|
20
|
-
track wbr
|
21
|
-
|
18
|
+
SELF_ENCLOSING = [
|
19
|
+
:img, :link, :input, :meta, :br, :hr, :area, :base, :col, :command,
|
20
|
+
:embed, :keygen, :param, :source, :track, :wbr
|
21
|
+
].freeze
|
22
22
|
|
23
23
|
# List of inline node parents which can be either inline or have complex
|
24
24
|
# structures inside of them, such as anchor tags
|
25
|
-
MULTI_NODE =
|
25
|
+
MULTI_NODE = [:a].freeze
|
26
26
|
|
27
27
|
# List of inline node names
|
28
|
-
INLINE_NODE =
|
29
|
-
text a span strong em br i b small label sub sup
|
30
|
-
|
28
|
+
INLINE_NODE = [
|
29
|
+
:text, :a, :span, :strong, :em, :br, :i, :b, :small, :label, :sub, :sup,
|
30
|
+
:abbr, :var, :code, :kbd
|
31
|
+
].freeze
|
31
32
|
|
32
33
|
# Check whether text should or shouldn't be evaluated
|
33
34
|
INTERPOLATION_CHECK = /(?<!\\)\#\{.*\}/
|
@@ -46,11 +47,10 @@ module Opulent
|
|
46
47
|
:'.' => :class,
|
47
48
|
:'#' => :id,
|
48
49
|
:'&' => :name
|
49
|
-
}
|
50
|
+
}.freeze
|
50
51
|
|
51
52
|
# Opulent runtime settings
|
52
53
|
DEFAULTS = {
|
53
|
-
# dependency_manager: true, # Soon to be implemented
|
54
54
|
indent: 2,
|
55
55
|
layouts: false,
|
56
56
|
pretty: false,
|
data/lib/opulent/template.rb
CHANGED
data/lib/opulent/tokens.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# @Opulent
|
2
2
|
module Opulent
|
3
3
|
# Opulent KEYWORDS
|
4
|
-
KEYWORDS =
|
5
|
-
def yield include if else elsif unless case when each
|
6
|
-
|
4
|
+
KEYWORDS = [
|
5
|
+
:def, :yield, :include, :if, :else, :elsif, :unless, :case, :when, :each,
|
6
|
+
:while, :until, :doctype
|
7
|
+
].freeze
|
7
8
|
|
8
9
|
# @Tokens
|
9
10
|
class Tokens
|
data/lib/opulent/version.rb
CHANGED