feat: allow using new lines inside tags (#202)

This commit is contained in:
Ilya Puchka
2018-03-13 09:07:56 +00:00
committed by Kyle Fuller
parent fa68ba9df8
commit 0bc6bd974e
4 changed files with 31 additions and 3 deletions

View File

@@ -10,7 +10,12 @@ struct Lexer {
guard string.characters.count > 4 else { return "" }
let start = string.index(string.startIndex, offsetBy: 2)
let end = string.index(string.endIndex, offsetBy: -2)
return String(string[start..<end]).trim(character: " ")
let trimmed = String(string[start..<end])
.components(separatedBy: "\n")
.filter({ !$0.isEmpty })
.map({ $0.trim(character: " ") })
.joined(separator: " ")
return trimmed
}
if string.hasPrefix("{{") {