From d499348f66674953b896fed997275abb0d038f68 Mon Sep 17 00:00:00 2001 From: RussBaz Date: Mon, 25 Mar 2024 19:44:56 +0500 Subject: [PATCH] Added an option to drop the value in the r-set tag, defaulting to a flag value --- README.md | 2 +- Resources/Pages/index.html | 1 + Sources/Core/Parser.swift | 2 +- Sources/Core/SwiftOutputBuilder.swift | 2 +- Sources/Example/pages.swift | 15 +++++++++++++-- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0b3a5df..13d5842 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Here is an example of the `Reparse` syntax as used in the bundled `Example` proj If you would like to use it in your own project, firstly, add it to your package dependencies like this: ```swift -.package(url: "https://github.com/RussBaz/experimental-reparse-html.git", from: "0.0.12"), +.package(url: "https://github.com/RussBaz/experimental-reparse-html.git", from: "0.0.13"), ``` Then add the `ReparseRuntime` as a dependency to your target like this: diff --git a/Resources/Pages/index.html b/Resources/Pages/index.html index 30992d3..9405aad 100644 --- a/Resources/Pages/index.html +++ b/Resources/Pages/index.html @@ -39,6 +39,7 @@

console.log('This is drastic?'); console.log('too many');" > + What's up? diff --git a/Sources/Core/Parser.swift b/Sources/Core/Parser.swift index c225df5..153168b 100644 --- a/Sources/Core/Parser.swift +++ b/Sources/Core/Parser.swift @@ -408,7 +408,7 @@ extension Parser { guard tag.isVoid else { ignoringUntilDepth = depth; return } guard let attributes = tag.attributes else { return } guard let name = attributes.find("name") else { return } - guard let attributeValue = attributes["value"] else { return } + let attributeValue = attributes["value"] ?? .flag let appending = if attributes.has("append") { true } else { false } diff --git a/Sources/Core/SwiftOutputBuilder.swift b/Sources/Core/SwiftOutputBuilder.swift index 92f3602..25f4361 100644 --- a/Sources/Core/SwiftOutputBuilder.swift +++ b/Sources/Core/SwiftOutputBuilder.swift @@ -49,7 +49,7 @@ public final class SwiftOutputBuilder { let topLine = """ // // ------------------------------ - // reparse version: 0.0.12 + // reparse version: 0.0.13 // ------------------------------ // This is an auto-generated file // ------------------------------ diff --git a/Sources/Example/pages.swift b/Sources/Example/pages.swift index 0dbf9c0..f24e6a9 100644 --- a/Sources/Example/pages.swift +++ b/Sources/Example/pages.swift @@ -1,6 +1,6 @@ // // ------------------------------ -// reparse version: 0.0.12 +// reparse version: 0.0.13 // ------------------------------ // This is an auto-generated file // ------------------------------ @@ -276,7 +276,18 @@ enum Pages { } lines.append("""

-