Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions Sources/HTMLKit/Abstraction/Elements/BodyElements.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10961,19 +10961,31 @@ extension Code: GlobalAttributes, GlobalEventAttributes, GlobalAriaAttributes {
}
}

/// The element indicates a variable name.
/// The element represents a variable.
///
/// ```html
/// <v></v>
/// Use `Variable` to denote a value that can change or vary, typically in mathematical expressions
/// or programming contexts.
///
/// ```swift
/// Paragraph {
/// "Lorem ipsum..."
/// Variable {
/// "x"
/// }
/// "Lorem ipsum..."
/// }
/// ```
public struct Variable: ContentNode, HtmlElement, BodyElement, FormElement, FigureElement, ObjectElement {

internal var name: String { "v" }
internal var name: String { "var" }

internal var attributes: OrderedDictionary<String, Any>?

internal var content: [Content]

/// Create a variable
///
/// - Parameter content: The variable's content.
public init(@ContentBuilder<Content> content: () -> [Content]) {
self.content = content()
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/HTMLKitTests/ElementTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,8 @@ final class ElementTests: XCTestCase {

XCTAssertEqual(try renderer.render(view: view),
"""
<v></v>\
<v></v>
<var></var>\
<var></var>
"""
)
}
Expand Down
Loading