Skip to content

Commit 749611f

Browse files
authored
Fix the incorrect tag for the variable element (#164)
* Fix the incorrect tag
1 parent e0a2c3e commit 749611f

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

Sources/HTMLKit/Abstraction/Elements/BodyElements.swift

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10961,19 +10961,31 @@ extension Code: GlobalAttributes, GlobalEventAttributes, GlobalAriaAttributes {
1096110961
}
1096210962
}
1096310963

10964-
/// The element indicates a variable name.
10964+
/// The element represents a variable.
1096510965
///
10966-
/// ```html
10967-
/// <v></v>
10966+
/// Use `Variable` to denote a value that can change or vary, typically in mathematical expressions
10967+
/// or programming contexts.
10968+
///
10969+
/// ```swift
10970+
/// Paragraph {
10971+
/// "Lorem ipsum..."
10972+
/// Variable {
10973+
/// "x"
10974+
/// }
10975+
/// "Lorem ipsum..."
10976+
/// }
1096810977
/// ```
1096910978
public struct Variable: ContentNode, HtmlElement, BodyElement, FormElement, FigureElement, ObjectElement {
1097010979

10971-
internal var name: String { "v" }
10980+
internal var name: String { "var" }
1097210981

1097310982
internal var attributes: OrderedDictionary<String, Any>?
1097410983

1097510984
internal var content: [Content]
1097610985

10986+
/// Create a variable
10987+
///
10988+
/// - Parameter content: The variable's content.
1097710989
public init(@ContentBuilder<Content> content: () -> [Content]) {
1097810990
self.content = content()
1097910991
}

Tests/HTMLKitTests/ElementTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,8 @@ final class ElementTests: XCTestCase {
767767

768768
XCTAssertEqual(try renderer.render(view: view),
769769
"""
770-
<v></v>\
771-
<v></v>
770+
<var></var>\
771+
<var></var>
772772
"""
773773
)
774774
}

0 commit comments

Comments
 (0)