evc_rails 0.1.4 → 0.2.0
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 +4 -4
- data/README.md +34 -7
- data/lib/evc_rails/template_handler.rb +11 -2
- data/lib/evc_rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1595c9c520d1639384e46e39fce8f611edbe3b27707a9f99ab412bb25a1741f0
|
4
|
+
data.tar.gz: 23ec6c266ec28a617b0d39d255f33fd5cff58c3db6461dd4382237b8d1989ef2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78e5db590a2dd0b84df663fc836b51c24156bf6f5af40d278f8a5a9ec2cd89aa9ddf1fc83a957613ecc980ebfd54e2fa4d84c33e48f910d2c48514d0869789b7
|
7
|
+
data.tar.gz: c2765e0f368bce11454d9bf95461739a62ef0b89a1d1940c6e069f305499a20e4aeba6dabb4bd017ebc4f1bbefbd60294e0f8ecf53c24e377662a04d16e21cce
|
data/README.md
CHANGED
@@ -166,12 +166,12 @@ end
|
|
166
166
|
|
167
167
|
```erb
|
168
168
|
<Card>
|
169
|
-
<
|
169
|
+
<WithHeader>
|
170
170
|
<h1>Welcome</h1>
|
171
|
-
</
|
172
|
-
<
|
171
|
+
</WithHeader>
|
172
|
+
<WithBody>
|
173
173
|
<p>This is the body content.</p>
|
174
|
-
</
|
174
|
+
</WithBody>
|
175
175
|
</Card>
|
176
176
|
```
|
177
177
|
|
@@ -199,9 +199,9 @@ end
|
|
199
199
|
|
200
200
|
```erb
|
201
201
|
<List>
|
202
|
-
<
|
203
|
-
<
|
204
|
-
<
|
202
|
+
<WithItem>Item 1</WithItem>
|
203
|
+
<WithItem>Item 2</WithItem>
|
204
|
+
<WithItem>Item 3</WithItem>
|
205
205
|
</List>
|
206
206
|
```
|
207
207
|
|
@@ -215,6 +215,33 @@ Becomes:
|
|
215
215
|
<% end %>
|
216
216
|
```
|
217
217
|
|
218
|
+
#### Complex Slot Examples
|
219
|
+
|
220
|
+
```erb
|
221
|
+
<Navigation>
|
222
|
+
<WithLink href={learning_path} text="Learning Path" />
|
223
|
+
<WithLink href={courses_path} text="All Courses" />
|
224
|
+
<WithLink text="Reports">
|
225
|
+
<WithSublink href={reports_users_path} text="Users" />
|
226
|
+
<WithSublink href={reports_activity_path} text="Activity" />
|
227
|
+
</WithLink>
|
228
|
+
<WithFooter>
|
229
|
+
<div>Footer content</div>
|
230
|
+
</WithFooter>
|
231
|
+
</Navigation>
|
232
|
+
```
|
233
|
+
|
234
|
+
#### Backward Compatibility
|
235
|
+
|
236
|
+
The old `Component::slotname` syntax is still supported for backward compatibility:
|
237
|
+
|
238
|
+
```erb
|
239
|
+
<Card>
|
240
|
+
<Card::header>Title</Card::header>
|
241
|
+
<Card::body>Content</Card::body>
|
242
|
+
</Card>
|
243
|
+
```
|
244
|
+
|
218
245
|
### Complex Nesting
|
219
246
|
|
220
247
|
```erb
|
@@ -109,14 +109,23 @@ module EvcRails
|
|
109
109
|
# Add content before the tag
|
110
110
|
result << source[pos...match.begin(0)] if pos < match.begin(0)
|
111
111
|
|
112
|
-
# Determine if this is a slot (e.g., Card::Header inside Card)
|
112
|
+
# Determine if this is a slot (e.g., WithHeader, WithPost, or Card::Header inside Card)
|
113
113
|
parent = stack.last
|
114
114
|
is_slot = false
|
115
115
|
slot_name = nil
|
116
116
|
slot_parent = nil
|
117
117
|
if parent
|
118
118
|
parent_tag = parent[0]
|
119
|
-
|
119
|
+
|
120
|
+
# Check for WithSlotName syntax (e.g., WithHeader, WithPost)
|
121
|
+
if tag_name.start_with?("With")
|
122
|
+
is_slot = true
|
123
|
+
slot_name = tag_name[4..-1].downcase # Remove "With" prefix and convert to lowercase
|
124
|
+
slot_parent = parent_tag
|
125
|
+
# Mark parent as having a slot
|
126
|
+
parent[6] = true
|
127
|
+
# Check for Component::slotname syntax (backward compatibility)
|
128
|
+
elsif tag_name.start_with?("#{parent_tag}::")
|
120
129
|
is_slot = true
|
121
130
|
slot_name = tag_name.split("::").last.downcase
|
122
131
|
slot_parent = parent_tag
|
data/lib/evc_rails/version.rb
CHANGED