File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,15 @@ package indirect enum HTMLElementValueType {
2020 case array( of: HTMLElementValueType )
2121
2222 package static func parse_element( context: some MacroExpansionContext , _ function: FunctionCallExprSyntax ) -> HTMLElement ? {
23- guard let key: String = function. calledExpression. declRef? . baseName. text else { return nil }
23+ let called_expression : ExprSyntax = function. calledExpression
24+ let key : String
25+ if let member: MemberAccessExprSyntax = called_expression. memberAccess, member. base? . declRef? . baseName. text == " HTMLKit " {
26+ key = member. declName. baseName. text
27+ } else if let ref = called_expression. declRef {
28+ key = ref. baseName. text
29+ } else {
30+ return nil
31+ }
2432 let children : SyntaxChildren = function. arguments. children ( viewMode: . all)
2533 switch key {
2634 case " a " : return a ( context: context, children)
Original file line number Diff line number Diff line change @@ -56,6 +56,12 @@ extension ElementTests {
5656 #expect( string == " <!DOCTYPE html><html xmlns= \" test \" ></html> " )
5757 }
5858
59+ // MARK: HTMLKit.element
60+ @Test func with_library_decl( ) {
61+ let string : StaticString = #html( html ( HTMLKit . body ( ) ) )
62+ #expect( string == " <!DOCTYPE html><html><body></body></html> " )
63+ }
64+
5965 // MARK: a
6066 // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
6167 @Test func _a( ) {
You can’t perform that action at this time.
0 commit comments