Commit 1534aca
committed
feat: Add Set node to support variable assignment during template rendering
Added the `SetNode` class for defining variables in templates, and implemented the corresponding parsing logic in `TemplateReader`. This allows dynamic variable assignment during template rendering, making variables available to subsequent child nodes, thus improving template flexibility and reusability.
Key changes include:
- Created the `SetNode` record type
- Registered the Set node in the node parsing map
- Implemented the `ParseSetNodeAsync` method to parse Set elements
- Modified `ParseChildrenAsync` to handle Set nodes and update the scope
- Added the `EvaluateSetValueAsync` method for evaluating variable values
- Added the `MergeScope` method for merging scope dictionaries1 parent fa80500 commit 1534aca
File tree
3 files changed
+55
-2
lines changed- src/Render
- Nodes
3 files changed
+55
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
104 | 110 | | |
105 | 111 | | |
106 | 112 | | |
| |||
153 | 159 | | |
154 | 160 | | |
155 | 161 | | |
| 162 | + | |
156 | 163 | | |
157 | 164 | | |
158 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
159 | 173 | | |
160 | 174 | | |
161 | 175 | | |
162 | 176 | | |
163 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
164 | 195 | | |
165 | 196 | | |
166 | 197 | | |
167 | 198 | | |
168 | 199 | | |
169 | 200 | | |
170 | | - | |
171 | 201 | | |
172 | 202 | | |
173 | 203 | | |
| |||
191 | 221 | | |
192 | 222 | | |
193 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
194 | 239 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
0 commit comments