Skip to content

Commit 6c9c077

Browse files
minor changes
1 parent 21cc187 commit 6c9c077

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

Sources/HTMLAttributes/HTMLAttribute.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public enum HTMLAttribute : HTMLInitializable {
5252

5353
#if canImport(CSS)
5454
case style([CSSStyle]? = nil)
55+
#else
56+
case style(String? = nil)
5557
#endif
5658

5759
case tabindex(Int? = nil)
@@ -108,11 +110,7 @@ public enum HTMLAttribute : HTMLInitializable {
108110
case .popover: return "popover"
109111
case .slot: return "slot"
110112
case .spellcheck: return "spellcheck"
111-
112-
#if canImport(CSS)
113113
case .style: return "style"
114-
#endif
115-
116114
case .tabindex: return "tabindex"
117115
case .title: return "title"
118116
case .translate: return "translate"
@@ -173,6 +171,8 @@ public enum HTMLAttribute : HTMLInitializable {
173171

174172
#if canImport(CSS)
175173
case .style(let value): return value?.compactMap({ $0.htmlValue(encoding: encoding, forMacro: forMacro) }).joined(separator: ";")
174+
#else
175+
case .style(let value): return value
176176
#endif
177177

178178
case .tabindex(let value): return value?.description
@@ -217,7 +217,7 @@ public enum HTMLAttribute : HTMLInitializable {
217217
#if canImport(HTMX)
218218
case .htmx(let v):
219219
switch v {
220-
case .request(_, _, _, _), .headers(_, _): return "'"
220+
case .request, .headers: return "'"
221221
default: return encoding.stringDelimiter(forMacro: forMacro)
222222
}
223223
#endif

Sources/HTMLKitUtilities/HTMLExpansionContext.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@ import SwiftSyntaxMacros
1212

1313
/// Data required to process an HTML expansion.
1414
public struct HTMLExpansionContext {
15+
#if canImport(SwiftSyntax) && canImport(SwiftSyntaxMacros)
1516
public let context:MacroExpansionContext
1617
public let expansion:MacroExpansionExprSyntax
18+
public var arguments:LabeledExprListSyntax
19+
#endif
1720

1821
/// `HTMLEncoding` of this expansion.
1922
public var encoding:HTMLEncoding
2023

2124
/// Associated attribute key responsible for the arguments.
2225
public var key:String
23-
public var arguments:LabeledExprListSyntax
2426

2527
/// Complete file paths used for looking up interpolation (when trying to promote to an equivalent `StaticString`).
2628
public var lookupFiles:Set<String>

Sources/HTMLKitUtilities/HTMLKitUtilities.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ extension String {
6161
}
6262

6363
#if canImport(SwiftSyntax)
64-
// MARK: Misc
64+
// MARK: SwiftSyntax
6565
extension ExprSyntaxProtocol {
6666
package var booleanLiteral : BooleanLiteralExprSyntax? { self.as(BooleanLiteralExprSyntax.self) }
6767
package var stringLiteral : StringLiteralExprSyntax? { self.as(StringLiteralExprSyntax.self) }

0 commit comments

Comments
 (0)