rblade 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/rblade/compiler/statements/compiles_component_helpers.rb +2 -11
- data/lib/rblade/compiler/tokenizes_statements.rb +14 -4
- data/rblade.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e633d7cbf716d70b0f9353e8d29990da0379f30171da143077c303e9557cdab8
|
4
|
+
data.tar.gz: ad29e9a1b4cbb0f493a7fa6dbe6fcb82ec64c822fe1c7351de65ab8d268cd1aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 261023b42b8ad6d163c3ac24fcc5d844a5d85c2915af94f26c40254f7ff3cd03b847e2107c97219f32967c402df09594583856c327ee071d9ac56f992a4fd1e2
|
7
|
+
data.tar.gz: 94e955703c7f041f6fc7e2dd5c40e143cb7779437ded8c4acbb5f7e81c0bc9cf424385093607c11a236560c83c389e201f1d1aa8a3f3e95de8aff3323921adf5
|
data/CHANGELOG.md
CHANGED
@@ -14,11 +14,7 @@ module RBlade
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def compileProps args, tokens
|
17
|
-
|
18
|
-
raise StandardError.new "Props statement: wrong number of arguments (given #{args&.count || 0}, expecting 1)"
|
19
|
-
end
|
20
|
-
|
21
|
-
props = extractProps args[0]
|
17
|
+
props = extractProps args
|
22
18
|
props.map do |key, value|
|
23
19
|
# `_required` is deprecated. Use `required`. To be removed in 2.0.0
|
24
20
|
compiled_code = if value == "_required" || value == "required"
|
@@ -41,13 +37,8 @@ module RBlade
|
|
41
37
|
|
42
38
|
private
|
43
39
|
|
44
|
-
def extractProps
|
45
|
-
if prop_string.start_with?("{") && prop_string.end_with?("}")
|
46
|
-
prop_string = prop_string.delete_prefix("{").delete_suffix("}")
|
47
|
-
end
|
48
|
-
|
40
|
+
def extractProps prop_strings
|
49
41
|
props = {}
|
50
|
-
prop_strings = Tokenizer.extractCommaSeparatedValues prop_string
|
51
42
|
|
52
43
|
prop_strings.each do |prop|
|
53
44
|
prop.strip!
|
@@ -79,7 +79,7 @@ module RBlade
|
|
79
79
|
|
80
80
|
def tokenizeStatement!(segments, i)
|
81
81
|
statement_data = {name: segments[i + 1]}
|
82
|
-
segments.delete_at i + 1
|
82
|
+
statement_name = segments.delete_at i + 1
|
83
83
|
|
84
84
|
# Remove optional whitespace
|
85
85
|
if segments.count > i + 2 && segments[i + 1].match(/^[ \t]*$/) && segments[i + 2][0] == "("
|
@@ -87,7 +87,7 @@ module RBlade
|
|
87
87
|
end
|
88
88
|
|
89
89
|
if segments.count > i + 1 && segments[i + 1][0] == "("
|
90
|
-
arguments = tokenizeArguments! segments, i + 1
|
90
|
+
arguments = tokenizeArguments! statement_name, segments, i + 1
|
91
91
|
|
92
92
|
if !arguments.nil?
|
93
93
|
statement_data[:arguments] = arguments
|
@@ -107,7 +107,7 @@ module RBlade
|
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
-
def tokenizeArguments!(segments, segment_index)
|
110
|
+
def tokenizeArguments!(statement_name, segments, segment_index)
|
111
111
|
success = expandSegmentToEndParenthesis! segments, segment_index
|
112
112
|
|
113
113
|
# If no matching parentheses were found, so we combine the argument string with the next segment
|
@@ -120,7 +120,17 @@ module RBlade
|
|
120
120
|
return nil
|
121
121
|
end
|
122
122
|
|
123
|
-
|
123
|
+
# Remove the parentheses from the argument string
|
124
|
+
argument_string = segments[segment_index][1..-2]
|
125
|
+
|
126
|
+
# Special case for the props statement: remove the wrapping braces if they exist
|
127
|
+
if statement_name == "props"
|
128
|
+
if argument_string.start_with?("{") && argument_string.end_with?("}")
|
129
|
+
argument_string = argument_string[1..-2]
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
arguments = Tokenizer.extractCommaSeparatedValues argument_string
|
124
134
|
segments.delete_at segment_index
|
125
135
|
|
126
136
|
arguments
|
data/rblade.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "rblade"
|
3
|
-
s.version = "1.2.
|
3
|
+
s.version = "1.2.1"
|
4
4
|
s.summary = "A component-first templating engine for Rails"
|
5
5
|
s.description = "RBlade is a simple, yet powerful templating engine for Ruby on Rails, inspired by Laravel Blade."
|
6
6
|
s.authors = ["Simon J"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rblade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon J
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
|
-
rubygems_version: 3.
|
143
|
+
rubygems_version: 3.0.3.1
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: A component-first templating engine for Rails
|