fix template parse logic

This commit is contained in:
ensan-hcl
2023-08-16 18:38:50 +09:00
parent 30590fa91e
commit 2a240df7c3
6 changed files with 108 additions and 10 deletions

View File

@@ -83,6 +83,8 @@ public extension StringProtocol {
self.index(self.startIndex, offsetBy: offset)
}
// FIXME: Migration
// :
/*
\ -> \\
@@ -93,7 +95,7 @@ public extension StringProtocol {
" -> \d
*/
// please use these letters in order to avoid user-inputting text crash
func escaped() -> String {
func templateDataSpecificEscaped() -> String {
var result = self.replacingOccurrences(of: "\\", with: "\\b")
result = result.replacingOccurrences(of: "\0", with: "\\0")
result = result.replacingOccurrences(of: "\n", with: "\\n")
@@ -104,7 +106,7 @@ public extension StringProtocol {
return result
}
func unescaped() -> String {
func templateDataSpecificUnescaped() -> String {
var result = self.replacingOccurrences(of: "\\d", with: "\"")
result = result.replacingOccurrences(of: "\\s", with: " ")
result = result.replacingOccurrences(of: "\\c", with: ",")