Implement Recursive Transforms (#37)

* Implement Recursive Transforms

* Correct test names

* apply suggestions

* format

* add comments

* move the parse function

* refine `parseTransforms()` function

* refinements

* format

* Swift Format again

---------

Co-authored-by: Adam Fowler <adamfowler71@gmail.com>
This commit is contained in:
Mahdi Bahrami
2024-07-14 15:19:16 +03:30
committed by GitHub
parent a66a7d139c
commit 58b9c3b00c
6 changed files with 203 additions and 51 deletions

View File

@@ -34,10 +34,10 @@ public struct MustacheTemplate: Sendable {
enum Token: Sendable {
case text(String)
case variable(name: String, transform: String? = nil)
case unescapedVariable(name: String, transform: String? = nil)
case section(name: String, transform: String? = nil, template: MustacheTemplate)
case invertedSection(name: String, transform: String? = nil, template: MustacheTemplate)
case variable(name: String, transforms: [String] = [])
case unescapedVariable(name: String, transforms: [String] = [])
case section(name: String, transforms: [String] = [], template: MustacheTemplate)
case invertedSection(name: String, transforms: [String] = [], template: MustacheTemplate)
case inheritedSection(name: String, template: MustacheTemplate)
case partial(String, indentation: String?, inherits: [String: MustacheTemplate]?)
case contentType(MustacheContentType)