Add / as a valid partialNameChar and use it in parse (#71)

* Add / as a valid partialNameChar and use it in parse

* maybe let's not keep "bla" in the tests
This commit is contained in:
Ralph Kühnert
2025-08-30 17:13:26 +02:00
committed by GitHub
parent 28df3156e2
commit 6df64896f4
2 changed files with 4 additions and 4 deletions

View File

@@ -441,7 +441,7 @@ extension MustacheTemplate {
/// parse partial name
static func parsePartialName(_ parser: inout Parser, state: ParserState) throws -> String {
parser.read(while: \.isWhitespace)
let text = String(parser.read(while: self.sectionNameChars))
let text = String(parser.read(while: self.partialNameChars))
parser.read(while: \.isWhitespace)
guard try parser.read(string: state.endDelimiter) else { throw Error.unfinishedName }
return text
@@ -518,5 +518,5 @@ extension MustacheTemplate {
private static let sectionNameCharsWithoutBrackets = Set<Character>("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_?*")
private static let sectionNameChars = Set<Character>("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_?()*")
private static let partialNameChars = Set<Character>("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_()")
private static let partialNameChars = Set<Character>("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_?()*/")
}