diff --git a/Package@swift-6.0.swift b/Package@swift-6.0.swift deleted file mode 100644 index 081975c..0000000 --- a/Package@swift-6.0.swift +++ /dev/null @@ -1,29 +0,0 @@ -// swift-tools-version: 6.0 -// The swift-tools-version declares the minimum version of Swift required to build this package. - -import PackageDescription - -let package = Package( - name: "Jinja", - platforms: [.iOS(.v16), .macOS(.v13)], - products: [ - // Products define the executables and libraries a package produces, making them visible to other packages. - .library( - name: "Jinja", - targets: ["Jinja"] - ) - ], - targets: [ - // Targets are the basic building blocks of a package, defining a module or a test suite. - // Targets can depend on other targets in this package and products from dependencies. - .target( - name: "Jinja", - path: "Sources" - ), - .testTarget( - name: "JinjaTests", - dependencies: ["Jinja"], - path: "Tests" - ) - ] -) diff --git a/Sources/Lexer.swift b/Sources/Lexer.swift index c96373a..35df5c7 100644 --- a/Sources/Lexer.swift +++ b/Sources/Lexer.swift @@ -141,23 +141,23 @@ func preprocess(template: String, options: PreprocessOptions = PreprocessOptions template.removeLast() } - template = template.replacing(/{#.*?#}/, with: "{##}") + template = template.replacing(#/{#.*?#}/#, with: "{##}") if options.lstripBlocks == true { - template = template.replacing(/(?m)^[ \t]*({[#%])/, with: { $0.output.1 }) + template = template.replacing(#/(?m)^[ \t]*({[#%])/#, with: { $0.output.1 }) } if options.trimBlocks == true { - template = template.replacing(/([#%]})\n/, with: { $0.output.1 }) + template = template.replacing(#/([#%]})\n/#, with: { $0.output.1 }) } return template - .replacing(/{##}/, with: "") - .replacing(/-%}\s*/, with: "%}") - .replacing(/\s*{%-/, with: "{%") - .replacing(/-}}\s*/, with: "}}") - .replacing(/\s*{{-/, with: "{{") + .replacing(#/{##}/#, with: "") + .replacing(#/-%}\s*/#, with: "%}") + .replacing(#/\s*{%-/#, with: "{%") + .replacing(#/-}}\s*/#, with: "}}") + .replacing(#/\s*{{-/#, with: "{{") } func tokenize(_ source: String, options: PreprocessOptions = PreprocessOptions()) throws -> [Token] {