diff --git a/Package.swift b/Package.swift index 72f638f3..8ebf8ecc 100644 --- a/Package.swift +++ b/Package.swift @@ -36,7 +36,6 @@ let package = Package( .product(name: "Logging", package: "swift-log"), .product(name: "NIO", package: "swift-nio") ], - exclude: ["Abstraction/README.md", "Framework/README.md"], swiftSettings: [ .enableExperimentalFeature("StrictConcurrency=complete") ] diff --git a/Sources/Commands/Converter/ConvertCommand.swift b/Sources/Commands/Converter/ConvertCommand.swift index 56df854f..32b1d797 100644 --- a/Sources/Commands/Converter/ConvertCommand.swift +++ b/Sources/Commands/Converter/ConvertCommand.swift @@ -42,7 +42,7 @@ internal struct ConvertCommand { exit(0) } else { - print("Unkown target path.") + print("Unknown target path.") exit(1) } diff --git a/Sources/HTMLKit/Abstraction/Attributes/AriaAttributes.swift b/Sources/HTMLKit/Abstraction/Attributes/AccessibilityAttributes.swift similarity index 98% rename from Sources/HTMLKit/Abstraction/Attributes/AriaAttributes.swift rename to Sources/HTMLKit/Abstraction/Attributes/AccessibilityAttributes.swift index 543963ad..227a2f69 100644 --- a/Sources/HTMLKit/Abstraction/Attributes/AriaAttributes.swift +++ b/Sources/HTMLKit/Abstraction/Attributes/AccessibilityAttributes.swift @@ -787,8 +787,9 @@ public protocol LabelAccessibilityAttribute: Attribute { /// } /// .accessibilityLabel("Lorem ipsum") /// ``` - /// - Parameter localizedKey: The localized key to label the element. - /// - Parameter tableName: The translation table to look in. + /// - Parameters: + /// - localizedKey: The localized key to label the element. + /// - tableName: The translation table to look in. /// /// - Returns: The element func accessibilityLabel(_ localizedKey: LocalizedStringKey, tableName: String?) -> Self @@ -1142,8 +1143,9 @@ public protocol HintAccessibilityAttribute: Attribute { /// .role(.textbox) /// .accessibilityHint("Lorem ipsum") /// ``` - /// - Parameter localizedKey: The localized key to give more context. - /// - Parameter tableName: The translation table to look in. + /// - Parameters: + /// - localizedKey: The localized key to give more context. + /// - tableName: The translation table to look in. /// /// - Returns: The element func accessibilityHint(_ localizedKey: LocalizedStringKey, tableName: String?) -> Self @@ -1397,8 +1399,9 @@ public protocol RoleDescriptionAccessibilityAttribute: Attribute { /// .accessibilityRoleDescription("Lorem ipsum...") /// ``` /// - /// - Parameter localizedKey: The text to describe the role. - /// - Parameter tableName: The translation table to look in. + /// - Parameters: + /// - localizedKey: The text to describe the role. + /// - tableName: The translation table to look in. /// /// - Returns: The element func accessibilityRoleDescription(_ localizedKey: LocalizedStringKey, tableName: String?) -> Self @@ -1707,9 +1710,10 @@ public protocol ValueAccessibilityAttribute: Attribute { /// .accessibilityValue(20.0, alternate: "Lorem ipsum...") /// ``` /// - /// - Parameter value: The current value within the range. - /// - Parameter localizedKey:The localized key to describe the value. - /// - Parameter tableName: The translation table to look in. + /// - Parameters: + /// - value: The current value within the range. + /// - localizedKey:The localized key to describe the value. + /// - tableName: The translation table to look in. /// /// - Returns: The element func accessibilityValue(_ value: Float, description localizedKey: LocalizedStringKey, tableName: String?) -> Self diff --git a/Sources/HTMLKit/Abstraction/Attributes/BasicAttributes.swift b/Sources/HTMLKit/Abstraction/Attributes/ContentAttributes.swift similarity index 98% rename from Sources/HTMLKit/Abstraction/Attributes/BasicAttributes.swift rename to Sources/HTMLKit/Abstraction/Attributes/ContentAttributes.swift index de0091fc..b7bb6c79 100644 --- a/Sources/HTMLKit/Abstraction/Attributes/BasicAttributes.swift +++ b/Sources/HTMLKit/Abstraction/Attributes/ContentAttributes.swift @@ -1,9 +1,9 @@ import Foundation import OrderedCollections -/// The alias combines the global attributes of the basic attributes. +/// The alias combines the global attributes of content attributes. @_documentation(visibility: internal) -public typealias GlobalAttributes = AccessKeyAttribute & AutocapitalizeAttribute & AutofocusAttribute & ClassAttribute & EditAttribute & DirectionAttribute & DragAttribute & EnterKeyAttribute & HiddenAttribute & InputModeAttribute & IsAttribute & ItemAttribute & ItemPropertyAttribute & IdentifierAttribute & LanguageAttribute & NonceAttribute & RoleAttribute & SpellCheckAttribute & StyleAttribute & TabulatorAttribute & TitleAttribute & TranslateAttribute & InertAttribute & PopoverAttribute +public typealias GlobalContentAttributes = AccessKeyAttribute & AutocapitalizeAttribute & AutofocusAttribute & ClassAttribute & EditAttribute & DirectionAttribute & DragAttribute & EnterKeyAttribute & HiddenAttribute & InputModeAttribute & IsAttribute & ItemAttribute & ItemPropertyAttribute & IdentifierAttribute & LanguageAttribute & NonceAttribute & RoleAttribute & SpellCheckAttribute & StyleAttribute & TabulatorAttribute & TitleAttribute & TranslateAttribute & InertAttribute & PopoverAttribute /// A type that provides the `accessKey` modifier. @_documentation(visibility: internal) @@ -175,8 +175,9 @@ public protocol AlternateAttribute: Attribute { /// .alternate("Lorem ipsum...") /// ``` /// - /// - Parameter localizedKey: The string key to be translated. - /// - Parameter tableName: The translation table to look in. + /// - Parameters: + /// - localizedKey: The string key to be translated. + /// - tableName: The translation table to look in. /// /// - Returns: The element func alternate(_ localizedKey: LocalizedStringKey, tableName: String?) -> Self @@ -656,8 +657,9 @@ public protocol ContentAttribute: Attribute { /// .content("Lorem ipsum...") /// ``` /// - /// - Parameter localizedKey: The string key to be translated - /// - Parameter tableName: The translation table to look in + /// - Parameters: + /// - localizedKey: The string key to be translated + /// - tableName: The translation table to look in /// /// - Returns: The element func content(_ localizedKey: LocalizedStringKey, tableName: String?) -> Self @@ -1786,8 +1788,9 @@ public protocol LabelAttribute: Attribute { /// .label("lorem") /// ``` /// - /// - Parameter localizedKey: The string key to be translated. - /// - Parameter tableName: The translation table to look in. + /// - Parameters: + /// - localizedKey: The string key to be translated. + /// - tableName: The translation table to look in. /// /// - Returns: The element func label(_ localizedKey: LocalizedStringKey, tableName: String?) -> Self @@ -2518,8 +2521,9 @@ public protocol PlaceholderAttribute: Attribute { /// .placeholder("Lorem ipsum...") /// ``` /// - /// - Parameter localizedKey: The string key to be translated - /// - Parameter tableName: The translation table to look in + /// - Parameters: + /// - localizedKey: The string key to be translated + /// - tableName: The translation table to look in /// /// - Returns: The element func placeholder(_ localizedKey: LocalizedStringKey, tableName: String?) -> Self @@ -3032,8 +3036,9 @@ public protocol ShapeAttribute: Attribute { /// .shape(.rect, coordinates: "0, 0, 200, 100") /// ``` /// - /// - Parameter value: The shape used to interpret the coordinates. - /// - Parameter coordinates: The coordinates on which to base the shape. + /// - Parameters: + /// - value: The shape used to interpret the coordinates. + /// - coordinates: The coordinates on which to base the shape. /// /// - Returns: The element func shape(_ value: Values.Shape, coordinates: String) -> Self @@ -3537,8 +3542,9 @@ public protocol TitleAttribute: Attribute { /// .title("Lorem ipsum") /// ``` /// - /// - Parameter localizedKey: The string key to be translated. - /// - Parameter tableName: The translation table to look in. + /// - Parameters: + /// - localizedKey: The string key to be translated. + /// - tableName: The translation table to look in. /// /// - Returns: The element func title(_ localizedKey: LocalizedStringKey, tableName: String?) -> Self @@ -3697,8 +3703,9 @@ public protocol ValueAttribute: Attribute { /// .value("Lorem ipsum...") /// ``` /// - /// - Parameter localizedKey: The string key to be translated - /// - Parameter tableName: The translation table to look in + /// - Parameters: + /// - localizedKey: The string key to be translated + /// - tableName: The translation table to look in /// /// - Returns: The element func value(_ localizedKey: LocalizedStringKey, tableName: String?) -> Self @@ -4146,8 +4153,9 @@ public protocol PopoverTargetAttribute: Attribute { /// .popoverTarget("id", action: .hide) /// ``` /// - /// - Parameter id: The identifier of the target to bind the popover to. - /// - Parameter action: The action to perform when triggered. + /// - Parameters: + /// - id: The identifier of the target to bind the popover to. + /// - action: The action to perform when triggered. /// /// - Returns: The element func popoverTarget(_ id: String, action: Values.Popover.Action?) -> Self diff --git a/Sources/HTMLKit/Abstraction/Attributes/VectorAttributes.swift b/Sources/HTMLKit/Abstraction/Attributes/VectorAttributes.swift index 3f3dca6c..3acc36d3 100644 --- a/Sources/HTMLKit/Abstraction/Attributes/VectorAttributes.swift +++ b/Sources/HTMLKit/Abstraction/Attributes/VectorAttributes.swift @@ -44,8 +44,9 @@ public protocol FillAttribute: Attribute { /// } /// ``` /// - /// - Parameter color: The color to fill shape with. - /// - Parameter opacity: The opacity to apply. + /// - Parameters: + /// - color: The color to fill shape with. + /// - opacity: The opacity to apply. /// /// - Returns: The element func fill(_ color: String, opacity: Double?) -> Self @@ -76,11 +77,12 @@ public protocol StrokeAttribute: Attribute { /// } /// ``` /// - /// - Parameter color: The color to fill the stroke with. - /// - Parameter width: The thickness to apply to the stroke. - /// - Parameter opacity: The level to apply to the stroke. - /// - Parameter cap: The shape to end the stroke. - /// - Parameter join: The shape when two lines meet. + /// - Parameters: + /// - color: The color to fill the stroke with. + /// - width: The thickness to apply to the stroke. + /// - opacity: The level to apply to the stroke. + /// - cap: The shape to end the stroke. + /// - join: The shape when two lines meet. /// /// - Returns: The element func stroke(_ color: String, width: Int?, opacity: Double?, cap: Values.Linecap?, join: Values.Linejoin?) -> Self diff --git a/Sources/HTMLKit/Abstraction/Elements/BasicElements.swift b/Sources/HTMLKit/Abstraction/Elements/BasicElements.swift index f8eda94d..d3470bf9 100644 --- a/Sources/HTMLKit/Abstraction/Elements/BasicElements.swift +++ b/Sources/HTMLKit/Abstraction/Elements/BasicElements.swift @@ -94,7 +94,7 @@ public struct Html: ContentNode, BasicElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [HtmlElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .trusted, content: [HtmlElement] = []) { self.attributes = attributes self.context = context @@ -133,7 +133,7 @@ public struct Html: ContentNode, BasicElement { } } -extension Html: GlobalAttributes, GlobalEventAttributes { +extension Html: GlobalContentAttributes, GlobalEventAttributes { public func accessKey(_ value: Character) -> Html { return mutate(accesskey: .init("\(value)", context: .trusted)) diff --git a/Sources/HTMLKit/Abstraction/Elements/BodyElements.swift b/Sources/HTMLKit/Abstraction/Elements/BodyElements.swift index 27571461..10104f52 100644 --- a/Sources/HTMLKit/Abstraction/Elements/BodyElements.swift +++ b/Sources/HTMLKit/Abstraction/Elements/BodyElements.swift @@ -87,7 +87,9 @@ public typealias Abbr = Abbreviation /// The alias for the element ``Variable``. @_documentation(visibility: internal) +@available(*, deprecated, message: "Use Var() instead.") public typealias V = Variable +public typealias Var = Variable /// The alias for the element ``SampleOutput``. @_documentation(visibility: internal) @@ -178,7 +180,7 @@ public struct Article: ContentNode, HtmlElement, BodyElement, FormElement, Figur self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -217,7 +219,7 @@ public struct Article: ContentNode, HtmlElement, BodyElement, FormElement, Figur } } -extension Article: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Article: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Article { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -716,7 +718,7 @@ public struct Section: ContentNode, HtmlElement, BodyElement, FigureElement, For self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -755,7 +757,7 @@ public struct Section: ContentNode, HtmlElement, BodyElement, FigureElement, For } } -extension Section: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Section: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Section { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -1256,7 +1258,7 @@ public struct Navigation: ContentNode, HtmlElement, BodyElement, FormElement, Fi self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -1295,7 +1297,7 @@ public struct Navigation: ContentNode, HtmlElement, BodyElement, FormElement, Fi } } -extension Navigation: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Navigation: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Navigation { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -1792,7 +1794,7 @@ public struct Aside: ContentNode, HtmlElement, BodyElement, FormElement, FigureE self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -1831,7 +1833,7 @@ public struct Aside: ContentNode, HtmlElement, BodyElement, FormElement, FigureE } } -extension Aside: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Aside: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Aside { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -2325,7 +2327,7 @@ public struct Heading1: ContentNode, HtmlElement, BodyElement, FormElement, Figu self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -2364,7 +2366,7 @@ public struct Heading1: ContentNode, HtmlElement, BodyElement, FormElement, Figu } } -extension Heading1: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Heading1: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Heading1 { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -2866,7 +2868,7 @@ public struct Heading2: ContentNode, HtmlElement, BodyElement, FormElement, Figu self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -2905,7 +2907,7 @@ public struct Heading2: ContentNode, HtmlElement, BodyElement, FormElement, Figu } } -extension Heading2: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Heading2: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Heading2 { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -3408,7 +3410,7 @@ public struct Heading3: ContentNode, HtmlElement, BodyElement, FormElement, Figu self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -3447,7 +3449,7 @@ public struct Heading3: ContentNode, HtmlElement, BodyElement, FormElement, Figu } } -extension Heading3: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Heading3: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Heading3 { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -3950,7 +3952,7 @@ public struct Heading4: ContentNode, HtmlElement, BodyElement, FormElement, Figu self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -3989,7 +3991,7 @@ public struct Heading4: ContentNode, HtmlElement, BodyElement, FormElement, Figu } } -extension Heading4: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Heading4: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Heading4 { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -4492,7 +4494,7 @@ public struct Heading5: ContentNode, HtmlElement, BodyElement, FormElement, Figu self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -4531,7 +4533,7 @@ public struct Heading5: ContentNode, HtmlElement, BodyElement, FormElement, Figu } } -extension Heading5: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Heading5: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Heading5 { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -5034,7 +5036,7 @@ public struct Heading6: ContentNode, HtmlElement, BodyElement, FormElement, Figu self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -5073,7 +5075,7 @@ public struct Heading6: ContentNode, HtmlElement, BodyElement, FormElement, Figu } } -extension Heading6: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Heading6: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Heading6 { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -5581,7 +5583,7 @@ public struct HeadingGroup: ContentNode, HtmlElement, BodyElement, FormElement, self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -5620,7 +5622,7 @@ public struct HeadingGroup: ContentNode, HtmlElement, BodyElement, FormElement, } } -extension HeadingGroup: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension HeadingGroup: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> HeadingGroup { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -6115,7 +6117,7 @@ public struct Header: ContentNode, HtmlElement, BodyElement, FormElement, Figure self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -6154,7 +6156,7 @@ public struct Header: ContentNode, HtmlElement, BodyElement, FormElement, Figure } } -extension Header: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Header: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Header { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -6647,7 +6649,7 @@ public struct Footer: ContentNode, HtmlElement, BodyElement, FormElement, Figure self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -6686,7 +6688,7 @@ public struct Footer: ContentNode, HtmlElement, BodyElement, FormElement, Figure } } -extension Footer: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Footer: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Footer { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -7186,7 +7188,7 @@ public struct Address: ContentNode, HtmlElement, BodyElement, FormElement, Figur self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -7225,7 +7227,7 @@ public struct Address: ContentNode, HtmlElement, BodyElement, FormElement, Figur } } -extension Address: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Address: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Address { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -7719,7 +7721,7 @@ public struct Paragraph: ContentNode, HtmlElement, BodyElement, FormElement, Fig self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -7758,7 +7760,7 @@ public struct Paragraph: ContentNode, HtmlElement, BodyElement, FormElement, Fig } } -extension Paragraph: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, RequiredAccessibilityAttribute { +extension Paragraph: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, RequiredAccessibilityAttribute { public func accessKey(_ value: Character) -> Paragraph { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -8259,7 +8261,7 @@ public struct HorizontalRule: EmptyNode, HtmlElement, BodyElement, FormElement, /// Create a horizontal rule. public init() {} - internal init(attributes: OrderedDictionary?) { + internal init(attributes: OrderedDictionary? = nil) { self.attributes = attributes } @@ -8295,7 +8297,7 @@ public struct HorizontalRule: EmptyNode, HtmlElement, BodyElement, FormElement, } } -extension HorizontalRule: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension HorizontalRule: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> HorizontalRule { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -8795,7 +8797,7 @@ public struct PreformattedText: ContentNode, HtmlElement, BodyElement, FormEleme self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -8834,7 +8836,7 @@ public struct PreformattedText: ContentNode, HtmlElement, BodyElement, FormEleme } } -extension PreformattedText: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension PreformattedText: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> PreformattedText { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -9328,7 +9330,7 @@ public struct Blockquote: ContentNode, HtmlElement, BodyElement, FormElement, Fi self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -9367,7 +9369,7 @@ public struct Blockquote: ContentNode, HtmlElement, BodyElement, FormElement, Fi } } -extension Blockquote: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, CiteAttribute { +extension Blockquote: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, CiteAttribute { public func accessKey(_ value: Character) -> Blockquote { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -9879,7 +9881,7 @@ public struct OrderedList: ContentNode, HtmlElement, BodyElement, FormElement, F self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [ListElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .trusted, content: [ListElement] = []) { self.attributes = attributes self.context = context @@ -9918,7 +9920,7 @@ public struct OrderedList: ContentNode, HtmlElement, BodyElement, FormElement, F } } -extension OrderedList: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ReversedAttribute, StartAttribute, TypeAttribute, OrientationAccessibilityAttribute { +extension OrderedList: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ReversedAttribute, StartAttribute, TypeAttribute, OrientationAccessibilityAttribute { public func accessKey(_ value: Character) -> OrderedList { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -10432,7 +10434,7 @@ public struct UnorderedList: ContentNode, HtmlElement, BodyElement, FormElement, self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [ListElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .trusted, content: [ListElement] = []) { self.attributes = attributes self.context = context @@ -10471,7 +10473,7 @@ public struct UnorderedList: ContentNode, HtmlElement, BodyElement, FormElement, } } -extension UnorderedList: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, OrientationAccessibilityAttribute, MultiselectAccessibilityAttribute { +extension UnorderedList: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, OrientationAccessibilityAttribute, MultiselectAccessibilityAttribute { public func accessKey(_ value: Character) -> UnorderedList { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -10983,7 +10985,7 @@ public struct Menu: ContentNode, HtmlElement, BodyElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [ListElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .trusted, content: [ListElement] = []) { self.attributes = attributes self.context = context @@ -11022,7 +11024,7 @@ public struct Menu: ContentNode, HtmlElement, BodyElement { } } -extension Menu: GlobalAttributes { +extension Menu: GlobalContentAttributes { public func accessKey(_ value: Character) -> Menu { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -11273,7 +11275,7 @@ public struct DescriptionList: ContentNode, HtmlElement, BodyElement, FormElemen self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [DescriptionElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .trusted, content: [DescriptionElement] = []) { self.attributes = attributes self.context = context @@ -11312,7 +11314,7 @@ public struct DescriptionList: ContentNode, HtmlElement, BodyElement, FormElemen } } -extension DescriptionList: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension DescriptionList: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> DescriptionList { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -11811,7 +11813,7 @@ public struct Figure: ContentNode, HtmlElement, BodyElement, FormElement, Figure self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [FigureElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .trusted, content: [FigureElement] = []) { self.attributes = attributes self.context = context @@ -11850,7 +11852,7 @@ public struct Figure: ContentNode, HtmlElement, BodyElement, FormElement, Figure } } -extension Figure: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Figure: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Figure { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -12346,7 +12348,7 @@ public struct Anchor: ContentNode, HtmlElement, BodyElement, FormElement, Figure self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -12385,7 +12387,7 @@ public struct Anchor: ContentNode, HtmlElement, BodyElement, FormElement, Figure } } -extension Anchor: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, DownloadAttribute, ReferenceAttribute, ReferenceLanguageAttribute, MediaAttribute, PingAttribute, ReferrerPolicyAttribute, RelationshipAttribute, TargetAttribute, TypeAttribute { +extension Anchor: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, DownloadAttribute, ReferenceAttribute, ReferenceLanguageAttribute, MediaAttribute, PingAttribute, ReferrerPolicyAttribute, RelationshipAttribute, TargetAttribute, TypeAttribute { public func accessKey(_ value: Character) -> Anchor { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -12934,7 +12936,7 @@ public struct Emphasize: ContentNode, HtmlElement, BodyElement, FormElement, Fig self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -12973,7 +12975,7 @@ public struct Emphasize: ContentNode, HtmlElement, BodyElement, FormElement, Fig } } -extension Emphasize: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Emphasize: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Emphasize { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -13469,7 +13471,7 @@ public struct Strong: ContentNode, HtmlElement, BodyElement, FormElement, Figure self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -13508,7 +13510,7 @@ public struct Strong: ContentNode, HtmlElement, BodyElement, FormElement, Figure } } -extension Strong: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Strong: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Strong { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -14004,7 +14006,7 @@ public struct Small: ContentNode, HtmlElement, BodyElement, FormElement, FigureE self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -14043,7 +14045,7 @@ public struct Small: ContentNode, HtmlElement, BodyElement, FormElement, FigureE } } -extension Small: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Small: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Small { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -14548,7 +14550,7 @@ public struct StrikeThrough: ContentNode, HtmlElement, BodyElement, FormElement, self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -14587,7 +14589,7 @@ public struct StrikeThrough: ContentNode, HtmlElement, BodyElement, FormElement, } } -extension StrikeThrough: GlobalAttributes, GlobalEventAttributes { +extension StrikeThrough: GlobalContentAttributes, GlobalEventAttributes { public func accessKey(_ value: Character) -> StrikeThrough { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -14870,7 +14872,7 @@ public struct Main: ContentNode, HtmlElement, BodyElement, FormElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -14909,7 +14911,7 @@ public struct Main: ContentNode, HtmlElement, BodyElement, FormElement { } } -extension Main: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Main: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Main { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -15410,7 +15412,7 @@ public struct Search: ContentNode, HtmlElement, BodyElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -15449,7 +15451,7 @@ public struct Search: ContentNode, HtmlElement, BodyElement { } } -extension Search: GlobalAttributes { +extension Search: GlobalContentAttributes { public func accessKey(_ value: Character) -> Search { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -15693,7 +15695,7 @@ public struct Division: ContentNode, HtmlElement, BodyElement, FormElement, Figu self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -15732,7 +15734,7 @@ public struct Division: ContentNode, HtmlElement, BodyElement, FormElement, Figu } } -extension Division: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, OrientationAccessibilityAttribute, RequiredAccessibilityAttribute, ReadOnlyAccessibilityAttribute, ModalAccessibilityAttribute, LevelAccessibilityAttribute, HintAccessibilityAttribute, PositionAccessibilityAttribute, MultilineAccessibilityAttribute, MultiselectAccessibilityAttribute, RowIndexAccessibilityAttribute, RowCountAccessibilityAttribute, ColumnIndexAccessibilityAttribute, ColumnCountAccessibilityAttribute, RowSpanAccessibilityAttribute, ColumnSpanAccessibilityAttribute, MaximumValueAccessibilityAttribute, MinimumValueAccessibilityAttribute, ValueAccessibilityAttribute, PressedAccessibilityAttribute, SelectedAccessibilityAttribute, CheckedAccessibilityAttribute, ExpandedAccessibilityAttribute, FocusedAccessibilityAttribute, CompletionAccessibilityAttribute { +extension Division: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, OrientationAccessibilityAttribute, RequiredAccessibilityAttribute, ReadOnlyAccessibilityAttribute, ModalAccessibilityAttribute, LevelAccessibilityAttribute, HintAccessibilityAttribute, PositionAccessibilityAttribute, MultilineAccessibilityAttribute, MultiselectAccessibilityAttribute, RowIndexAccessibilityAttribute, RowCountAccessibilityAttribute, ColumnIndexAccessibilityAttribute, ColumnCountAccessibilityAttribute, RowSpanAccessibilityAttribute, ColumnSpanAccessibilityAttribute, MaximumValueAccessibilityAttribute, MinimumValueAccessibilityAttribute, ValueAccessibilityAttribute, PressedAccessibilityAttribute, SelectedAccessibilityAttribute, CheckedAccessibilityAttribute, ExpandedAccessibilityAttribute, FocusedAccessibilityAttribute, CompletionAccessibilityAttribute { public func accessKey(_ value: Character) -> Division { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -16356,7 +16358,7 @@ public struct Definition: ContentNode, HtmlElement, BodyElement, FormElement, Fi self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -16395,7 +16397,7 @@ public struct Definition: ContentNode, HtmlElement, BodyElement, FormElement, Fi } } -extension Definition: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Definition: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Definition { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -16892,7 +16894,7 @@ public struct Cite: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -16931,7 +16933,7 @@ public struct Cite: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl } } -extension Cite: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Cite: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Cite { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -17427,7 +17429,7 @@ public struct ShortQuote: ContentNode, HtmlElement, BodyElement, FormElement, Fi self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -17466,7 +17468,7 @@ public struct ShortQuote: ContentNode, HtmlElement, BodyElement, FormElement, Fi } } -extension ShortQuote: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, CiteAttribute { +extension ShortQuote: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, CiteAttribute { public func accessKey(_ value: Character) -> ShortQuote { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -17967,7 +17969,7 @@ public struct Abbreviation: ContentNode, HtmlElement, BodyElement, FormElement, self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -18006,7 +18008,7 @@ public struct Abbreviation: ContentNode, HtmlElement, BodyElement, FormElement, } } -extension Abbreviation: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Abbreviation: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Abbreviation { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -18503,7 +18505,7 @@ public struct Ruby: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [RubyElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .trusted, content: [RubyElement] = []) { self.attributes = attributes self.context = context @@ -18542,7 +18544,7 @@ public struct Ruby: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl } } -extension Ruby: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Ruby: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Ruby { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -19041,7 +19043,7 @@ public struct Data: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -19080,7 +19082,7 @@ public struct Data: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl } } -extension Data: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ValueAttribute { +extension Data: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ValueAttribute { public func accessKey(_ value: Character) -> Data { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -19591,7 +19593,7 @@ public struct Time: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -19630,7 +19632,7 @@ public struct Time: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl } } -extension Time: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, DateTimeAttribute { +extension Time: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, DateTimeAttribute { public func accessKey(_ value: Character) -> Time { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -20132,7 +20134,7 @@ public struct Code: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -20171,7 +20173,7 @@ public struct Code: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl } } -extension Code: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Code: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Code { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -20669,7 +20671,7 @@ public struct Variable: ContentNode, HtmlElement, BodyElement, FormElement, Figu self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -20708,7 +20710,7 @@ public struct Variable: ContentNode, HtmlElement, BodyElement, FormElement, Figu } } -extension Variable: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Variable: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Variable { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -21202,7 +21204,7 @@ public struct SampleOutput: ContentNode, HtmlElement, BodyElement, FormElement, self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -21241,7 +21243,7 @@ public struct SampleOutput: ContentNode, HtmlElement, BodyElement, FormElement, } } -extension SampleOutput: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension SampleOutput: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> SampleOutput { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -21739,7 +21741,7 @@ public struct KeyboardInput: ContentNode, HtmlElement, BodyElement, FormElement, self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -21778,7 +21780,7 @@ public struct KeyboardInput: ContentNode, HtmlElement, BodyElement, FormElement, } } -extension KeyboardInput: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension KeyboardInput: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> KeyboardInput { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -22276,7 +22278,7 @@ public struct Subscript: ContentNode, HtmlElement, BodyElement, FormElement, Fig self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -22315,7 +22317,7 @@ public struct Subscript: ContentNode, HtmlElement, BodyElement, FormElement, Fig } } -extension Subscript: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Subscript: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Subscript { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -22812,7 +22814,7 @@ public struct Superscript: ContentNode, HtmlElement, BodyElement, FormElement, F self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -22851,7 +22853,7 @@ public struct Superscript: ContentNode, HtmlElement, BodyElement, FormElement, F } } -extension Superscript: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Superscript: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Superscript { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -23349,7 +23351,7 @@ public struct Italic: ContentNode, HtmlElement, BodyElement, FormElement, Figure self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -23388,7 +23390,7 @@ public struct Italic: ContentNode, HtmlElement, BodyElement, FormElement, Figure } } -extension Italic: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Italic: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Italic { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -23895,7 +23897,7 @@ public struct Bold: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -23934,7 +23936,7 @@ public struct Bold: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl } } -extension Bold: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Bold: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Bold { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -24441,7 +24443,7 @@ public struct Underline: ContentNode, HtmlElement, BodyElement, FormElement, Fig self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -24480,7 +24482,7 @@ public struct Underline: ContentNode, HtmlElement, BodyElement, FormElement, Fig } } -extension Underline: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Underline: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Underline { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -24987,7 +24989,7 @@ public struct Mark: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -25026,7 +25028,7 @@ public struct Mark: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl } } -extension Mark: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Mark: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Mark { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -25524,7 +25526,7 @@ public struct Bdi: ContentNode, HtmlElement, BodyElement, FormElement, FigureEle self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -25563,7 +25565,7 @@ public struct Bdi: ContentNode, HtmlElement, BodyElement, FormElement, FigureEle } } -extension Bdi: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Bdi: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Bdi { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -26052,7 +26054,7 @@ public struct Bdo: EmptyNode, HtmlElement, BodyElement, FormElement, FigureEleme /// Create a bidirectional override. public init() {} - internal init(attributes: OrderedDictionary?) { + internal init(attributes: OrderedDictionary? = nil) { self.attributes = attributes } @@ -26088,7 +26090,7 @@ public struct Bdo: EmptyNode, HtmlElement, BodyElement, FormElement, FigureEleme } } -extension Bdo: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Bdo: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Bdo { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -26582,7 +26584,7 @@ public struct Span: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -26621,7 +26623,7 @@ public struct Span: ContentNode, HtmlElement, BodyElement, FormElement, FigureEl } } -extension Span: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, OrientationAccessibilityAttribute, RequiredAccessibilityAttribute, ReadOnlyAccessibilityAttribute { +extension Span: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, OrientationAccessibilityAttribute, RequiredAccessibilityAttribute, ReadOnlyAccessibilityAttribute { public func accessKey(_ value: Character) -> Span { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -27115,7 +27117,7 @@ public struct LineBreak: EmptyNode, HtmlElement, BodyElement, FormElement, Figur /// Create a line break. public init() {} - internal init(attributes: OrderedDictionary?) { + internal init(attributes: OrderedDictionary? = nil) { self.attributes = attributes } @@ -27151,7 +27153,7 @@ public struct LineBreak: EmptyNode, HtmlElement, BodyElement, FormElement, Figur } } -extension LineBreak: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension LineBreak: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> LineBreak { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -27637,7 +27639,7 @@ public struct WordBreak: EmptyNode, HtmlElement, BodyElement, FormElement, Figur /// Create a word break. public init() {} - internal init(attributes: OrderedDictionary?) { + internal init(attributes: OrderedDictionary? = nil) { self.attributes = attributes } @@ -27673,7 +27675,7 @@ public struct WordBreak: EmptyNode, HtmlElement, BodyElement, FormElement, Figur } } -extension WordBreak: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension WordBreak: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> WordBreak { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -28167,7 +28169,7 @@ public struct InsertedText: ContentNode, HtmlElement, BodyElement, FormElement, self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -28206,7 +28208,7 @@ public struct InsertedText: ContentNode, HtmlElement, BodyElement, FormElement, } } -extension InsertedText: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, CiteAttribute, DateTimeAttribute { +extension InsertedText: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, CiteAttribute, DateTimeAttribute { public func accessKey(_ value: Character) -> InsertedText { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -28708,7 +28710,7 @@ public struct DeletedText: ContentNode, HtmlElement, BodyElement, FormElement, F self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -28747,7 +28749,7 @@ public struct DeletedText: ContentNode, HtmlElement, BodyElement, FormElement, F } } -extension DeletedText: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, CiteAttribute, DateTimeAttribute { +extension DeletedText: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, CiteAttribute, DateTimeAttribute { public func accessKey(_ value: Character) -> DeletedText { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -29254,7 +29256,7 @@ public struct Picture: ContentNode, HtmlElement, BodyElement, FormElement, Figur self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -29293,7 +29295,7 @@ public struct Picture: ContentNode, HtmlElement, BodyElement, FormElement, Figur } } -extension Picture: GlobalAttributes, GlobalEventAttributes { +extension Picture: GlobalContentAttributes, GlobalEventAttributes { public func accessKey(_ value: Character) -> Picture { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -29548,7 +29550,7 @@ public struct Image: EmptyNode, HtmlElement, BodyElement, FormElement, FigureEle /// Create an image. public init() {} - internal init(attributes: OrderedDictionary?) { + internal init(attributes: OrderedDictionary? = nil) { self.attributes = attributes } @@ -29584,7 +29586,7 @@ public struct Image: EmptyNode, HtmlElement, BodyElement, FormElement, FigureEle } } -extension Image: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, AlternateAttribute, SourceAttribute, SizesAttribute, WidthAttribute, HeightAttribute, ReferrerPolicyAttribute, FetchPriorityAttribute, LoadingAttribute, SourceSetAttribute, DecodingAttribute, IsMapAttribute, UseMapAttribute, CrossOriginAttribute { +extension Image: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, AlternateAttribute, SourceAttribute, SizesAttribute, WidthAttribute, HeightAttribute, ReferrerPolicyAttribute, FetchPriorityAttribute, LoadingAttribute, SourceSetAttribute, DecodingAttribute, IsMapAttribute, UseMapAttribute, CrossOriginAttribute { public func accessKey(_ value: Character) -> Image { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -30157,7 +30159,7 @@ public struct InlineFrame: ContentNode, HtmlElement, BodyElement, FormElement, F self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -30196,7 +30198,7 @@ public struct InlineFrame: ContentNode, HtmlElement, BodyElement, FormElement, F } } -extension InlineFrame: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, SourceAttribute, NameAttribute, WidthAttribute, HeightAttribute, ReferrerPolicyAttribute, LoadingAttribute, SandboxAttribute, SourceDocumentAttribute { +extension InlineFrame: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, SourceAttribute, NameAttribute, WidthAttribute, HeightAttribute, ReferrerPolicyAttribute, LoadingAttribute, SandboxAttribute, SourceDocumentAttribute { public func accessKey(_ value: Character) -> InlineFrame { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -30724,7 +30726,7 @@ public struct Embed: EmptyNode, HtmlElement, BodyElement, FormElement, FigureEle /// Create an embed. public init() {} - internal init(attributes: OrderedDictionary?) { + internal init(attributes: OrderedDictionary? = nil) { self.attributes = attributes } @@ -30760,7 +30762,7 @@ public struct Embed: EmptyNode, HtmlElement, BodyElement, FormElement, FigureEle } } -extension Embed: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, SourceAttribute, TypeAttribute, WidthAttribute, HeightAttribute { +extension Embed: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, SourceAttribute, TypeAttribute, WidthAttribute, HeightAttribute { public func accessKey(_ value: Character) -> Embed { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -31275,7 +31277,7 @@ public struct Object: ContentNode, HtmlElement, BodyElement, FormElement, Figure self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [ObjectElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .trusted, content: [ObjectElement] = []) { self.attributes = attributes self.context = context @@ -31314,7 +31316,7 @@ public struct Object: ContentNode, HtmlElement, BodyElement, FormElement, Figure } } -extension Object: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, DataAttribute, TypeAttribute, NameAttribute, FormAttribute, WidthAttribute, HeightAttribute { +extension Object: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, DataAttribute, TypeAttribute, NameAttribute, FormAttribute, WidthAttribute, HeightAttribute { public func accessKey(_ value: Character) -> Object { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -31834,7 +31836,7 @@ public struct Video: ContentNode, HtmlElement, BodyElement, FormElement, FigureE self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [MediaElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .trusted, content: [MediaElement] = []) { self.attributes = attributes self.context = context @@ -31873,7 +31875,7 @@ public struct Video: ContentNode, HtmlElement, BodyElement, FormElement, FigureE } } -extension Video: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, SourceAttribute, AutoplayAttribute, LoopAttribute, MutedAttribute, ControlsAttribute, WidthAttribute, HeightAttribute, PreloadAttribute, PlaysInlineAttribute, CrossOriginAttribute, LoadingAttribute { +extension Video: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, SourceAttribute, AutoplayAttribute, LoopAttribute, MutedAttribute, ControlsAttribute, WidthAttribute, HeightAttribute, PreloadAttribute, PlaysInlineAttribute, CrossOriginAttribute, LoadingAttribute { public func accessKey(_ value: Character) -> Video { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -32432,7 +32434,7 @@ public struct Audio: ContentNode, HtmlElement, BodyElement, FormElement, FigureE self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [MediaElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .trusted, content: [MediaElement] = []) { self.attributes = attributes self.context = context @@ -32471,7 +32473,7 @@ public struct Audio: ContentNode, HtmlElement, BodyElement, FormElement, FigureE } } -extension Audio: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, SourceAttribute, AutoplayAttribute, LoopAttribute, MutedAttribute, ControlsAttribute, PreloadAttribute, CrossOriginAttribute, LoadingAttribute { +extension Audio: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, SourceAttribute, AutoplayAttribute, LoopAttribute, MutedAttribute, ControlsAttribute, PreloadAttribute, CrossOriginAttribute, LoadingAttribute { public func accessKey(_ value: Character) -> Audio { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -33018,7 +33020,7 @@ public struct Map: ContentNode, HtmlElement, BodyElement, FormElement, FigureEle self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [MapElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .trusted, content: [MapElement] = []) { self.attributes = attributes self.context = context @@ -33057,7 +33059,7 @@ public struct Map: ContentNode, HtmlElement, BodyElement, FormElement, FigureEle } } -extension Map: GlobalAttributes, GlobalEventAttributes, NameAttribute { +extension Map: GlobalContentAttributes, GlobalEventAttributes, NameAttribute { public func accessKey(_ value: Character) -> Map { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -33331,7 +33333,7 @@ public struct Form: ContentNode, HtmlElement, BodyElement, FigureElement, Object self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [FormElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .trusted, content: [FormElement] = []) { self.attributes = attributes self.context = context @@ -33370,7 +33372,7 @@ public struct Form: ContentNode, HtmlElement, BodyElement, FigureElement, Object } } -extension Form: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ActionAttribute, AutocompleteAttribute, EncodingAttribute, MethodAttribute, NameAttribute, TargetAttribute, RelationshipAttribute { +extension Form: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ActionAttribute, AutocompleteAttribute, EncodingAttribute, MethodAttribute, NameAttribute, TargetAttribute, RelationshipAttribute { public func accessKey(_ value: Character) -> Form { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -33912,7 +33914,7 @@ public struct DataList: ContentNode, HtmlElement, BodyElement, FormElement, Figu self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -33951,7 +33953,7 @@ public struct DataList: ContentNode, HtmlElement, BodyElement, FormElement, Figu } } -extension DataList: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension DataList: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> DataList { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -34447,7 +34449,7 @@ public struct Output: ContentNode, HtmlElement, BodyElement, FormElement, Figure self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -34486,7 +34488,7 @@ public struct Output: ContentNode, HtmlElement, BodyElement, FormElement, Figure } } -extension Output: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ForAttribute, FormAttribute, NameAttribute { +extension Output: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ForAttribute, FormAttribute, NameAttribute { public func accessKey(_ value: Character) -> Output { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -34994,7 +34996,7 @@ public struct Progress: ContentNode, HtmlElement, BodyElement, FormElement, Figu self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -35033,7 +35035,7 @@ public struct Progress: ContentNode, HtmlElement, BodyElement, FormElement, Figu } } -extension Progress: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ValueAttribute, MaximumValueAttribute { +extension Progress: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ValueAttribute, MaximumValueAttribute { public func accessKey(_ value: Character) -> Progress { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -35548,7 +35550,7 @@ public struct Meter: ContentNode, HtmlElement, BodyElement, FormElement, FigureE self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -35587,7 +35589,7 @@ public struct Meter: ContentNode, HtmlElement, BodyElement, FormElement, FigureE } } -extension Meter: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ValueAttribute, MinimumValueAttribute, MaximumValueAttribute, LowAttribute, HighAttribute, OptimumAttribute { +extension Meter: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ValueAttribute, MinimumValueAttribute, MaximumValueAttribute, LowAttribute, HighAttribute, OptimumAttribute { public func accessKey(_ value: Character) -> Meter { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -36119,7 +36121,7 @@ public struct Details: ContentNode, HtmlElement, BodyElement, FormElement, Figur self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -36158,7 +36160,7 @@ public struct Details: ContentNode, HtmlElement, BodyElement, FormElement, Figur } } -extension Details: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, OpenAttribute, DetailEventAttribute { +extension Details: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, OpenAttribute, DetailEventAttribute { public func accessKey(_ value: Character) -> Details { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -36680,7 +36682,7 @@ public struct Dialog: ContentNode, BodyElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -36719,7 +36721,7 @@ public struct Dialog: ContentNode, BodyElement { } } -extension Dialog: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, OpenAttribute { +extension Dialog: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, OpenAttribute { public func accessKey(_ value: Character) -> Dialog { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -37232,7 +37234,7 @@ public struct Script: ContentNode, HeadElement, BodyElement, FormElement, Figure self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.js), content: [Content] = []) { self.attributes = attributes self.context = context @@ -37271,7 +37273,7 @@ public struct Script: ContentNode, HeadElement, BodyElement, FormElement, Figure } } -extension Script: GlobalAttributes, GlobalEventAttributes, AsynchronouslyAttribute, ReferrerPolicyAttribute, SourceAttribute, TypeAttribute, FetchPriorityAttribute, BlockingAttribute, IntegrityAttribute, DeferAttribute, CrossOriginAttribute { +extension Script: GlobalContentAttributes, GlobalEventAttributes, AsynchronouslyAttribute, ReferrerPolicyAttribute, SourceAttribute, TypeAttribute, FetchPriorityAttribute, BlockingAttribute, IntegrityAttribute, DeferAttribute, CrossOriginAttribute { public func accessKey(_ value: Character) -> Script { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -37581,7 +37583,7 @@ public struct NoScript: ContentNode, HtmlElement, HeadElement, BodyElement, Form self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -37620,7 +37622,7 @@ public struct NoScript: ContentNode, HtmlElement, HeadElement, BodyElement, Form } } -extension NoScript: GlobalAttributes, GlobalEventAttributes { +extension NoScript: GlobalContentAttributes, GlobalEventAttributes { public func accessKey(_ value: Character) -> NoScript { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -37891,7 +37893,7 @@ public struct Template: ContentNode, BodyElement, FormElement, FigureElement, Ob self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -37930,7 +37932,7 @@ public struct Template: ContentNode, BodyElement, FormElement, FigureElement, Ob } } -extension Template: GlobalAttributes, GlobalEventAttributes, ShadowRootModeAttribute { +extension Template: GlobalContentAttributes, GlobalEventAttributes, ShadowRootModeAttribute { public func accessKey(_ value: Character) -> Template { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -38194,7 +38196,7 @@ public struct Canvas: ContentNode, HtmlElement, BodyElement, FormElement, Figure self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -38233,7 +38235,7 @@ public struct Canvas: ContentNode, HtmlElement, BodyElement, FormElement, Figure } } -extension Canvas: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, WidthAttribute, HeightAttribute { +extension Canvas: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, WidthAttribute, HeightAttribute { public func accessKey(_ value: Character) -> Canvas { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -38742,7 +38744,7 @@ public struct Table: ContentNode, HtmlElement, BodyElement, FormElement, FigureE self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [TableElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .trusted, content: [TableElement] = []) { self.attributes = attributes self.context = context @@ -38781,7 +38783,7 @@ public struct Table: ContentNode, HtmlElement, BodyElement, FormElement, FigureE } } -extension Table: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, WidthAttribute, HeightAttribute, RowCountAccessibilityAttribute, ColumnCountAccessibilityAttribute { +extension Table: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, WidthAttribute, HeightAttribute, RowCountAccessibilityAttribute, ColumnCountAccessibilityAttribute { public func accessKey(_ value: Character) -> Table { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -39297,7 +39299,7 @@ public struct Vector: ContentNode, HtmlElement, BodyElement, FormElement, Figure self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [VectorElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [VectorElement] = []) { self.attributes = attributes self.context = context @@ -39653,7 +39655,7 @@ public struct Slot: ContentNode, BodyElement, FormElement, FigureElement, Object self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -39692,7 +39694,7 @@ public struct Slot: ContentNode, BodyElement, FormElement, FigureElement, Object } } -extension Slot: GlobalAttributes, NameAttribute { +extension Slot: GlobalContentAttributes, NameAttribute { public func accessKey(_ value: Character) -> Slot { return self.mutate(accesskey: .init("\(value)", context: .trusted)) diff --git a/Sources/HTMLKit/Abstraction/Elements/DefinitionElements.swift b/Sources/HTMLKit/Abstraction/Elements/DefinitionElements.swift index 7ab2159a..71b4b362 100644 --- a/Sources/HTMLKit/Abstraction/Elements/DefinitionElements.swift +++ b/Sources/HTMLKit/Abstraction/Elements/DefinitionElements.swift @@ -42,7 +42,7 @@ public struct TermName: ContentNode, DescriptionElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -81,7 +81,7 @@ public struct TermName: ContentNode, DescriptionElement { } } -extension TermName: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension TermName: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> TermName { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -580,7 +580,7 @@ public struct TermDefinition: ContentNode, DescriptionElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -619,7 +619,7 @@ public struct TermDefinition: ContentNode, DescriptionElement { } } -extension TermDefinition: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension TermDefinition: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> TermDefinition { return mutate(accesskey: .init("\(value)", context: .trusted)) diff --git a/Sources/HTMLKit/Abstraction/Elements/FigureElements.swift b/Sources/HTMLKit/Abstraction/Elements/FigureElements.swift index 90ec2744..d249b31e 100644 --- a/Sources/HTMLKit/Abstraction/Elements/FigureElements.swift +++ b/Sources/HTMLKit/Abstraction/Elements/FigureElements.swift @@ -38,7 +38,7 @@ public struct FigureCaption: ContentNode, FigureElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -77,7 +77,7 @@ public struct FigureCaption: ContentNode, FigureElement { } } -extension FigureCaption: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension FigureCaption: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> FigureCaption { return mutate(accesskey: .init("\(value)", context: .trusted)) diff --git a/Sources/HTMLKit/Abstraction/Elements/FormElements.swift b/Sources/HTMLKit/Abstraction/Elements/FormElements.swift index 91c24487..7ef9ed73 100644 --- a/Sources/HTMLKit/Abstraction/Elements/FormElements.swift +++ b/Sources/HTMLKit/Abstraction/Elements/FormElements.swift @@ -23,7 +23,7 @@ public struct Input: EmptyNode, FormElement { /// Create an input. public init() {} - internal init(attributes: OrderedDictionary?) { + internal init(attributes: OrderedDictionary? = nil) { self.attributes = attributes } @@ -59,7 +59,7 @@ public struct Input: EmptyNode, FormElement { } } -extension Input: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, AcceptAttribute, AlternateAttribute, AutocompleteAttribute, CheckedAttribute, DisabledAttribute, FormAttribute, FormActionAttribute, HeightAttribute, ListAttribute, MaximumValueAttribute, MaximumLengthAttribute, MinimumValueAttribute, MinimumLengthAttribute, MultipleAttribute, NameAttribute, PatternAttribute, PlaceholderAttribute, ReadOnlyAttribute, RequiredAttribute, SizeAttribute, SourceAttribute, StepAttribute, TypeAttribute, ValueAttribute, WidthAttribute, PopoverTargetAttribute, FocusedAccessibilityAttribute, CompletionAccessibilityAttribute { +extension Input: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, AcceptAttribute, AlternateAttribute, AutocompleteAttribute, CheckedAttribute, DisabledAttribute, FormAttribute, FormActionAttribute, HeightAttribute, ListAttribute, MaximumValueAttribute, MaximumLengthAttribute, MinimumValueAttribute, MinimumLengthAttribute, MultipleAttribute, NameAttribute, PatternAttribute, PlaceholderAttribute, ReadOnlyAttribute, RequiredAttribute, SizeAttribute, SourceAttribute, StepAttribute, TypeAttribute, ValueAttribute, WidthAttribute, PopoverTargetAttribute, FocusedAccessibilityAttribute, CompletionAccessibilityAttribute { public func accessKey(_ value: Character) -> Input { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -679,7 +679,7 @@ public struct Label: ContentNode, FormElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -718,7 +718,7 @@ public struct Label: ContentNode, FormElement { } } -extension Label: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ForAttribute { +extension Label: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ForAttribute { public func accessKey(_ value: Character) -> Label { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -1234,7 +1234,7 @@ public struct Select: ContentNode, FormElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -1273,7 +1273,7 @@ public struct Select: ContentNode, FormElement { } } -extension Select: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, AutocompleteAttribute, DisabledAttribute, FormAttribute, MultipleAttribute, NameAttribute, RequiredAttribute, SizeAttribute { +extension Select: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, AutocompleteAttribute, DisabledAttribute, FormAttribute, MultipleAttribute, NameAttribute, RequiredAttribute, SizeAttribute { public func accessKey(_ value: Character) -> Select { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -1722,7 +1722,7 @@ public struct TextArea: ContentNode, FormElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [String]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [String] = []) { self.attributes = attributes self.context = context @@ -1761,7 +1761,7 @@ public struct TextArea: ContentNode, FormElement { } } -extension TextArea: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, AutocompleteAttribute, ColumnsAttribute, DisabledAttribute, FormAttribute, MaximumLengthAttribute, MinimumLengthAttribute, NameAttribute, PlaceholderAttribute, ReadOnlyAttribute, RequiredAttribute, RowsAttribute, WrapAttribute { +extension TextArea: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, AutocompleteAttribute, ColumnsAttribute, DisabledAttribute, FormAttribute, MaximumLengthAttribute, MinimumLengthAttribute, NameAttribute, PlaceholderAttribute, ReadOnlyAttribute, RequiredAttribute, RowsAttribute, WrapAttribute { public func accessKey(_ value: Character) -> TextArea { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -2343,7 +2343,7 @@ public struct Button: ContentNode, FormElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -2382,7 +2382,7 @@ public struct Button: ContentNode, FormElement { } } -extension Button: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, DisabledAttribute, FormAttribute, FormActionAttribute, NameAttribute, TypeAttribute, ValueAttribute, PopoverTargetAttribute, PressedAccessibilityAttribute, SelectedAccessibilityAttribute, ExpandedAccessibilityAttribute { +extension Button: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, DisabledAttribute, FormAttribute, FormActionAttribute, NameAttribute, TypeAttribute, ValueAttribute, PopoverTargetAttribute, PressedAccessibilityAttribute, SelectedAccessibilityAttribute, ExpandedAccessibilityAttribute { public func accessKey(_ value: Character) -> Button { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -2962,7 +2962,7 @@ public struct Fieldset: ContentNode, FormElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -3001,7 +3001,7 @@ public struct Fieldset: ContentNode, FormElement { } } -extension Fieldset: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, DisabledAttribute, FormAttribute, NameAttribute { +extension Fieldset: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, DisabledAttribute, FormAttribute, NameAttribute { public func accessKey(_ value: Character) -> Fieldset { return mutate(accesskey: .init("\(value)", context: .trusted)) diff --git a/Sources/HTMLKit/Abstraction/Elements/HeadElements.swift b/Sources/HTMLKit/Abstraction/Elements/HeadElements.swift index c4a9fd00..f87bb8cf 100644 --- a/Sources/HTMLKit/Abstraction/Elements/HeadElements.swift +++ b/Sources/HTMLKit/Abstraction/Elements/HeadElements.swift @@ -31,7 +31,7 @@ public struct Title: ContentNode, HeadElement, VectorElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -70,7 +70,7 @@ public struct Title: ContentNode, HeadElement, VectorElement { } } -extension Title: GlobalAttributes, GlobalEventAttributes { +extension Title: GlobalContentAttributes, GlobalEventAttributes { public func accessKey(_ value: Character) -> Title { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -371,7 +371,7 @@ public struct Base: EmptyNode, HeadElement { } } -extension Base: GlobalAttributes, GlobalEventAttributes, ReferenceAttribute, TargetAttribute { +extension Base: GlobalContentAttributes, GlobalEventAttributes, ReferenceAttribute, TargetAttribute { public func accessKey(_ value: Character) -> Base { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -670,7 +670,7 @@ public struct Meta: EmptyNode, HeadElement { } } -extension Meta: GlobalAttributes, GlobalEventAttributes, ContentAttribute, NameAttribute, PropertyAttribute, CharsetAttribute, EquivalentAttribute { +extension Meta: GlobalContentAttributes, GlobalEventAttributes, ContentAttribute, NameAttribute, PropertyAttribute, CharsetAttribute, EquivalentAttribute { public func accessKey(_ value: Character) -> Meta { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -973,7 +973,7 @@ public struct Style: ContentNode, HeadElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.css), content: [Content] = []) { self.attributes = attributes self.context = context @@ -1012,7 +1012,7 @@ public struct Style: ContentNode, HeadElement { } } -extension Style: GlobalAttributes, GlobalEventAttributes, TypeAttribute, MediaAttribute, BlockingAttribute { +extension Style: GlobalContentAttributes, GlobalEventAttributes, TypeAttribute, MediaAttribute, BlockingAttribute { public func accessKey(_ value: Character) -> Style { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -1322,7 +1322,7 @@ public struct Link: EmptyNode, HeadElement, BodyElement { } } -extension Link: GlobalAttributes, GlobalEventAttributes, ReferenceAttribute, ReferenceLanguageAttribute, MediaAttribute, ReferrerPolicyAttribute, RelationshipAttribute, SizesAttribute, TypeAttribute, FetchPriorityAttribute, BlockingAttribute, FormEventAttribute, IntegrityAttribute, AsAttribute, CrossOriginAttribute { +extension Link: GlobalContentAttributes, GlobalEventAttributes, ReferenceAttribute, ReferenceLanguageAttribute, MediaAttribute, ReferrerPolicyAttribute, RelationshipAttribute, SizesAttribute, TypeAttribute, FetchPriorityAttribute, BlockingAttribute, FormEventAttribute, IntegrityAttribute, AsAttribute, CrossOriginAttribute { public func accessKey(_ value: Character) -> Link { return mutate(accesskey: .init("\(value)", context: .trusted)) diff --git a/Sources/HTMLKit/Abstraction/Elements/HtmlElements.swift b/Sources/HTMLKit/Abstraction/Elements/HtmlElements.swift index a148f760..3b658737 100644 --- a/Sources/HTMLKit/Abstraction/Elements/HtmlElements.swift +++ b/Sources/HTMLKit/Abstraction/Elements/HtmlElements.swift @@ -29,7 +29,7 @@ public struct Head: ContentNode, HtmlElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [HeadElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .trusted, content: [HeadElement] = []) { self.attributes = attributes self.context = context @@ -68,7 +68,7 @@ public struct Head: ContentNode, HtmlElement { } } -extension Head: GlobalAttributes, GlobalEventAttributes { +extension Head: GlobalContentAttributes, GlobalEventAttributes { public func accessKey(_ value: Character) -> Head { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -337,7 +337,7 @@ public struct Body: ContentNode, HtmlElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [BodyElement]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .trusted, content: [BodyElement] = []) { self.attributes = attributes self.context = context @@ -376,7 +376,7 @@ public struct Body: ContentNode, HtmlElement { } } -extension Body: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, WindowEventAttribute { +extension Body: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, WindowEventAttribute { public func accessKey(_ value: Character) -> Body { return mutate(accesskey: .init("\(value)", context: .trusted)) diff --git a/Sources/HTMLKit/Abstraction/Elements/InputElements.swift b/Sources/HTMLKit/Abstraction/Elements/InputElements.swift index 330fc051..05a78b87 100644 --- a/Sources/HTMLKit/Abstraction/Elements/InputElements.swift +++ b/Sources/HTMLKit/Abstraction/Elements/InputElements.swift @@ -44,7 +44,7 @@ public struct OptionGroup: ContentNode, InputElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -83,7 +83,7 @@ public struct OptionGroup: ContentNode, InputElement { } } -extension OptionGroup: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, DisabledAttribute, LabelAttribute { +extension OptionGroup: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, DisabledAttribute, LabelAttribute { public func accessKey(_ value: Character) -> OptionGroup { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -602,7 +602,7 @@ public struct Option: ContentNode, InputElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [String]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [String] = []) { self.attributes = attributes self.context = context @@ -641,7 +641,7 @@ public struct Option: ContentNode, InputElement { } } -extension Option: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, DisabledAttribute, LabelAttribute, ValueAttribute, SelectedAttribute { +extension Option: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, DisabledAttribute, LabelAttribute, ValueAttribute, SelectedAttribute { public func accessKey(_ value: Character) -> Option { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -1192,7 +1192,7 @@ public struct Legend: ContentNode, InputElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -1231,7 +1231,7 @@ public struct Legend: ContentNode, InputElement { } } -extension Legend: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Legend: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Legend { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -1730,7 +1730,7 @@ public struct Summary: ContentNode, InputElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -1769,7 +1769,7 @@ public struct Summary: ContentNode, InputElement { } } -extension Summary: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Summary: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Summary { return mutate(accesskey: .init("\(value)", context: .trusted)) diff --git a/Sources/HTMLKit/Abstraction/Elements/ListElements.swift b/Sources/HTMLKit/Abstraction/Elements/ListElements.swift index afddf0c4..c6e7d7b3 100644 --- a/Sources/HTMLKit/Abstraction/Elements/ListElements.swift +++ b/Sources/HTMLKit/Abstraction/Elements/ListElements.swift @@ -38,7 +38,7 @@ public struct ListItem: ContentNode, ListElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -77,7 +77,7 @@ public struct ListItem: ContentNode, ListElement { } } -extension ListItem: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ValueAttribute, RequiredAccessibilityAttribute, PositionAccessibilityAttribute, CheckedAccessibilityAttribute { +extension ListItem: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ValueAttribute, RequiredAccessibilityAttribute, PositionAccessibilityAttribute, CheckedAccessibilityAttribute { public func accessKey(_ value: Character) -> ListItem { return mutate(accesskey: .init("\(value)", context: .trusted)) diff --git a/Sources/HTMLKit/Abstraction/Elements/MapElements.swift b/Sources/HTMLKit/Abstraction/Elements/MapElements.swift index 5cb6863c..35056de5 100644 --- a/Sources/HTMLKit/Abstraction/Elements/MapElements.swift +++ b/Sources/HTMLKit/Abstraction/Elements/MapElements.swift @@ -26,10 +26,10 @@ public struct Area: EmptyNode, MapElement { /// Creates a area. public init() {} - @available(*, deprecated, message: "The area element is actually an empty element. Use Area() instead.") + @available(*, unavailable, message: "The area element is actually an empty element. Use Area() instead.") public init(@ContentBuilder content: () -> [Content]) {} - internal init(attributes: OrderedDictionary?) { + internal init(attributes: OrderedDictionary? = nil) { self.attributes = attributes } @@ -65,7 +65,7 @@ public struct Area: EmptyNode, MapElement { } } -extension Area: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, AlternateAttribute, ShapeAttribute, ReferenceAttribute, TargetAttribute, DownloadAttribute, PingAttribute, RelationshipAttribute, ReferrerPolicyAttribute { +extension Area: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, AlternateAttribute, ShapeAttribute, ReferenceAttribute, TargetAttribute, DownloadAttribute, PingAttribute, RelationshipAttribute, ReferrerPolicyAttribute { public func accessKey(_ value: Character) -> Area { return mutate(accesskey: .init("\(value)", context: .trusted)) diff --git a/Sources/HTMLKit/Abstraction/Elements/MediaElements.swift b/Sources/HTMLKit/Abstraction/Elements/MediaElements.swift index b997b33d..e5b6e464 100644 --- a/Sources/HTMLKit/Abstraction/Elements/MediaElements.swift +++ b/Sources/HTMLKit/Abstraction/Elements/MediaElements.swift @@ -22,7 +22,7 @@ public struct Source: EmptyNode, MediaElement { /// Create a source. public init() {} - internal init(attributes: OrderedDictionary?) { + internal init(attributes: OrderedDictionary? = nil) { self.attributes = attributes } @@ -58,7 +58,7 @@ public struct Source: EmptyNode, MediaElement { } } -extension Source: GlobalAttributes, GlobalEventAttributes, TypeAttribute, SourceAttribute, SizesAttribute, MediaAttribute, WidthAttribute, HeightAttribute, SourceSetAttribute { +extension Source: GlobalContentAttributes, GlobalEventAttributes, TypeAttribute, SourceAttribute, SizesAttribute, MediaAttribute, WidthAttribute, HeightAttribute, SourceSetAttribute { public func accessKey(_ value: Character) -> Source { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -407,7 +407,7 @@ public struct Track: EmptyNode, MediaElement { } } -extension Track: GlobalAttributes, GlobalEventAttributes, KindAttribute, SourceAttribute, LabelAttribute, DefaultAttribute, SourceLanguageAttribute { +extension Track: GlobalContentAttributes, GlobalEventAttributes, KindAttribute, SourceAttribute, LabelAttribute, DefaultAttribute, SourceLanguageAttribute { public func accessKey(_ value: Character) -> Track { return mutate(accesskey: .init("\(value)", context: .trusted)) diff --git a/Sources/HTMLKit/Abstraction/Elements/RubyElements.swift b/Sources/HTMLKit/Abstraction/Elements/RubyElements.swift index d788f67a..2efa389b 100644 --- a/Sources/HTMLKit/Abstraction/Elements/RubyElements.swift +++ b/Sources/HTMLKit/Abstraction/Elements/RubyElements.swift @@ -40,7 +40,7 @@ public struct RubyText: ContentNode, RubyElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -79,7 +79,7 @@ public struct RubyText: ContentNode, RubyElement { } } -extension RubyText: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension RubyText: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> RubyText { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -582,7 +582,7 @@ public struct RubyPronunciation: ContentNode, RubyElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -621,7 +621,7 @@ public struct RubyPronunciation: ContentNode, RubyElement { } } -extension RubyPronunciation: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension RubyPronunciation: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> RubyPronunciation { return mutate(accesskey: .init("\(value)", context: .trusted)) diff --git a/Sources/HTMLKit/Abstraction/Elements/TableElements.swift b/Sources/HTMLKit/Abstraction/Elements/TableElements.swift index 39eed5dc..896dee2e 100644 --- a/Sources/HTMLKit/Abstraction/Elements/TableElements.swift +++ b/Sources/HTMLKit/Abstraction/Elements/TableElements.swift @@ -63,7 +63,7 @@ public struct Caption: ContentNode, TableElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -102,7 +102,7 @@ public struct Caption: ContentNode, TableElement { } } -extension Caption: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension Caption: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> Caption { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -600,7 +600,7 @@ public struct ColumnGroup: ContentNode, TableElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -639,7 +639,7 @@ public struct ColumnGroup: ContentNode, TableElement { } } -extension ColumnGroup: GlobalAttributes, GlobalEventAttributes, SpanAttribute { +extension ColumnGroup: GlobalContentAttributes, GlobalEventAttributes, SpanAttribute { public func accessKey(_ value: Character) -> ColumnGroup { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -902,10 +902,10 @@ public struct Column: EmptyNode, TableElement { /// Create a column. public init() {} - @available(*, deprecated, message: "The column element is actually an empty element. Use Column() instead.") + @available(*, unavailable, message: "The column element is actually an empty element. Use Column() instead.") public init(@ContentBuilder content: () -> [Content]) {} - internal init(attributes: OrderedDictionary?) { + internal init(attributes: OrderedDictionary? = nil) { self.attributes = attributes } @@ -941,7 +941,7 @@ public struct Column: EmptyNode, TableElement { } } -extension Column: GlobalAttributes, GlobalEventAttributes, SpanAttribute { +extension Column: GlobalContentAttributes, GlobalEventAttributes, SpanAttribute { public func accessKey(_ value: Character) -> Column { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -1214,7 +1214,7 @@ public struct TableBody: ContentNode, TableElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -1253,7 +1253,7 @@ public struct TableBody: ContentNode, TableElement { } } -extension TableBody: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, WidthAttribute, HeightAttribute { +extension TableBody: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, WidthAttribute, HeightAttribute { public func accessKey(_ value: Character) -> TableBody { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -1768,7 +1768,7 @@ public struct TableHead: ContentNode, TableElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -1807,7 +1807,7 @@ public struct TableHead: ContentNode, TableElement { } } -extension TableHead: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, WidthAttribute, HeightAttribute { +extension TableHead: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, WidthAttribute, HeightAttribute { public func accessKey(_ value: Character) -> TableHead { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -2322,7 +2322,7 @@ public struct TableFoot: ContentNode, TableElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -2361,7 +2361,7 @@ public struct TableFoot: ContentNode, TableElement { } } -extension TableFoot: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { +extension TableFoot: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes { public func accessKey(_ value: Character) -> TableFoot { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -2862,7 +2862,7 @@ public struct TableRow: ContentNode, TableElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -2901,7 +2901,7 @@ public struct TableRow: ContentNode, TableElement { } } -extension TableRow: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, WidthAttribute, HeightAttribute, RowIndexAccessibilityAttribute, ColumnIndexAccessibilityAttribute { +extension TableRow: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, WidthAttribute, HeightAttribute, RowIndexAccessibilityAttribute, ColumnIndexAccessibilityAttribute { public func accessKey(_ value: Character) -> TableRow { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -3415,7 +3415,7 @@ public struct DataCell: ContentNode, TableElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -3454,7 +3454,7 @@ public struct DataCell: ContentNode, TableElement { } } -extension DataCell: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ColumnSpanAttribute, RowSpanAttribute, HeadersAttribute, RowSpanAccessibilityAttribute, ColumnSpanAccessibilityAttribute { +extension DataCell: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ColumnSpanAttribute, RowSpanAttribute, HeadersAttribute, RowSpanAccessibilityAttribute, ColumnSpanAccessibilityAttribute { public func accessKey(_ value: Character) -> DataCell { return mutate(accesskey: .init("\(value)", context: .trusted)) @@ -3977,7 +3977,7 @@ public struct HeaderCell: ContentNode, TableElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -4016,7 +4016,7 @@ public struct HeaderCell: ContentNode, TableElement { } } -extension HeaderCell: GlobalAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ColumnSpanAttribute, RowSpanAttribute, HeadersAttribute, ScopeAttribute, ColumnIndexAccessibilityAttribute, AbbreviatedAttribute { +extension HeaderCell: GlobalContentAttributes, GlobalEventAttributes, GlobalAccessibilityAttributes, ColumnSpanAttribute, RowSpanAttribute, HeadersAttribute, ScopeAttribute, ColumnIndexAccessibilityAttribute, AbbreviatedAttribute { public func accessKey(_ value: Character) -> HeaderCell { return mutate(accesskey: .init("\(value)", context: .trusted)) diff --git a/Sources/HTMLKit/Abstraction/Elements/VectorElements.swift b/Sources/HTMLKit/Abstraction/Elements/VectorElements.swift index 40035ae3..0baea664 100644 --- a/Sources/HTMLKit/Abstraction/Elements/VectorElements.swift +++ b/Sources/HTMLKit/Abstraction/Elements/VectorElements.swift @@ -37,7 +37,7 @@ public struct Circle: ContentNode, VectorElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -245,7 +245,7 @@ public struct Rectangle: ContentNode, VectorElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -474,7 +474,7 @@ public struct Ellipse: ContentNode, VectorElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -695,7 +695,7 @@ public struct Line: ContentNode, VectorElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -881,7 +881,7 @@ public struct Polygon: ContentNode, VectorElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -1071,7 +1071,7 @@ public struct Polyline: ContentNode, VectorElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -1261,7 +1261,7 @@ public struct Path: ContentNode, VectorElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context @@ -1639,7 +1639,7 @@ public struct Use: ContentNode, VectorElement { self.content = content() } - internal init(attributes: OrderedDictionary?, context: EscapeContext, content: [Content]) { + internal init(attributes: OrderedDictionary? = nil, context: EscapeContext = .tainted(.html), content: [Content] = []) { self.attributes = attributes self.context = context diff --git a/Sources/HTMLKit/Abstraction/README.md b/Sources/HTMLKit/Abstraction/README.md deleted file mode 100644 index 388e4a3b..00000000 --- a/Sources/HTMLKit/Abstraction/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Abstraction - -This directory contains the HTML abstraction. - -### Attributes - -### Elements - -### Tokens - diff --git a/Sources/HTMLKit/Abstraction/Tokens/EventTokens.swift b/Sources/HTMLKit/Abstraction/Tokens/EventTokens.swift index dc862dc1..f639e26e 100644 --- a/Sources/HTMLKit/Abstraction/Tokens/EventTokens.swift +++ b/Sources/HTMLKit/Abstraction/Tokens/EventTokens.swift @@ -1,11 +1,3 @@ -/* - Abstract: - The file contains serveral enumerations of event attributes. - - Note: - If you about to add something to the file, stick to the official documentation to keep the code consistent. - */ - /// A namespace for several types of events. public enum Events { diff --git a/Sources/HTMLKit/Abstraction/Tokens/ValueTokens.swift b/Sources/HTMLKit/Abstraction/Tokens/ValueTokens.swift index 139cbae7..d25131ce 100644 --- a/Sources/HTMLKit/Abstraction/Tokens/ValueTokens.swift +++ b/Sources/HTMLKit/Abstraction/Tokens/ValueTokens.swift @@ -1257,7 +1257,7 @@ public enum Values { case heading /// Indicates an image set. - case img + case image = "img" /// Indicates an item list. case list @@ -2099,7 +2099,7 @@ public enum Values { case messagingProtocol = "impp" } - /// A enumeration of extra permission + /// An enumeration of extra permission. /// /// ```swift /// InlineFrame { diff --git a/Sources/HTMLKit/Abstraction/Types/SourceCandidate.swift b/Sources/HTMLKit/Abstraction/Types/SourceCandidate.swift index 6a529959..c758d110 100644 --- a/Sources/HTMLKit/Abstraction/Types/SourceCandidate.swift +++ b/Sources/HTMLKit/Abstraction/Types/SourceCandidate.swift @@ -59,10 +59,8 @@ public struct SourceCandidate { } /// Create a source candidate. - /// - /// - Parameters: - /// - source: The url path to load from. - /// - width: The width to apply. + /// + /// - Parameter source: The url path to load from. public init(_ source: String) { self.source = source diff --git a/Sources/HTMLKit/Framework/Builders/ContentBuilder.swift b/Sources/HTMLKit/Framework/Builders/ContentBuilder.swift index 568b10a4..292546ba 100644 --- a/Sources/HTMLKit/Framework/Builders/ContentBuilder.swift +++ b/Sources/HTMLKit/Framework/Builders/ContentBuilder.swift @@ -1,6 +1,3 @@ -// Abstract: -// The file contains the builder to build up the result from a sequence of elements. - /// The builder builds up a result value from a sequence of elements. @resultBuilder public enum ContentBuilder { diff --git a/Sources/HTMLKit/Framework/Environment/Condition.swift b/Sources/HTMLKit/Framework/Environment/Condition.swift index 2fa8c671..5348438e 100644 --- a/Sources/HTMLKit/Framework/Environment/Condition.swift +++ b/Sources/HTMLKit/Framework/Environment/Condition.swift @@ -2,7 +2,7 @@ @_documentation(visibility: internal) public struct Condition { - /// A enumeration of potential comparison + /// An enumeration of potential comparison. public enum Comparison { /// Indicates an equal comparison diff --git a/Sources/HTMLKit/Framework/Environment/Environment.swift b/Sources/HTMLKit/Framework/Environment/Environment.swift index 68ec4301..0dad775d 100644 --- a/Sources/HTMLKit/Framework/Environment/Environment.swift +++ b/Sources/HTMLKit/Framework/Environment/Environment.swift @@ -8,7 +8,7 @@ import NIOConcurrencyHelpers public final class Environment: @unchecked Sendable { /// An enumeration of possible rendering errors. - public enum Errors: Error { + public enum Error: Swift.Error { /// Indicates a casting error. case unableToCastEnvironmentValue @@ -118,11 +118,11 @@ public final class Environment: @unchecked Sendable { internal func resolve(value: EnvironmentValue) throws -> Any { guard let parent = retrieve(for: value.parentPath) else { - throw Errors.environmentObjectNotFound + throw Error.environmentObjectNotFound } guard let value = parent[keyPath: value.valuePath] else { - throw Errors.environmentValueNotFound + throw Error.environmentValueNotFound } return value @@ -136,7 +136,7 @@ public final class Environment: @unchecked Sendable { internal func evaluate(value: EnvironmentValue) throws -> Bool { guard let boolValue = try resolve(value: value) as? Bool else { - throw Errors.unableToCastEnvironmentValue + throw Error.unableToCastEnvironmentValue } return boolValue @@ -283,7 +283,7 @@ public final class Environment: @unchecked Sendable { internal func evaluate(optional: EnvironmentValue) throws -> Bool { guard let optionalValue = try resolve(value: optional) as? Nullable else { - throw Errors.unableToCastEnvironmentValue + throw Error.unableToCastEnvironmentValue } if !optionalValue.isNull { diff --git a/Sources/HTMLKit/Framework/Environment/Relation.swift b/Sources/HTMLKit/Framework/Environment/Relation.swift index fc78dc44..e67b0554 100644 --- a/Sources/HTMLKit/Framework/Environment/Relation.swift +++ b/Sources/HTMLKit/Framework/Environment/Relation.swift @@ -2,7 +2,7 @@ @_documentation(visibility: internal) public struct Relation { - /// A enumeration of potential logical terms + /// An enumeration of potential logical terms. public enum Term { /// Indicates a conjunction diff --git a/Sources/HTMLKit/Framework/Extensions/Datatypes+Content.swift b/Sources/HTMLKit/Framework/Extensions/Datatypes+Content.swift index b20c7978..5e8e91df 100644 --- a/Sources/HTMLKit/Framework/Extensions/Datatypes+Content.swift +++ b/Sources/HTMLKit/Framework/Extensions/Datatypes+Content.swift @@ -1,8 +1,3 @@ -/* - Abstract: - The file contains extensions for some data types. - */ - import Foundation extension Array: Content {} diff --git a/Sources/HTMLKit/Framework/Extensions/Optional+HTMLKit.swift b/Sources/HTMLKit/Framework/Extensions/Optional+HTMLKit.swift index d03bc9c4..a4186c6c 100644 --- a/Sources/HTMLKit/Framework/Extensions/Optional+HTMLKit.swift +++ b/Sources/HTMLKit/Framework/Extensions/Optional+HTMLKit.swift @@ -5,5 +5,4 @@ extension Optional: Nullable { } } -extension Optional: Content { -} +extension Optional: Content {} diff --git a/Sources/HTMLKit/Framework/Localization/InterpolationArgument.swift b/Sources/HTMLKit/Framework/Localization/InterpolationArgument.swift index 415c7513..03102e9a 100644 --- a/Sources/HTMLKit/Framework/Localization/InterpolationArgument.swift +++ b/Sources/HTMLKit/Framework/Localization/InterpolationArgument.swift @@ -26,19 +26,19 @@ public enum InterpolationArgument { internal var placeholder: String { switch self { - case .int(_): + case .int: return "%lld" - case .string(_): + case .string: return "%@" - case .double(_): + case .double: return "%f" - case .float(_): + case .float: return "%f" - case .date(_): + case .date: return "%@" } } diff --git a/Sources/HTMLKit/Framework/Localization/Locale.swift b/Sources/HTMLKit/Framework/Localization/Locale.swift index e3e18679..61adb4ba 100644 --- a/Sources/HTMLKit/Framework/Localization/Locale.swift +++ b/Sources/HTMLKit/Framework/Localization/Locale.swift @@ -1,10 +1,10 @@ -/// A type that represents a locale +/// A type that represents a locale. /// /// A locale holds information about language, region and cultural preferences. @_documentation(visibility: internal) public struct Locale: Hashable, Sendable { - /// A enumeration of potential language tags + /// An enumeration of potential language tags. public enum Tag: String, Sendable { case arabic = "ar" diff --git a/Sources/HTMLKit/Framework/Localization/Localization.swift b/Sources/HTMLKit/Framework/Localization/Localization.swift index 9583e6b8..49ca1ef3 100644 --- a/Sources/HTMLKit/Framework/Localization/Localization.swift +++ b/Sources/HTMLKit/Framework/Localization/Localization.swift @@ -4,8 +4,8 @@ import Foundation @_documentation(visibility: internal) public struct Localization: Sendable { - /// A enumeration of errors regarding the localization rendering - public enum Errors: Error, Equatable { + /// An enumeration of errors regarding the localization rendering. + public enum Error: Swift.Error, Equatable { /// Indicates a missing key /// @@ -207,27 +207,27 @@ public struct Localization: Sendable { public func localize(string: LocalizedString, for locale: Locale? = nil) throws -> String { guard let fallback = self.locale else { - throw Errors.noFallback + throw Error.noFallback } guard let localizationTables = self.tables else { - throw Errors.missingTables + throw Error.missingTables } let currentLocale = locale ?? fallback guard let translationTables = localizationTables[currentLocale] else { - throw Errors.missingTable(currentLocale.tag) + throw Error.missingTable(currentLocale.tag) } if let table = string.table { guard let translationTable = translationTables.first(where: { $0.name == table }) else { - throw Errors.unknownTable(table, currentLocale.tag) + throw Error.unknownTable(table, currentLocale.tag) } guard var translation = translationTable.retrieve(for: string.key.value) else { - throw Errors.missingKey(string.key.value, currentLocale.tag) + throw Error.missingKey(string.key.value, currentLocale.tag) } if let interpolation = string.key.interpolation { @@ -250,7 +250,7 @@ public struct Localization: Sendable { } } - throw Errors.missingKey(string.key.value, currentLocale.tag) + throw Error.missingKey(string.key.value, currentLocale.tag) } /// Recovers from an error. @@ -260,13 +260,13 @@ public struct Localization: Sendable { /// - string: The string to localize /// /// - Returns: The translation or the string literal - internal func recover(from priorError: Errors, with string: LocalizedString) throws -> String { + internal func recover(from priorError: Error, with string: LocalizedString) throws -> String { do { return try localize(string: string) - } catch let error as Errors { + } catch let error as Error { switch error { case .missingKey where error != priorError: diff --git a/Sources/HTMLKit/Framework/Primitives/Attributes/Attribute.swift b/Sources/HTMLKit/Framework/Primitives/Attributes/Attribute.swift index 5cf10986..287583bb 100644 --- a/Sources/HTMLKit/Framework/Primitives/Attributes/Attribute.swift +++ b/Sources/HTMLKit/Framework/Primitives/Attributes/Attribute.swift @@ -1,8 +1,3 @@ -/* - Abstract: - The file contains the default definition of an attribute. It defines which properties and methods an attribute should come with. A attribute is a part of a element and is contained in a node. - */ - import OrderedCollections /// A type that represents any html-attribute. diff --git a/Sources/HTMLKit/Framework/Primitives/Attributes/AttributeData.swift b/Sources/HTMLKit/Framework/Primitives/Attributes/AttributeData.swift index 07f7c313..50b9c012 100644 --- a/Sources/HTMLKit/Framework/Primitives/Attributes/AttributeData.swift +++ b/Sources/HTMLKit/Framework/Primitives/Attributes/AttributeData.swift @@ -31,10 +31,10 @@ public struct AttributeData { } /// The context of the data. - internal var context: EscapeContext + internal let context: EscapeContext /// The value of the data. - internal var value: Value + internal let value: Value /// Create a string attribute. /// diff --git a/Sources/HTMLKit/Framework/Primitives/Elements/Elements.swift b/Sources/HTMLKit/Framework/Primitives/Elements/Elements.swift index df26d6e2..f5772801 100644 --- a/Sources/HTMLKit/Framework/Primitives/Elements/Elements.swift +++ b/Sources/HTMLKit/Framework/Primitives/Elements/Elements.swift @@ -1,8 +1,3 @@ -/* - Abstract: - The file contains the default definition of different elements. - */ - @_documentation(visibility: internal) public typealias GlobalElement = BodyElement & DescriptionElement & FigureElement & FormElement & BasicElement & HeadElement & ListElement & MapElement & MediaElement & ObjectElement & RubyElement & TableElement & HtmlElement & InputElement & VectorElement diff --git a/Sources/HTMLKit/Framework/Primitives/Layouts/Layouts.swift b/Sources/HTMLKit/Framework/Primitives/Layouts/Layouts.swift index 9055bd0c..198773a4 100644 --- a/Sources/HTMLKit/Framework/Primitives/Layouts/Layouts.swift +++ b/Sources/HTMLKit/Framework/Primitives/Layouts/Layouts.swift @@ -1,8 +1,3 @@ -/* - Abstract: - The file contains the default definition of different types of layouts. - */ - /// A type that defines a view layout. public protocol View: GlobalElement { diff --git a/Sources/HTMLKit/Framework/Primitives/Nodes/Node.swift b/Sources/HTMLKit/Framework/Primitives/Nodes/Node.swift index eac6bc91..e06540f8 100644 --- a/Sources/HTMLKit/Framework/Primitives/Nodes/Node.swift +++ b/Sources/HTMLKit/Framework/Primitives/Nodes/Node.swift @@ -1,9 +1,3 @@ -/* - Abstract: - The file contains the default definition of a node. It defines which properties and methods a node should come with. - */ - /// A type that represents any html-node. @_documentation(visibility: internal) -public protocol Node { -} +public protocol Node {} diff --git a/Sources/HTMLKit/Framework/Primitives/Nodes/Nodes.swift b/Sources/HTMLKit/Framework/Primitives/Nodes/Nodes.swift index ccd6ffcd..eab80e43 100644 --- a/Sources/HTMLKit/Framework/Primitives/Nodes/Nodes.swift +++ b/Sources/HTMLKit/Framework/Primitives/Nodes/Nodes.swift @@ -1,8 +1,3 @@ -/* - Abstract: - The file contains the default definition of different nodes. - */ - import OrderedCollections /// A type that defines a node with content. diff --git a/Sources/HTMLKit/Framework/Primitives/Shared/Content.swift b/Sources/HTMLKit/Framework/Primitives/Shared/Content.swift index fab256ef..7f257edf 100644 --- a/Sources/HTMLKit/Framework/Primitives/Shared/Content.swift +++ b/Sources/HTMLKit/Framework/Primitives/Shared/Content.swift @@ -1,9 +1,2 @@ -/* - Abstract: - The file contains the default definition of the content. It defines which properties and methods a content should come with. - */ - -import Foundation - /// A type that represents any html-content. public protocol Content {} diff --git a/Sources/HTMLKit/Framework/README.md b/Sources/HTMLKit/Framework/README.md deleted file mode 100644 index 7ec64b69..00000000 --- a/Sources/HTMLKit/Framework/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Framework - -This directory contains sources for - -### Builders - -### Environment - -### Extensions - -### Helpers - -### Localization - -### Primitives - -### Rendering diff --git a/Sources/HTMLKit/Framework/Rendering/Encoding/Encoder.swift b/Sources/HTMLKit/Framework/Rendering/Encoding/Encoder.swift index ca537462..f9bd3fc9 100644 --- a/Sources/HTMLKit/Framework/Rendering/Encoding/Encoder.swift +++ b/Sources/HTMLKit/Framework/Rendering/Encoding/Encoder.swift @@ -32,7 +32,7 @@ internal struct Encoder: Sendable { case js(Context) /// The characters to replace based on the mechanism and context - var characters: Set { + internal var characters: Set { switch self { case .html(let context): @@ -68,7 +68,7 @@ internal struct Encoder: Sendable { } /// The characters to replace with based on the mechanism - var replacements: [Unicode.Scalar: String] { + internal var replacements: [Unicode.Scalar: String] { return ["&": "&", "<": "<", ">": ">", "\"": """, "'": "'"] } } diff --git a/Sources/HTMLKit/Framework/Rendering/Renderer.swift b/Sources/HTMLKit/Framework/Rendering/Renderer.swift index 9353c50f..e765f5dd 100644 --- a/Sources/HTMLKit/Framework/Rendering/Renderer.swift +++ b/Sources/HTMLKit/Framework/Rendering/Renderer.swift @@ -21,7 +21,7 @@ import Logging @_documentation(visibility: internal) public struct Renderer: Sendable { - /// A enumeration of potential errors during rendering + /// An enumeration of potential errors during rendering. public enum Error: Swift.Error { /// Indicates a unknown conten type @@ -44,25 +44,25 @@ public struct Renderer: Sendable { } /// The context environment used during rendering - private var environment: Environment + private let environment: Environment /// The localization configuration - private var localization: Localization? + private let localization: Localization? /// The markdown parser - private var markdown: Markdown + private let markdown: Markdown /// The feature flag used to manage the visibility of new and untested features - private var features: Features + private let features: Features /// The logger used to log all operations - private var logger: Logger + private let logger: Logger /// The encoder used to encode html entities - private var encoder: Encoder + private let encoder: Encoder /// The sanitizer used to clean up html output - private var sanitizer: Sanitizer + private let sanitizer: Sanitizer /// Initializes the renderer /// @@ -321,7 +321,7 @@ public struct Renderer: Sendable { return try localization.localize(string: string, for: environment.locale) - } catch let error as Localization.Errors { + } catch let error as Localization.Error { logger.warning("\(error.description)") @@ -593,7 +593,7 @@ public struct Renderer: Sendable { let value = try environment.resolve(value: loop.value) guard let sequence = value as? (any Swift.Sequence) else { - throw Environment.Errors.unableToCastEnvironmentValue + throw Environment.Error.unableToCastEnvironmentValue } for value in sequence { diff --git a/Sources/HTMLKitComponents/Components/Symbol.swift b/Sources/HTMLKitComponents/Components/Symbol.swift index dd09988a..56f9e484 100644 --- a/Sources/HTMLKitComponents/Components/Symbol.swift +++ b/Sources/HTMLKitComponents/Components/Symbol.swift @@ -1,8 +1,3 @@ -/* - Abstract: - The file contains everything related to the symbol component. - */ - import Foundation import HTMLKit import OrderedCollections diff --git a/Sources/HTMLKitConverter/Parser.swift b/Sources/HTMLKitConverter/Parser.swift index b6526a19..b62a401a 100644 --- a/Sources/HTMLKitConverter/Parser.swift +++ b/Sources/HTMLKitConverter/Parser.swift @@ -10,8 +10,8 @@ internal class Parser { internal enum ParserError: Error { case noLocalName - case unkownElement(String) - case unkownAttribute(String) + case unknownElement(String) + case unknownAttribute(String) case unknownTag(String) var description: String { @@ -20,11 +20,11 @@ internal class Parser { case .noLocalName: return "No local name." - case .unkownElement(let element): - return "Element '\(element) not found." + case .unknownElement(let element): + return "Element '\(element)' not found." - case .unkownAttribute(let attribute): - return "Attribute '\(attribute) not found." + case .unknownAttribute(let attribute): + return "Attribute '\(attribute)' not found." case .unknownTag(let tag): return "Tag '\(tag)' not found." @@ -412,7 +412,7 @@ internal class Parser { return try ContentElement(element: element, indent: indent).build(verbatim: "Vector") default: - throw ParserError.unkownElement(localName) + throw ParserError.unknownElement(localName) } } @@ -1196,7 +1196,7 @@ internal class Parser { return try ValueAttribute(node: node, kind: .aria).build(verbatim: "valueText") default: - throw ParserError.unkownAttribute(localName) + throw ParserError.unknownAttribute(localName) } default: diff --git a/Sources/HTMLKitVapor/Extensions/Vapor+HTMLKit.swift b/Sources/HTMLKitVapor/Extensions/Vapor+HTMLKit.swift index c974e1b3..edbcabc6 100644 --- a/Sources/HTMLKitVapor/Extensions/Vapor+HTMLKit.swift +++ b/Sources/HTMLKitVapor/Extensions/Vapor+HTMLKit.swift @@ -48,7 +48,7 @@ extension Application { } /// The key used to store the configuration in Vapor's storage - internal struct ConfigurationKey: StorageKey { + private struct ConfigurationKey: StorageKey { public typealias Value = Configuration } @@ -117,7 +117,7 @@ extension HTMLKit.Renderer.Error: DebuggableError { public var debuggableReason: String { description } } -extension HTMLKit.Environment.Errors: AbortError { +extension HTMLKit.Environment.Error: AbortError { @_implements(AbortError, reason) public var abortReason: String { description } @@ -125,13 +125,13 @@ extension HTMLKit.Environment.Errors: AbortError { public var status: HTTPResponseStatus { .internalServerError } } -extension HTMLKit.Environment.Errors: DebuggableError { +extension HTMLKit.Environment.Error: DebuggableError { @_implements(DebuggableError, reason) public var debuggableReason: String { description } } -extension HTMLKit.Localization.Errors: AbortError { +extension HTMLKit.Localization.Error: AbortError { @_implements(AbortError, reason) public var abortReason: String { description } @@ -139,7 +139,7 @@ extension HTMLKit.Localization.Errors: AbortError { public var status: HTTPResponseStatus { .internalServerError } } -extension HTMLKit.Localization.Errors: DebuggableError { +extension HTMLKit.Localization.Error: DebuggableError { @_implements(DebuggableError, reason) public var debuggableReason: String { description } diff --git a/Sources/HTMLKitVapor/ViewRenderer.swift b/Sources/HTMLKitVapor/ViewRenderer.swift index bc8be3f0..c6b63bf7 100644 --- a/Sources/HTMLKitVapor/ViewRenderer.swift +++ b/Sources/HTMLKitVapor/ViewRenderer.swift @@ -5,13 +5,13 @@ import Vapor public struct ViewRenderer: Sendable { /// The event loop that the renderer operates on - internal var eventLoop: EventLoop + internal let eventLoop: EventLoop /// The actual renderer - internal var renderer: Renderer + internal let renderer: Renderer /// The logger used to log all operations - private var logger: Logger + private let logger: Logger /// Initializes the view renderer /// diff --git a/Sources/Utilities/Minifier/Tokenization/Javascript/Javascript.swift b/Sources/Utilities/Minifier/Tokenization/Javascript/Javascript.swift index b5c6f33e..90db1d51 100644 --- a/Sources/Utilities/Minifier/Tokenization/Javascript/Javascript.swift +++ b/Sources/Utilities/Minifier/Tokenization/Javascript/Javascript.swift @@ -1,6 +1,6 @@ internal class Javascript { - /// A enumeration of different states of the minifier + /// An enumeration of different states of the minifier. /// /// Code is the initial state. internal enum InsertionMode: String { @@ -17,7 +17,7 @@ internal class Javascript { case numeric } - /// A enumeration of different level of the logging + /// An enumeration of different level of the logging /// /// None is the initial state. internal enum LogLevel { @@ -452,7 +452,7 @@ extension Javascript { internal class WhitespaceToken: Token { - /// A enumeration of the variations of comment tokens + /// An enumeration of the variations of comment tokens internal enum TokenType { /// Indicates a single line comment @@ -490,7 +490,7 @@ extension Javascript { /// A type that represents a javascript comment internal class CommentToken: Token { - /// A enumeration of the variations of comment tokens + /// An enumeration of the variations of comment tokens. internal enum TokenType { /// Indicates a single line comment @@ -535,7 +535,7 @@ extension Javascript { /// A type that represents a javascript literal internal class LiteralToken: Token { - /// A enumeration of the variations of literal tokens + /// An enumeration of the variations of literal tokens, internal enum TokenType { /// Indiciates a boolean literal @@ -589,7 +589,7 @@ extension Javascript { /// A type that represents a format control token internal class FormatToken: Token { - /// A enumeration of the variation of format tokens + /// An enumeration of the variation of format tokens. internal enum TokenType { /// Indicates a punctiation @@ -624,7 +624,7 @@ extension Javascript { /// A type that represents a word token internal class WordToken: Token { - /// A enumeration of the variations of word tokens + /// An enumeration of the variations of word tokens. internal enum TokenType { /// Indicates a reserved word diff --git a/Sources/Utilities/Minifier/Tokenization/Stylesheet/Stylesheet.swift b/Sources/Utilities/Minifier/Tokenization/Stylesheet/Stylesheet.swift index dab83f4d..d4cf4a0d 100644 --- a/Sources/Utilities/Minifier/Tokenization/Stylesheet/Stylesheet.swift +++ b/Sources/Utilities/Minifier/Tokenization/Stylesheet/Stylesheet.swift @@ -1,6 +1,6 @@ internal class Stylesheet { - /// A enumeration of different states of the minifier + /// An enumeration of different states of the minifier. /// /// Code is the initial state. internal enum InsertionMode: String { @@ -23,7 +23,7 @@ internal class Stylesheet { case argument } - /// A enumeration of different level of the logging + /// An enumeration of different level of the logging. /// /// None is the initial state. internal enum LogLevel { @@ -184,10 +184,10 @@ internal class Stylesheet { self.mode = consumeStringValue(character.element) case .unidentified: - self.mode = consumeUnkown(character.element) + self.mode = consumeUnknown(character.element) case .afterunidentified: - self.mode = consumeAfterUnkown(character.element) + self.mode = consumeAfterUnknown(character.element) case .string: self.mode = consumeStringLiteral(character.element) @@ -622,7 +622,7 @@ internal class Stylesheet { } /// Consumes a unidentified character sequence - internal func consumeUnkown(_ character: Character) -> InsertionMode { + internal func consumeUnknown(_ character: Character) -> InsertionMode { self.verbose(function: #function, character: character) @@ -647,7 +647,7 @@ internal class Stylesheet { return .unidentified } - func consumeAfterUnkown(_ character: Character) -> InsertionMode { + func consumeAfterUnknown(_ character: Character) -> InsertionMode { self.verbose(function: #function, character: character) @@ -784,7 +784,7 @@ extension Stylesheet { internal class WhitespaceToken: Token { - /// A enumeration of the variations of comment tokens + /// An enumeration of the variations of comment tokens internal enum TokenType { /// Indicates a single line comment @@ -822,7 +822,7 @@ extension Stylesheet { /// A type that represents a css comment internal class CommentToken: Token { - /// A enumeration of the variations of comment tokens + /// An enumeration of the variations of comment tokens. internal enum TokenType { /// Indicates a single line comment @@ -861,7 +861,7 @@ extension Stylesheet { /// A type that represents a css comment internal class SelectorToken: Token { - /// A enumeration of the variations of comment tokens + /// An enumeration of the variations of comment tokens. internal enum TokenType { /// Indicates the set is about an type @@ -930,7 +930,7 @@ extension Stylesheet { /// A type that represents a format control token internal class FormatToken: Token { - /// A enumeration of the variation of format tokens + /// An enumeration of the variation of format tokens. internal enum TokenType { /// Indicates a punctiation @@ -968,7 +968,7 @@ extension Stylesheet { /// A type that represents a format control token internal class PropertyToken: Token { - /// A enumeration of the variation of format tokens + /// An enumeration of the variation of format tokens. internal enum TokenType { /// Indicates a regular property @@ -1013,7 +1013,7 @@ extension Stylesheet { /// A type that represents a format control token internal class ValueToken: Token { - /// A enumeration of the variation of format tokens + /// An enumeration of the variation of format tokens. internal enum TokenType { /// Indicates a punctiation diff --git a/Tests/HTMLKitTests/AttributesTests.swift b/Tests/HTMLKitTests/AttributesTests.swift index 3a68ccb9..aafc46bf 100644 --- a/Tests/HTMLKitTests/AttributesTests.swift +++ b/Tests/HTMLKitTests/AttributesTests.swift @@ -1,8 +1,3 @@ -/* - Abstract: - The file tests the rendering of the attributes. - */ - @testable import HTMLKit import Foundation import OrderedCollections diff --git a/Tests/HTMLKitTests/ContextTests.swift b/Tests/HTMLKitTests/ContextTests.swift index 6da66865..0b6a23c8 100644 --- a/Tests/HTMLKitTests/ContextTests.swift +++ b/Tests/HTMLKitTests/ContextTests.swift @@ -1,8 +1,3 @@ -/* - Abstract: - The file tests the annotations. - */ - import HTMLKit import XCTest diff --git a/Tests/HTMLKitTests/ElementTests.swift b/Tests/HTMLKitTests/ElementTests.swift index d7c2e4e6..ce8506c9 100644 --- a/Tests/HTMLKitTests/ElementTests.swift +++ b/Tests/HTMLKitTests/ElementTests.swift @@ -1,1694 +1,401 @@ -/* - Abstract: - The file tests the rendering of the elements. - */ - -import HTMLKit +@testable import HTMLKit import XCTest final class ElementTests: XCTestCase { - struct TestView: View { - - @ContentBuilder var body: Content - } - - var renderer = Renderer() - - func testHeadElement() throws { - - let view = TestView { - Head {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testTitleElement() throws { - - let view = TestView { - Title {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testBaseElement() throws { - - let view = TestView { - Base() - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testLinkElement() throws { - - let view = TestView { - Link() - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testMetaElement() throws { - - let view = TestView { - Meta() - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testStyleElement() throws { - - let view = TestView { - Style {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testHtmlElement() throws { - - let view = TestView { - Html {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testBodyElement() throws { - - let view = TestView { - Body {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testArticleElement() throws { - - let view = TestView { - Article {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
- """ - ) - } - - func testSectionElement() throws { - - let view = TestView { - Section {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
- """ - ) - } - - func testNavigationElement() throws { - - let view = TestView { - Navigation {} - Nav {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testAsideElement() throws { - - let view = TestView { - Aside {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testHeading1Element() throws { - - let view = TestView { - Heading1 {} - H1 {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -

\ -

- """ - ) - } - - func testHeading2Element() throws { - - let view = TestView { - Heading2 {} - H2 {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -

\ -

- """ - ) - } - - func testHeading3Element() throws { - - let view = TestView { - Heading3 {} - H3 {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -

\ -

- """ - ) - } - - func testHeading4Element() throws { - - let view = TestView { - Heading4 {} - H4 {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -

\ -

- """ - ) - } - - func testHeading5Element() throws { - - let view = TestView { - Heading5 {} - H5 {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
\ -
- """ - ) - } - - func testHeading6Element() throws { - - let view = TestView { - Heading6 {} - H6 {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
\ -
- """ - ) - } - - func testHeadingGroupElement() throws { - - let view = TestView { - HeadingGroup {} - Hgroup {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
\ -
- """ - ) - } - - func testHeaderElement() throws { - - let view = TestView { - Header {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
- """ - ) - } - - func testFooterElement() throws { - - let view = TestView { - Footer {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
- """ - ) - } - - func testAdressElement() throws { - - let view = TestView { - Address {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
- """ - ) - } - - func testParagraphElement() throws { - - let view = TestView { - Paragraph {} - P {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -

\ -

- """ - ) - } - - func testHorizontalRuleElement() throws { - - let view = TestView { - HorizontalRule() - Hr() - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
\ -
- """ - ) - } - - func testPreformattedTextElement() throws { - - let view = TestView { - PreformattedText {} - Pre {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
\
-                       

-                       """
-        )
-    }
-    
-    func testBlockquoteElement() throws {
-        
-        let view = TestView {
-            Blockquote {}
-        }
-        
-        XCTAssertEqual(try renderer.render(view: view),
-                       """
-                       
- """ - ) - } - - func testOrderedListElement() throws { - - let view = TestView { - OrderedList {} - Ol {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
    \ -
      - """ - ) - } - - func testUnorderedListElement() throws { - - let view = TestView { - UnorderedList {} - Ul {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
        \ -
          - """ - ) - } - - func testMenuElement() throws { - - let view = TestView { - Menu {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testListItemElement() throws { - - let view = TestView { - ListItem {} - Li {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
        • \ -
        • - """ - ) - } - - func testDescriptionListElement() throws { - - let view = TestView { - DescriptionList {} - Dl {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
          \ -
          - """ - ) - } - - func testTermNameElement() throws { - - let view = TestView { - TermName {} - Dt {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
          \ -
          - """ - ) - } - - func testTermDefinitionElement() throws { - - let view = TestView { - TermDefinition {} - Dd {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
          \ -
          - """ - ) - } - - func testFigureElement() throws { - - let view = TestView { - Figure {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
          - """ - ) - } - - func testFigureCaptionElement() throws { - - let view = TestView { - FigureCaption {} - Figcaption {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
          \ -
          - """ - ) - } - - func testMainElement() throws { - - let view = TestView { - Main {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
          - """ - ) - } - - func testSearchElement() throws { - - let view = TestView { - Search {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testDivisionElement() throws { - - let view = TestView { - Division {} - Div {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
          \ -
          - """ - ) - } - - func testAnchorElement() throws { - - let view = TestView { - Anchor {} - A {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testEmphasizeElement() throws { - - let view = TestView { - Emphasize{} - Em {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testStrongElement() throws { - - let view = TestView { - Strong {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testSmallElement() throws { - - let view = TestView { - Small {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testStrikeThroughElement() throws { - - let view = TestView { - StrikeThrough {} - S {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testCiteElement() throws { - - let view = TestView { - Cite {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testShortQuoteElement() throws { - - let view = TestView { - ShortQuote {} - Q {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testDefinitionElement() throws { - - let view = TestView { - Definition {} - Dfn {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testAbbreviationElement() throws { - - let view = TestView { - Abbreviation {} - Abbr {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testRubyElement() throws { - - let view = TestView { - Ruby {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testRubyTextElement() throws { - - let view = TestView { - RubyText {} - Rt {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testRubyPronunciationElement() throws { + /// Tests the correct syntax for the content nodes. + func testContentNodeSyntax() throws { + + let names: [String] = [ + "head", + "title", + "style", + "html", + "body", + "article", + "section", + "nav", + "aside", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "hgroup", + "header", + "footer", + "address", + "p", + "pre", + "blockquote", + "ol", + "ul", + "menu", + "li", + "dl", + "dt", + "dd", + "figure", + "figcaption", + "main", + "search", + "a", + "em", + "strong", + "small", + "s", + "cite", + "q", + "dfn", + "abbr", + "ruby", + "rt", + "rp", + "data", + "time", + "code", + "var", + "samp", + "kbd", + "sub", + "sup", + "i", + "b", + "u", + "mark", + "bdi", + "span", + "ins", + "del", + "picture", + "iframe", + "object", + "video", + "audio", + "map", + "table", + "caption", + "colgroup", + "tbody", + "thead", + "tfoot", + "tr", + "td", + "th", + "form", + "label", + "button", + "datalist", + "optgroup", + "option", + "textarea", + "output", + "progress", + "meter", + "fieldset", + "legend", + "details", + "summary", + "dialog", + "script", + "noscript", + "template", + "canvas", + "svg", + "circle", + "rect", + "ellipse", + "line", + "polygon", + "polyline", + "path", + "use", + "slot" + ] + + let nodes: [any ContentNode] = [ + Head(), + Title(), + Style(), + Html(), + Body(), + Article(), + Section(), + Navigation(), + Aside(), + Heading1(), + Heading2(), + Heading3(), + Heading4(), + Heading5(), + Heading6(), + HeadingGroup(), + Header(), + Footer(), + Address(), + Paragraph(), + PreformattedText(), + Blockquote(), + OrderedList(), + UnorderedList(), + Menu(), + ListItem(), + DescriptionList(), + TermName(), + TermDefinition(), + Figure(), + FigureCaption(), + Main(), + Search(), + Anchor(), + Emphasize(), + Strong(), + Small(), + StrikeThrough(), + Cite(), + ShortQuote(), + Definition(), + Abbreviation(), + Ruby(), + RubyText(), + RubyPronunciation(), + Data(), + Time(), + Code(), + Variable(), + SampleOutput(), + KeyboardInput(), + Subscript(), + Superscript(), + Italic(), + Bold(), + Underline(), + Mark(), + Bdi(), + Span(), + InsertedText(), + DeletedText(), + Picture(), + InlineFrame(), + Object(), + Video(), + Audio(), + Map(), + Table(), + Caption(), + ColumnGroup(), + TableBody(), + TableHead(), + TableFoot(), + TableRow(), + DataCell(), + HeaderCell(), + Form(), + Label(), + Button(), + DataList(), + OptionGroup(), + Option(), + TextArea(), + Output(), + Progress(), + Meter(), + Fieldset(), + Legend(), + Details(), + Summary(), + Dialog(), + Script(), + NoScript(), + Template(), + Canvas(), + Vector(), + Circle(), + Rectangle(), + Ellipse(), + Line(), + Polygon(), + Polyline(), + Path(), + Use(), + Slot() + ] + + for (index, node) in nodes.enumerated() { + XCTAssertEqual(node.name, names[index]) + } + } + + /// Tests the correct syntax for the empty nodes. + func testEmptyNodeSyntax() throws { + + let names: [String] = [ + "base", + "link", + "meta", + "hr", + "bdo", + "br", + "wbr", + "source", + "img", + "embed", + "track", + "area", + "col", + "input" + ] + + let nodes: [any EmptyNode] = [ + Base(), + Link(), + Meta(), + HorizontalRule(), + Bdo(), + LineBreak(), + WordBreak(), + Source(), + Image(), + Embed(), + Track(), + Area(), + Column(), + Input() + ] + + for (index, node) in nodes.enumerated() { + XCTAssertEqual(node.name, names[index]) + } + } + + /// Tests whether the typealias references the correct underlying type. + func testContentNodeAlias() throws { + + let names: [String] = [ + "nav", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "hgroup", + "p", + "pre", + "ol", + "ul", + "li", + "dl", + "dt", + "dd", + "figcaption", + "a", + "em", + "s", + "q", + "dfn", + "abbr", + "rt", + "rp", + "var", + "samp", + "kbd", + "sub", + "sup", + "i", + "b", + "u", + "ins", + "del", + "iframe", + "colgroup", + "tbody", + "thead", + "tfoot", + "tr", + "td", + "th", + "optgroup", + "svg", + "rect" + ] + + let nodes: [any ContentNode] = [ + Nav(), + H1(), + H2(), + H3(), + H4(), + H5(), + H6(), + Hgroup(), + P(), + Pre(), + Ol(), + Ul(), + Li(), + Dl(), + Dt(), + Dd(), + Figcaption(), + A(), + Em(), + S(), + Q(), + Dfn(), + Abbr(), + Rt(), + Rp(), + Var(), + Samp(), + Kbd(), + Sub(), + Sup(), + I(), + B(), + U(), + Ins(), + Del(), + Iframe(), + Colgroup(), + Tbody(), + Thead(), + Tfoot(), + Tr(), + Td(), + Th(), + Optgroup(), + Svg(), + Rect() + ] + + for (index, node) in nodes.enumerated() { + XCTAssertEqual(node.name, names[index]) + } + } + + /// Tests whether the typealias references the correct underlying type. + func testEmptyNodeAlias() throws { + + let names: [String] = [ + "hr", + "br", + "wbr", + "img", + "col" + ] + + let nodes: [any EmptyNode] = [ + Hr(), + Br(), + Wbr(), + Img(), + Col() + ] - let view = TestView { - RubyPronunciation {} - Rp {} + for (index, node) in nodes.enumerated() { + XCTAssertEqual(node.name, names[index]) } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testDataElement() throws { - - let view = TestView { - HTMLKit.Data {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testTimeElement() throws { - - let view = TestView { - Time {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testCodeElement() throws { - - let view = TestView { - Code {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testVariableElement() throws { - - let view = TestView { - Variable {} - V {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testSampleOutputElement() throws { - - let view = TestView { - SampleOutput {} - Samp {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testKeyboardInputElement() throws { - - let view = TestView { - KeyboardInput {} - Kbd {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testSubscriptElement() throws { - - let view = TestView { - Subscript {} - Sub {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testSuperscriptElement() throws { - - let view = TestView { - Superscript {} - Sup {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testItalicElement() throws { - - let view = TestView { - Italic {} - I {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testBoldElement() throws { - - let view = TestView { - Bold {} - B {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testUnderlineElement() throws { - - let view = TestView { - Underline {} - U {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testMarkElement() throws { - - let view = TestView { - Mark {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testBdiElement() throws { - - let view = TestView { - Bdi {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testBdoElement() throws { - - let view = TestView { - Bdo() - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testSpanElement() throws { - - let view = TestView { - Span {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testLineBreakElement() throws { - - let view = TestView { - LineBreak() - Br() - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
          \ -
          - """ - ) - } - - func testWordBreakElement() throws { - - let view = TestView { - WordBreak() - Wbr() - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testInsertedTextElement() throws { - - let view = TestView { - InsertedText {} - Ins {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testDeletedTextElement() throws { - - let view = TestView { - DeletedText {} - Del {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testPictureElement() throws { - - let view = TestView { - HTMLKit.Picture{} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testSourceElement() throws { - - let view = TestView { - Source() - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testImageElement() throws { - - let view = TestView { - Image() - Img() - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testInlineFrameElement() throws { - - let view = TestView { - InlineFrame {} - Iframe {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testEmbedElement() throws { - - let view = TestView { - Embed() - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testObjectElement() throws { - - let view = TestView { - Object {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testVideoElement() throws { - - let view = TestView { - Video {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testAudioElement() throws { - - let view = TestView { - Audio {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testTrackElement() throws { - - let view = TestView { - Track() - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testMapElement() throws { - - let view = TestView { - Map {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testAreaElement() throws { - - let view = TestView { - Area() - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testTableElement() throws { - - let view = TestView { - Table {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
          - """ - ) - } - - func testCaptionElement() throws { - - let view = TestView { - Caption {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testColumnGroupElement() throws { - - let view = TestView { - ColumnGroup {} - Colgroup {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testColumnElement() throws { - - let view = TestView { - Column() - Col() - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testTableBodyElement() throws { - - let view = TestView { - TableBody {} - Tbody {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testTableHeadElement() throws { - - let view = TestView { - TableHead {} - Thead {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testTableFootElement() throws { - - let view = TestView { - TableFoot {} - Tfoot {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testTableRowElement() throws { - - let view = TestView { - TableRow {} - Tr {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testDataCellElement() throws { - - let view = TestView { - DataCell {} - Td {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testHeaderCellElement() throws { - - let view = TestView { - HeaderCell {} - Th {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testFormElement() throws { - - let view = TestView { - Form {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
          - """ - ) - } - - func testLabelElement() throws { - - let view = TestView { - Label{} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testInputElement() throws { - - let view = TestView { - Input() - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testButtonElement() throws { - - let view = TestView { - Button {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testDataListElement() throws { - - let view = TestView { - DataList {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testOptionGroupElement() throws { - - let view = TestView { - OptionGroup {} - Optgroup {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testOptionElement() throws { - - let view = TestView { - Option {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testTextAreaElement() throws { - - let view = TestView { - TextArea {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testOutputElement() throws { - - let view = TestView { - Output {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testProgressElement() throws { - - let view = TestView { - HTMLKit.Progress {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testMeterElement() throws { - - let view = TestView { - Meter {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testFieldsetElement() throws { - - let view = TestView { - Fieldset {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
          - """ - ) - } - - func testLegendElement() throws { - - let view = TestView { - Legend {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testDetailsElement() throws { - - let view = TestView { - Details {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ -
          - """ - ) - } - - func testSummaryElement() throws { - - let view = TestView { - Summary {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testDialogElement() throws { - - let view = TestView { - Dialog {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testScriptElement() throws { - - let view = TestView { - Script {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testNoScriptElement() throws { - - let view = TestView { - NoScript {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testTemplateElement() throws { - - let view = TestView { - Template {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testCanvasElement() throws { - - let view = TestView { - Canvas {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testVectorElement() throws { - - let view = TestView { - Vector {} - Svg {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testCircleElement() throws { - - let view = TestView { - Circle {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testRectangleElement() throws { - - let view = TestView { - Rectangle {} - Rect {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - \ - - """ - ) - } - - func testEllipseElement() throws { - - let view = TestView { - Ellipse {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testLineElement() throws { - - let view = TestView { - Line {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testPolygonElement() throws { - - let view = TestView { - Polygon {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testPolylineElement() throws { - - let view = TestView { - Polyline {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testPathElement() throws { - - let view = TestView { - Path {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testUseElement() throws { - - let view = TestView { - Use {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testSlotElement() throws { - - let view = TestView { - Slot {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) - } - - func testCustomElement() throws { - - let view = TestView { - Custom(name: "custom") {} - } - - XCTAssertEqual(try renderer.render(view: view), - """ - - """ - ) } } diff --git a/Tests/HTMLKitTests/LocalizationTests.swift b/Tests/HTMLKitTests/LocalizationTests.swift index 1ae839d9..4780ffcc 100644 --- a/Tests/HTMLKitTests/LocalizationTests.swift +++ b/Tests/HTMLKitTests/LocalizationTests.swift @@ -58,7 +58,7 @@ final class LocalizationTests: XCTestCase { XCTAssertThrowsError(try localization!.localize(string: .init(key: "unknown.key")), "unknown.key") { error in - guard let localizationError = error as? Localization.Errors else { + guard let localizationError = error as? Localization.Error else { return XCTFail("Unexpected error type: \(error)") } @@ -75,7 +75,7 @@ final class LocalizationTests: XCTestCase { XCTAssertThrowsError(try localization!.localize(string: .init(key: "hello.world"), for: .init(tag: "unknown.tag"))) { error in - guard let localizationError = error as? Localization.Errors else { + guard let localizationError = error as? Localization.Error else { return XCTFail("Unexpected error type: \(error)") } @@ -92,7 +92,7 @@ final class LocalizationTests: XCTestCase { XCTAssertThrowsError(try localization!.localize(string: .init(key: "hello.world", table: "unknown.table"))) { error in - guard let localizationError = error as? Localization.Errors else { + guard let localizationError = error as? Localization.Error else { return XCTFail("Unexpected error type: \(error)") } diff --git a/Tests/HTMLKitTests/PerformanceTests.swift b/Tests/HTMLKitTests/PerformanceTests.swift index a0869274..0dce35c1 100644 --- a/Tests/HTMLKitTests/PerformanceTests.swift +++ b/Tests/HTMLKitTests/PerformanceTests.swift @@ -1,8 +1,3 @@ -/* - Abstract: - The file tests performance of the rendering. - */ - import HTMLKit import XCTest diff --git a/Tests/HTMLKitTests/RenderingTests.swift b/Tests/HTMLKitTests/RenderingTests.swift index d89353ea..4140536c 100644 --- a/Tests/HTMLKitTests/RenderingTests.swift +++ b/Tests/HTMLKitTests/RenderingTests.swift @@ -1,8 +1,3 @@ -/* - Abstract: - The file tests the rendering. - */ - import HTMLKit import XCTest diff --git a/Tests/HTMLKitTests/TemplatingTests.swift b/Tests/HTMLKitTests/TemplatingTests.swift index 1e4f7525..3f526244 100644 --- a/Tests/HTMLKitTests/TemplatingTests.swift +++ b/Tests/HTMLKitTests/TemplatingTests.swift @@ -1,8 +1,3 @@ -/* - Abstract: - The file tests the templating. - */ - import HTMLKit import XCTest import OrderedCollections diff --git a/Tests/HTMLKitVaporTests/ProviderTests.swift b/Tests/HTMLKitVaporTests/ProviderTests.swift index 5085aa01..804f397a 100644 --- a/Tests/HTMLKitVaporTests/ProviderTests.swift +++ b/Tests/HTMLKitVaporTests/ProviderTests.swift @@ -1,8 +1,3 @@ -/* - Abstract: - The file tests the provider. - */ - import XCTVapor import HTMLKit import HTMLKitVapor @@ -93,11 +88,9 @@ final class ProviderTests: XCTestCase { } } - func testEventLoopIntegration() throws { - - let app = Application(.testing) + func testEventLoopIntegration() async throws { - defer { app.shutdown() } + let app = try await Application.make(.testing) app.get("test") { request -> EventLoopFuture in @@ -106,7 +99,7 @@ final class ProviderTests: XCTestCase { return request.htmlkit.render(TestPage.NephewView(context: context)) } - try app.test(.GET, "test") { response in + try await app.test(.GET, "test") { response async in XCTAssertEqual(response.status, .ok) XCTAssertEqual(response.body.string, """ @@ -122,13 +115,13 @@ final class ProviderTests: XCTestCase { """ ) } + + try await app.asyncShutdown() } - func testConcurrencyIntegration() throws { + func testConcurrencyIntegration() async throws { - let app = Application(.testing) - - defer { app.shutdown() } + let app = try await Application.make(.testing) app.get("test") { request async throws -> Vapor.View in @@ -137,7 +130,7 @@ final class ProviderTests: XCTestCase { return try await request.htmlkit.render(TestPage.NephewView(context: context)) } - try app.test(.GET, "test") { response in + try await app.test(.GET, "test") { response async in XCTAssertEqual(response.status, .ok) XCTAssertEqual(response.body.string, """ @@ -153,18 +146,18 @@ final class ProviderTests: XCTestCase { """ ) } + + try await app.asyncShutdown() } /// Tests the setup of localization through Vapor - func testLocalizationIntegration() throws { + func testLocalizationIntegration() async throws { guard let source = Bundle.module.url(forResource: "Localization", withExtension: nil) else { return } - let app = Application(.testing) - - defer { app.shutdown() } + let app = try await Application.make(.testing) app.htmlkit.localization.set(source: source) app.htmlkit.localization.set(locale: "fr") @@ -174,7 +167,7 @@ final class ProviderTests: XCTestCase { return try await request.htmlkit.render(TestPage.ChildView()) } - try app.test(.GET, "test") { response in + try await app.test(.GET, "test") { response async in XCTAssertEqual(response.status, .ok) XCTAssertEqual(response.body.string, """ @@ -190,24 +183,24 @@ final class ProviderTests: XCTestCase { """ ) } + + try await app.asyncShutdown() } /// Tests the behavior when localization is not properly configured /// /// Localization is considered improperly configured when one or both of the essential factors are missing. /// In such case the renderer is expected to skip the localization and directly return the fallback string literal. - func testLocalizationFallback() throws { - - let app = Application(.testing) + func testLocalizationFallback() async throws { - defer { app.shutdown() } + let app = try await Application.make(.testing) app.get("test") { request async throws -> Vapor.View in return try await request.htmlkit.render(TestPage.ChildView()) } - try app.test(.GET, "test") { response in + try await app.test(.GET, "test") { response async in XCTAssertEqual(response.status, .ok) XCTAssertEqual(response.body.string, """ @@ -223,34 +216,30 @@ final class ProviderTests: XCTestCase { """ ) } + + try await app.asyncShutdown() } /// Tests the localization behavior based on the accept language of the client /// /// The environment locale is expected to be changed according to the language given by the provider. /// The renderer is expected to localize correctly the content based on the updated environment locale. - func testLocalizationByAcceptingHeaders() throws { + func testLocalizationByAcceptingHeaders() async throws { guard let source = Bundle.module.url(forResource: "Localization", withExtension: nil) else { return } - let app = Application(.testing) - - defer { app.shutdown() } + let app = try await Application.make(.testing) app.htmlkit.localization.set(source: source) app.htmlkit.localization.set(locale: "en-GB") app.get("test") { request async throws -> Vapor.View in - - // Overwrite the accept language header to simulate a different language - request.headers.replaceOrAdd(name: "accept-language", value: "fr") - return try await request.htmlkit.render(TestPage.ChildView()) } - try app.test(.GET, "test") { response in + try await app.test(.GET, "test", headers: ["accept-language": "fr"]) { response async in XCTAssertEqual(response.status, .ok) XCTAssertEqual(response.body.string, """ @@ -266,6 +255,8 @@ final class ProviderTests: XCTestCase { """ ) } + + try await app.asyncShutdown() } /// Tests the localization behavior when the preferred language is unknown. @@ -284,14 +275,10 @@ final class ProviderTests: XCTestCase { app.htmlkit.localization.set(locale: "en-GB") app.get("test") { request async throws -> Vapor.View in - - // Overwrite the accept language header to simulate a different language - request.headers.replaceOrAdd(name: "accept-language", value: "en-US") - return try await request.htmlkit.render(TestPage.ChildView()) } - try await app.test(.GET, "test") { response async in + try await app.test(.GET, "test", headers: ["accept-language": "en-US"]) { response async in XCTAssertEqual(response.status, .ok) XCTAssertEqual(response.body.string, """ @@ -314,11 +301,9 @@ final class ProviderTests: XCTestCase { /// Tests the access to environment through provider /// /// The provider is expected to recieve the environment object and resolve it based on the request. - func testEnvironmentIntegration() throws { - - let app = Application(.testing) + func testEnvironmentIntegration() async throws { - defer { app.shutdown() } + let app = try await Application.make(.testing) app.htmlkit.environment.upsert(TestObject(), for: \TestObject.self) @@ -326,7 +311,7 @@ final class ProviderTests: XCTestCase { return try await request.htmlkit.render(TestPage.SipplingView()) } - try app.test(.GET, "test") { response in + try await app.test(.GET, "test") { response async in XCTAssertEqual(response.status, .ok) XCTAssertEqual(response.body.string, """ @@ -342,13 +327,13 @@ final class ProviderTests: XCTestCase { """ ) } + + try await app.asyncShutdown() } - func testMarkdownSupport() throws { - - let app = Application(.testing) + func testMarkdownSupport() async throws { - defer { app.shutdown() } + let app = try await Application.make(.testing) app.htmlkit.features = [.markdown] @@ -356,7 +341,7 @@ final class ProviderTests: XCTestCase { return try await request.htmlkit.render(TestPage.FriendView()) } - try app.test(.GET, "test") { response in + try await app.test(.GET, "test") { response async in XCTAssertEqual(response.status, .ok) XCTAssertEqual(response.body.string, """ @@ -372,19 +357,21 @@ final class ProviderTests: XCTestCase { """ ) } + + try await app.asyncShutdown() } /// Tests the error reporting to Vapor for issues that may occur during environment access. /// /// The error is expected to be classified as an internal server error and includes a error message. - func testEnvironmentErrorReporting() throws { + func testEnvironmentErrorReporting() async throws { struct TestObject { let firstName = "Jane" } - struct UnkownObject: HTMLKit.View { + struct UnknownObject: HTMLKit.View { @EnvironmentObject(TestObject.self) var object @@ -413,13 +400,11 @@ final class ProviderTests: XCTestCase { } } - let app = Application(.testing) - - defer { app.shutdown() } + let app = try await Application.make(.testing) - app.get("unkownobject") { request async throws -> Vapor.View in + app.get("unknownobject") { request async throws -> Vapor.View in - return try await request.htmlkit.render(UnkownObject()) + return try await request.htmlkit.render(UnknownObject()) } app.get("wrongcast") { request async throws -> Vapor.View in @@ -427,7 +412,7 @@ final class ProviderTests: XCTestCase { return try await request.htmlkit.render(WrongCast()) } - try app.test(.GET, "unkownobject") { response in + try await app.test(.GET, "unknownobject") { response async throws in XCTAssertEqual(response.status, .internalServerError) @@ -436,7 +421,7 @@ final class ProviderTests: XCTestCase { XCTAssertEqual(abort.reason, "Unable to retrieve environment object.") } - try app.test(.GET, "wrongcast") { response in + try await app.test(.GET, "wrongcast") { response async throws in XCTAssertEqual(response.status, .internalServerError) @@ -444,5 +429,7 @@ final class ProviderTests: XCTestCase { XCTAssertEqual(abort.reason, "Unable to cast the environment value.") } + + try await app.asyncShutdown() } }