rblade 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1a00aab0f9732f42b21921bda5f23b25ce2581f2b0f898c26c5665f0a51046d
4
- data.tar.gz: 46db536cfc37cb9307c446d8e23ae7bde18ad7d9947d09f83d1db766d42a505d
3
+ metadata.gz: e633d7cbf716d70b0f9353e8d29990da0379f30171da143077c303e9557cdab8
4
+ data.tar.gz: ad29e9a1b4cbb0f493a7fa6dbe6fcb82ec64c822fe1c7351de65ab8d268cd1aa
5
5
  SHA512:
6
- metadata.gz: 79920ad59e36a19996a5bceb55370560b6af5ba6075f4db9494c6844f7b729fc63339f7cb106c76a7fb2be4d410554ac5c69793b09e6a4729a1a30213b1c78cb
7
- data.tar.gz: 0ba0f79cc1b8cae6997c02821ca724f3211f50c8978f4923bfe0692a626e63a5fc09fb4bcb3de3b206dbda47e6c825a95a6c2faa91784e83cd420e5d31ba0a35
6
+ metadata.gz: 261023b42b8ad6d163c3ac24fcc5d844a5d85c2915af94f26c40254f7ff3cd03b847e2107c97219f32967c402df09594583856c327ee071d9ac56f992a4fd1e2
7
+ data.tar.gz: 94e955703c7f041f6fc7e2dd5c40e143cb7779437ded8c4acbb5f7e81c0bc9cf424385093607c11a236560c83c389e201f1d1aa8a3f3e95de8aff3323921adf5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.2.1 [2024-10-31]
2
+ - Fix issue with @props directive when defining multiple properties without braces
3
+
1
4
  ## 1.2.0 [2024-10-22]
2
5
  - Add support for custom directives (#2)
3
6
  - Add support for helper functions that use block content (#14)
@@ -14,11 +14,7 @@ module RBlade
14
14
  end
15
15
 
16
16
  def compileProps args, tokens
17
- if args&.count != 1
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 prop_string
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
- arguments = Tokenizer.extractCommaSeparatedValues segments[segment_index][1..-2]
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.0"
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.0
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-22 00:00:00.000000000 Z
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.5.11
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