Initial Commit
This commit is contained in:
116
Sources/HRW/GenHTML/Elements/A.swift
Normal file
116
Sources/HRW/GenHTML/Elements/A.swift
Normal file
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// A.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <a> Hyperlink
|
||||
public class A : HTMLNode, IFlow, IInteractive, IPalpable, IPhrasing {
|
||||
|
||||
/// Whether to download the resource instead of navigating to it, and its file name if so.
|
||||
public var download:String? = nil
|
||||
|
||||
/// Address of the hyperlink. Valid URL potentially surrounded by spaces.
|
||||
public var href:URL? = nil
|
||||
|
||||
/// Language of the linked resource. Valid BCP 47 language tag.
|
||||
public var hreflang:String? = nil
|
||||
|
||||
/// URLs to ping. Set of space-separated tokens consisting of valid non-empty URLs.
|
||||
public var ping:[URL] = []
|
||||
|
||||
/// Referrer policy for fetches initiated by the element. Referrer policy.
|
||||
public var referrerpolicy:ReferrerPolicy? = nil
|
||||
|
||||
/// Relationship between the location in the document containing the hyperlink and the destination resource. Unordered set of unique space-separated tokens. The actual rules are more complicated than indicated.
|
||||
public var rel:[String] = []
|
||||
|
||||
/// Browsing context for hyperlink navigation. Valid browsing context name or keyword.
|
||||
public var target:String? = nil
|
||||
|
||||
/// Hint for the type of the referenced resource. Valid MIME type string.
|
||||
public var type:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "download":
|
||||
download = attValue
|
||||
continue
|
||||
case "href":
|
||||
href = try URL(expect: attValue)
|
||||
continue
|
||||
case "hreflang":
|
||||
hreflang = attValue
|
||||
continue
|
||||
case "ping":
|
||||
ping = try URL.parseList(attValue, " ")
|
||||
continue
|
||||
case "referrerpolicy":
|
||||
referrerpolicy = try ReferrerPolicy(expect: attValue)
|
||||
continue
|
||||
case "rel":
|
||||
rel = try String.parseList(attValue, " ")
|
||||
continue
|
||||
case "target":
|
||||
target = attValue
|
||||
continue
|
||||
case "type":
|
||||
type = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "a", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let download = download {
|
||||
result += " download='\(download)'"
|
||||
}
|
||||
if let href = href {
|
||||
result += " href='\(href.absoluteString)'"
|
||||
}
|
||||
if let hreflang = hreflang {
|
||||
result += " hreflang='\(hreflang)'"
|
||||
}
|
||||
result += " ping='\(ping.toStringList(" "))'"
|
||||
if let referrerpolicy = referrerpolicy {
|
||||
result += " referrerpolicy='\(referrerpolicy.rawValue)'"
|
||||
}
|
||||
result += " rel='\(rel.toStringList(" "))'"
|
||||
if let target = target {
|
||||
result += " target='\(target)'"
|
||||
}
|
||||
if let type = type {
|
||||
result += " type='\(type)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "a"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
56
Sources/HRW/GenHTML/Elements/Abbr.swift
Normal file
56
Sources/HRW/GenHTML/Elements/Abbr.swift
Normal file
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// Abbr.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <abbr> Abbreviation
|
||||
public class Abbr : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
/// Full term or expansion of abbreviation.
|
||||
public var title:String? {
|
||||
get { return globalAttributes[.title] }
|
||||
set { globalAttributes[.title] = newValue }
|
||||
}
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "abbr", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "abbr"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Address.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Address.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Address.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <address> Contact information for a page or article element
|
||||
public class Address : HTMLNode, IFlow, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "address", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "address"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
161
Sources/HRW/GenHTML/Elements/Area.swift
Normal file
161
Sources/HRW/GenHTML/Elements/Area.swift
Normal file
@@ -0,0 +1,161 @@
|
||||
//
|
||||
// Area.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <area> Hyperlink or dead area on an image map
|
||||
public class Area : HTMLNode, IFlow, IPhrasing {
|
||||
|
||||
public enum Shape : String, CaseIterable {
|
||||
|
||||
case circle
|
||||
case default_ = "default"
|
||||
case poly
|
||||
case rect
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Shape: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Shape(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Shape: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Shape] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Shape(rawValue: input), "unexpected value for Shape: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/// Replacement text for use when images are not available. Text. The actual rules are more complicated than indicated.
|
||||
public var alt:String? = nil
|
||||
|
||||
/// Coordinates for the shape to be created in an image map. Valid list of floating-point numbers. The actual rules are more complicated than indicated.
|
||||
public var coords:[Float] = []
|
||||
|
||||
/// Whether to download the resource instead of navigating to it, and its file name if so.
|
||||
public var download:String? = nil
|
||||
|
||||
/// Address of the hyperlink. Valid URL potentially surrounded by spaces.
|
||||
public var href:URL? = nil
|
||||
|
||||
/// URLs to ping. Set of space-separated tokens consisting of valid non-empty URLs.
|
||||
public var ping:[URL] = []
|
||||
|
||||
/// Referrer policy for fetches initiated by the element. Referrer policy.
|
||||
public var referrerpolicy:ReferrerPolicy? = nil
|
||||
|
||||
/// Relationship between the location in the document containing the hyperlink and the destination resource. Unordered set of unique space-separated tokens. The actual rules are more complicated than indicated.
|
||||
public var rel:[String] = []
|
||||
|
||||
/// The kind of shape to be created in an image map.
|
||||
public var shape:Shape? = nil
|
||||
|
||||
/// Browsing context for hyperlink navigation. Valid browsing context name or keyword.
|
||||
public var target:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "alt":
|
||||
alt = attValue
|
||||
continue
|
||||
case "coords":
|
||||
coords = try Float.parseList(attValue, ",")
|
||||
continue
|
||||
case "download":
|
||||
download = attValue
|
||||
continue
|
||||
case "href":
|
||||
href = try URL(expect: attValue)
|
||||
continue
|
||||
case "ping":
|
||||
ping = try URL.parseList(attValue, " ")
|
||||
continue
|
||||
case "referrerpolicy":
|
||||
referrerpolicy = try ReferrerPolicy(expect: attValue)
|
||||
continue
|
||||
case "rel":
|
||||
rel = try String.parseList(attValue, " ")
|
||||
continue
|
||||
case "shape":
|
||||
shape = try Shape(expect: attValue)
|
||||
continue
|
||||
case "target":
|
||||
target = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
super.init(globalAttr)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let alt = alt {
|
||||
result += " alt='\(alt)'"
|
||||
}
|
||||
result += " coords='\(coords.toStringList(","))'"
|
||||
if let download = download {
|
||||
result += " download='\(download)'"
|
||||
}
|
||||
if let href = href {
|
||||
result += " href='\(href.absoluteString)'"
|
||||
}
|
||||
result += " ping='\(ping.toStringList(" "))'"
|
||||
if let referrerpolicy = referrerpolicy {
|
||||
result += " referrerpolicy='\(referrerpolicy.rawValue)'"
|
||||
}
|
||||
result += " rel='\(rel.toStringList(" "))'"
|
||||
if let shape = shape {
|
||||
result += " shape='\(shape.rawValue)'"
|
||||
}
|
||||
if let target = target {
|
||||
result += " target='\(target)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "area"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Article.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Article.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Article.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <article> Self-contained syndicatable or reusable composition
|
||||
public class Article : HTMLNode, IFlow, IPalpable, ISectioning {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "article", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "article"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Aside.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Aside.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Aside.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <aside> Sidebar for tangentially related content
|
||||
public class Aside : HTMLNode, IFlow, IPalpable, ISectioning {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "aside", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "aside"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
192
Sources/HRW/GenHTML/Elements/Audio.swift
Normal file
192
Sources/HRW/GenHTML/Elements/Audio.swift
Normal file
@@ -0,0 +1,192 @@
|
||||
//
|
||||
// Audio.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <audio> Audio player
|
||||
public class Audio : HTMLNode, IEmbedded, IFlow, IInteractive, IPalpable, IPhrasing {
|
||||
|
||||
public enum Crossorigin : String, CaseIterable {
|
||||
|
||||
case anonymous
|
||||
case useCredentials = "use-credentials"
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Crossorigin: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Crossorigin(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Crossorigin: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Crossorigin] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Crossorigin(rawValue: input), "unexpected value for Crossorigin: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
public enum Preload : String, CaseIterable {
|
||||
|
||||
case auto
|
||||
case metadata
|
||||
case none
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Preload: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Preload(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Preload: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Preload] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Preload(rawValue: input), "unexpected value for Preload: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/// Hint that the media resource can be started automatically when the page is loaded.
|
||||
public var autoplay:Bool = false
|
||||
|
||||
/// Show user agent controls.
|
||||
public var controls:Bool = false
|
||||
|
||||
/// How the element handles crossorigin requests.
|
||||
public var crossorigin:Crossorigin? = nil
|
||||
|
||||
/// Whether to loop the media resource.
|
||||
public var loop:Bool = false
|
||||
|
||||
/// Whether to mute the media resource by default.
|
||||
public var muted:Bool = false
|
||||
|
||||
/// Hints how much buffering the media resource will likely need.
|
||||
public var preload:Preload? = nil
|
||||
|
||||
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
|
||||
public var src:URL? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "autoplay":
|
||||
autoplay = true
|
||||
continue
|
||||
case "controls":
|
||||
controls = true
|
||||
continue
|
||||
case "crossorigin":
|
||||
crossorigin = try Crossorigin(expect: attValue)
|
||||
continue
|
||||
case "loop":
|
||||
loop = true
|
||||
continue
|
||||
case "muted":
|
||||
muted = true
|
||||
continue
|
||||
case "preload":
|
||||
preload = try Preload(expect: attValue)
|
||||
continue
|
||||
case "src":
|
||||
src = try URL(expect: attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "audio", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if autoplay {
|
||||
result += " autoplay"
|
||||
}
|
||||
if controls {
|
||||
result += " controls"
|
||||
}
|
||||
if let crossorigin = crossorigin {
|
||||
result += " crossorigin='\(crossorigin.rawValue)'"
|
||||
}
|
||||
if loop {
|
||||
result += " loop"
|
||||
}
|
||||
if muted {
|
||||
result += " muted"
|
||||
}
|
||||
if let preload = preload {
|
||||
result += " preload='\(preload.rawValue)'"
|
||||
}
|
||||
if let src = src {
|
||||
result += " src='\(src.absoluteString)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "audio"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/B.swift
Normal file
49
Sources/HRW/GenHTML/Elements/B.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// B.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <b> Keywords
|
||||
public class B : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "b", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "b"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
62
Sources/HRW/GenHTML/Elements/Base.swift
Normal file
62
Sources/HRW/GenHTML/Elements/Base.swift
Normal file
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// Base.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <base> Base URL and default target browsing context for hyperlinks and forms
|
||||
public class Base : HTMLNode, IMetaData {
|
||||
|
||||
/// Document base URL. Valid URL potentially surrounded by spaces.
|
||||
public var href:URL? = nil
|
||||
|
||||
/// Default browsing context for hyperlink navigation and form submission. Valid browsing context name or keyword.
|
||||
public var target:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "href":
|
||||
href = try URL(expect: attValue)
|
||||
continue
|
||||
case "target":
|
||||
target = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
super.init(globalAttr)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let href = href {
|
||||
result += " href='\(href.absoluteString)'"
|
||||
}
|
||||
if let target = target {
|
||||
result += " target='\(target)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "base"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Bdi.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Bdi.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Bdi.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <bdi> Text directionality isolation
|
||||
public class Bdi : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "bdi", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "bdi"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
55
Sources/HRW/GenHTML/Elements/Bdo.swift
Normal file
55
Sources/HRW/GenHTML/Elements/Bdo.swift
Normal file
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// Bdo.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <bdo> Text directionality formatting
|
||||
public class Bdo : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
/// The text directionality of the element.
|
||||
public var dir:Dir {
|
||||
get { return try! Dir(expect: globalAttributes[.dir]!) }
|
||||
set { globalAttributes[.dir] = newValue.rawValue }
|
||||
}
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "bdo", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "bdo"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
61
Sources/HRW/GenHTML/Elements/Blockquote.swift
Normal file
61
Sources/HRW/GenHTML/Elements/Blockquote.swift
Normal file
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// Blockquote.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <blockquote> A section quoted from another source
|
||||
public class Blockquote : HTMLNode, IFlow, IPalpable, ISectioningRoot {
|
||||
|
||||
/// Link to the source of the quotation or more information about the edit. Valid URL potentially surrounded by spaces.
|
||||
public var cite:URL? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "cite":
|
||||
cite = try URL(expect: attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "blockquote", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let cite = cite {
|
||||
result += " cite='\(cite.absoluteString)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "blockquote"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
196
Sources/HRW/GenHTML/Elements/Body.swift
Normal file
196
Sources/HRW/GenHTML/Elements/Body.swift
Normal file
@@ -0,0 +1,196 @@
|
||||
//
|
||||
// Body.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <body> Document body
|
||||
public class Body : HTMLNode, ISectioningRoot {
|
||||
|
||||
/// event handler.
|
||||
public var onafterprint:String? = nil
|
||||
|
||||
/// event handler.
|
||||
public var onbeforeprint:String? = nil
|
||||
|
||||
/// event handler.
|
||||
public var onbeforeunload:String? = nil
|
||||
|
||||
/// event handler.
|
||||
public var onhashchange:String? = nil
|
||||
|
||||
/// event handler.
|
||||
public var onlanguagechange:String? = nil
|
||||
|
||||
/// event handler.
|
||||
public var onmessage:String? = nil
|
||||
|
||||
/// event handler.
|
||||
public var onmessageerror:String? = nil
|
||||
|
||||
/// event handler.
|
||||
public var onoffline:String? = nil
|
||||
|
||||
/// event handler.
|
||||
public var ononline:String? = nil
|
||||
|
||||
/// event handler.
|
||||
public var onpagehide:String? = nil
|
||||
|
||||
/// event handler.
|
||||
public var onpageshow:String? = nil
|
||||
|
||||
/// event handler.
|
||||
public var onpopstate:String? = nil
|
||||
|
||||
/// event handler.
|
||||
public var onrejectionhandled:String? = nil
|
||||
|
||||
/// event handler.
|
||||
public var onstorage:String? = nil
|
||||
|
||||
/// event handler.
|
||||
public var onunhandledrejection:String? = nil
|
||||
|
||||
/// event handler.
|
||||
public var onunload:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "onafterprint":
|
||||
onafterprint = attValue
|
||||
continue
|
||||
case "onbeforeprint":
|
||||
onbeforeprint = attValue
|
||||
continue
|
||||
case "onbeforeunload":
|
||||
onbeforeunload = attValue
|
||||
continue
|
||||
case "onhashchange":
|
||||
onhashchange = attValue
|
||||
continue
|
||||
case "onlanguagechange":
|
||||
onlanguagechange = attValue
|
||||
continue
|
||||
case "onmessage":
|
||||
onmessage = attValue
|
||||
continue
|
||||
case "onmessageerror":
|
||||
onmessageerror = attValue
|
||||
continue
|
||||
case "onoffline":
|
||||
onoffline = attValue
|
||||
continue
|
||||
case "ononline":
|
||||
ononline = attValue
|
||||
continue
|
||||
case "onpagehide":
|
||||
onpagehide = attValue
|
||||
continue
|
||||
case "onpageshow":
|
||||
onpageshow = attValue
|
||||
continue
|
||||
case "onpopstate":
|
||||
onpopstate = attValue
|
||||
continue
|
||||
case "onrejectionhandled":
|
||||
onrejectionhandled = attValue
|
||||
continue
|
||||
case "onstorage":
|
||||
onstorage = attValue
|
||||
continue
|
||||
case "onunhandledrejection":
|
||||
onunhandledrejection = attValue
|
||||
continue
|
||||
case "onunload":
|
||||
onunload = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "body", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let onafterprint = onafterprint {
|
||||
result += " onafterprint='\(onafterprint)'"
|
||||
}
|
||||
if let onbeforeprint = onbeforeprint {
|
||||
result += " onbeforeprint='\(onbeforeprint)'"
|
||||
}
|
||||
if let onbeforeunload = onbeforeunload {
|
||||
result += " onbeforeunload='\(onbeforeunload)'"
|
||||
}
|
||||
if let onhashchange = onhashchange {
|
||||
result += " onhashchange='\(onhashchange)'"
|
||||
}
|
||||
if let onlanguagechange = onlanguagechange {
|
||||
result += " onlanguagechange='\(onlanguagechange)'"
|
||||
}
|
||||
if let onmessage = onmessage {
|
||||
result += " onmessage='\(onmessage)'"
|
||||
}
|
||||
if let onmessageerror = onmessageerror {
|
||||
result += " onmessageerror='\(onmessageerror)'"
|
||||
}
|
||||
if let onoffline = onoffline {
|
||||
result += " onoffline='\(onoffline)'"
|
||||
}
|
||||
if let ononline = ononline {
|
||||
result += " ononline='\(ononline)'"
|
||||
}
|
||||
if let onpagehide = onpagehide {
|
||||
result += " onpagehide='\(onpagehide)'"
|
||||
}
|
||||
if let onpageshow = onpageshow {
|
||||
result += " onpageshow='\(onpageshow)'"
|
||||
}
|
||||
if let onpopstate = onpopstate {
|
||||
result += " onpopstate='\(onpopstate)'"
|
||||
}
|
||||
if let onrejectionhandled = onrejectionhandled {
|
||||
result += " onrejectionhandled='\(onrejectionhandled)'"
|
||||
}
|
||||
if let onstorage = onstorage {
|
||||
result += " onstorage='\(onstorage)'"
|
||||
}
|
||||
if let onunhandledrejection = onunhandledrejection {
|
||||
result += " onunhandledrejection='\(onunhandledrejection)'"
|
||||
}
|
||||
if let onunload = onunload {
|
||||
result += " onunload='\(onunload)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "body"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
41
Sources/HRW/GenHTML/Elements/Br.swift
Normal file
41
Sources/HRW/GenHTML/Elements/Br.swift
Normal file
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// Br.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <br> Line break, e.g. in poem or postal address
|
||||
public class Br : HTMLNode, IFlow, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
super.init(globalAttr)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "br"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
265
Sources/HRW/GenHTML/Elements/Button.swift
Normal file
265
Sources/HRW/GenHTML/Elements/Button.swift
Normal file
@@ -0,0 +1,265 @@
|
||||
//
|
||||
// Button.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <button> Button control
|
||||
public class Button : HTMLNode, IFlow, IFormAssociated, IInteractive, ILabelable, IListed, IPalpable, IPhrasing, ISubmittable {
|
||||
|
||||
public enum Formenctype : String, CaseIterable {
|
||||
|
||||
case application_xWwwFormUrlencoded = "application/x-www-form-urlencoded"
|
||||
case multipart_formData = "multipart/form-data"
|
||||
case text_plain = "text/plain"
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Formenctype: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Formenctype(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Formenctype: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Formenctype] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Formenctype(rawValue: input), "unexpected value for Formenctype: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
public enum Formmethod : String, CaseIterable {
|
||||
|
||||
case GET
|
||||
case POST
|
||||
case dialog
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Formmethod: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Formmethod(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Formmethod: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Formmethod] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Formmethod(rawValue: input), "unexpected value for Formmethod: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
public enum AttrType : String, CaseIterable {
|
||||
|
||||
case button
|
||||
case reset
|
||||
case submit
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for AttrType: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = AttrType(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for AttrType: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [AttrType] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(AttrType(rawValue: input), "unexpected value for AttrType: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the form control is disabled.
|
||||
public var disabled:Bool = false
|
||||
|
||||
/// Associates the element with a form element. ID. The actual rules are more complicated than indicated.
|
||||
public var form:String? = nil
|
||||
|
||||
/// URL to use for form submission. Valid non-empty URL potentially surrounded by spaces.
|
||||
public var formaction:URL? = nil
|
||||
|
||||
/// Entry list encoding type to use for form submission.
|
||||
public var formenctype:Formenctype? = nil
|
||||
|
||||
/// Variant to use for form submission.
|
||||
public var formmethod:Formmethod? = nil
|
||||
|
||||
/// Bypass form control validation for form submission.
|
||||
public var formnovalidate:Bool = false
|
||||
|
||||
/// Browsing context for form submission. Valid browsing context name or keyword.
|
||||
public var formtarget:String? = nil
|
||||
|
||||
/// Name of the element to use for form submission and in the form.elements API. Text. The actual rules are more complicated than indicated.
|
||||
public var name:String? = nil
|
||||
|
||||
/// Type of button.
|
||||
public var type:AttrType? = nil
|
||||
|
||||
/// Value to be used for form submission.
|
||||
public var value:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "disabled":
|
||||
disabled = true
|
||||
continue
|
||||
case "form":
|
||||
form = attValue
|
||||
continue
|
||||
case "formaction":
|
||||
formaction = try URL(expect: attValue)
|
||||
continue
|
||||
case "formenctype":
|
||||
formenctype = try Formenctype(expect: attValue)
|
||||
continue
|
||||
case "formmethod":
|
||||
formmethod = try Formmethod(expect: attValue)
|
||||
continue
|
||||
case "formnovalidate":
|
||||
formnovalidate = true
|
||||
continue
|
||||
case "formtarget":
|
||||
formtarget = attValue
|
||||
continue
|
||||
case "name":
|
||||
name = attValue
|
||||
continue
|
||||
case "type":
|
||||
type = try AttrType(expect: attValue)
|
||||
continue
|
||||
case "value":
|
||||
value = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "button", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if disabled {
|
||||
result += " disabled"
|
||||
}
|
||||
if let form = form {
|
||||
result += " form='\(form)'"
|
||||
}
|
||||
if let formaction = formaction {
|
||||
result += " formaction='\(formaction.absoluteString)'"
|
||||
}
|
||||
if let formenctype = formenctype {
|
||||
result += " formenctype='\(formenctype.rawValue)'"
|
||||
}
|
||||
if let formmethod = formmethod {
|
||||
result += " formmethod='\(formmethod.rawValue)'"
|
||||
}
|
||||
if formnovalidate {
|
||||
result += " formnovalidate"
|
||||
}
|
||||
if let formtarget = formtarget {
|
||||
result += " formtarget='\(formtarget)'"
|
||||
}
|
||||
if let name = name {
|
||||
result += " name='\(name)'"
|
||||
}
|
||||
if let type = type {
|
||||
result += " type='\(type.rawValue)'"
|
||||
}
|
||||
if let value = value {
|
||||
result += " value='\(value)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "button"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
66
Sources/HRW/GenHTML/Elements/Canvas.swift
Normal file
66
Sources/HRW/GenHTML/Elements/Canvas.swift
Normal file
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// Canvas.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <canvas> Scriptable bitmap canvas
|
||||
public class Canvas : HTMLNode, IEmbedded, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
/// Vertical dimension. Valid non-negative integer.
|
||||
public var height:UInt? = nil
|
||||
|
||||
/// Horizontal dimension. Valid non-negative integer.
|
||||
public var width:UInt? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "height":
|
||||
height = UInt(attValue)
|
||||
continue
|
||||
case "width":
|
||||
width = UInt(attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "canvas", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let height = height {
|
||||
result += " height='\(height)'"
|
||||
}
|
||||
if let width = width {
|
||||
result += " width='\(width)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "canvas"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Caption.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Caption.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Caption.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <caption> Table caption
|
||||
public class Caption : HTMLNode {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "caption", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "caption"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Cite.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Cite.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Cite.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <cite> Title of a work
|
||||
public class Cite : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "cite", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "cite"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Code.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Code.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Code.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <code> Computer code
|
||||
public class Code : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "code", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "code"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
53
Sources/HRW/GenHTML/Elements/Col.swift
Normal file
53
Sources/HRW/GenHTML/Elements/Col.swift
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// Col.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <col> Table column
|
||||
public class Col : HTMLNode {
|
||||
|
||||
/// Number of columns spanned by the element. Valid non-negative integer greater than zero.
|
||||
public var span:UInt? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "span":
|
||||
span = UInt(attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
super.init(globalAttr)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let span = span {
|
||||
result += " span='\(span)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "col"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
57
Sources/HRW/GenHTML/Elements/Colgroup.swift
Normal file
57
Sources/HRW/GenHTML/Elements/Colgroup.swift
Normal file
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// Colgroup.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <colgroup> Group of columns in a table
|
||||
public class Colgroup : HTMLNode {
|
||||
|
||||
/// Number of columns spanned by the element. Valid non-negative integer greater than zero.
|
||||
public var span:UInt? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "span":
|
||||
span = UInt(attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "colgroup", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let span = span {
|
||||
result += " span='\(span)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "colgroup"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
61
Sources/HRW/GenHTML/Elements/Data.swift
Normal file
61
Sources/HRW/GenHTML/Elements/Data.swift
Normal file
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// Data.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <data> Machine-readable equivalent
|
||||
public class Data : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
/// Machine-readable value. Text. The actual rules are more complicated than indicated.
|
||||
public var value:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "value":
|
||||
value = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "data", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let value = value {
|
||||
result += " value='\(value)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "data"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
53
Sources/HRW/GenHTML/Elements/Datalist.swift
Normal file
53
Sources/HRW/GenHTML/Elements/Datalist.swift
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// Datalist.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <datalist> Container for options for combo box control
|
||||
public class Datalist : HTMLNode, IFlow, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "datalist", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public func addChild(_ someElement:IScriptSupporting) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "datalist"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Dd.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Dd.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Dd.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <dd> Content for corresponding dt element(s)
|
||||
public class Dd : HTMLNode {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "dd", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "dd"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
66
Sources/HRW/GenHTML/Elements/Del.swift
Normal file
66
Sources/HRW/GenHTML/Elements/Del.swift
Normal file
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// Del.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <del> A removal from the document
|
||||
public class Del : HTMLNode, IFlow, IPhrasing {
|
||||
|
||||
/// Link to the source of the quotation or more information about the edit. Valid URL potentially surrounded by spaces.
|
||||
public var cite:URL? = nil
|
||||
|
||||
/// Date and (optionally) time of the change. Valid date string with optional time.
|
||||
public var datetime:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "cite":
|
||||
cite = try URL(expect: attValue)
|
||||
continue
|
||||
case "datetime":
|
||||
datetime = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "del", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let cite = cite {
|
||||
result += " cite='\(cite.absoluteString)'"
|
||||
}
|
||||
if let datetime = datetime {
|
||||
result += " datetime='\(datetime)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "del"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
61
Sources/HRW/GenHTML/Elements/Details.swift
Normal file
61
Sources/HRW/GenHTML/Elements/Details.swift
Normal file
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// Details.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <details> Disclosure control for hiding details
|
||||
public class Details : HTMLNode, IFlow, IInteractive, IPalpable, ISectioningRoot {
|
||||
|
||||
/// Whether the details are visible.
|
||||
public var open:Bool = false
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "open":
|
||||
open = true
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "details", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if open {
|
||||
result += " open"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "details"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
56
Sources/HRW/GenHTML/Elements/Dfn.swift
Normal file
56
Sources/HRW/GenHTML/Elements/Dfn.swift
Normal file
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// Dfn.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <dfn> Defining instance
|
||||
public class Dfn : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
/// Full term or expansion of abbreviation.
|
||||
public var title:String? {
|
||||
get { return globalAttributes[.title] }
|
||||
set { globalAttributes[.title] = newValue }
|
||||
}
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "dfn", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "dfn"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
61
Sources/HRW/GenHTML/Elements/Dialog.swift
Normal file
61
Sources/HRW/GenHTML/Elements/Dialog.swift
Normal file
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// Dialog.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <dialog> Dialog box or window
|
||||
public class Dialog : HTMLNode, IFlow, ISectioningRoot {
|
||||
|
||||
/// Whether the dialog box is showing.
|
||||
public var open:Bool = false
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "open":
|
||||
open = true
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "dialog", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if open {
|
||||
result += " open"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "dialog"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Div.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Div.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Div.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <div> Generic flow container, or container for name-value groups in dl elements
|
||||
public class Div : HTMLNode, IFlow, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "div", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "div"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Dl.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Dl.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Dl.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <dl> Association list consisting of zero or more name-value groups
|
||||
public class Dl : HTMLNode, IFlow, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "dl", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IScriptSupporting) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "dl"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Dt.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Dt.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Dt.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <dt> Legend for corresponding dd element(s)
|
||||
public class Dt : HTMLNode {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "dt", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "dt"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Em.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Em.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Em.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <em> Stress emphasis
|
||||
public class Em : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "em", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "em"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
80
Sources/HRW/GenHTML/Elements/Embed.swift
Normal file
80
Sources/HRW/GenHTML/Elements/Embed.swift
Normal file
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// Embed.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <embed> Plugin
|
||||
public class Embed : HTMLNode, IEmbedded, IFlow, IInteractive, IPalpable, IPhrasing {
|
||||
|
||||
/// Vertical dimension. Valid non-negative integer.
|
||||
public var height:UInt? = nil
|
||||
|
||||
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
|
||||
public var src:URL? = nil
|
||||
|
||||
/// Type of embedded resource. Valid MIME type string.
|
||||
public var type:String? = nil
|
||||
|
||||
/// Horizontal dimension. Valid non-negative integer.
|
||||
public var width:UInt? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "height":
|
||||
height = UInt(attValue)
|
||||
continue
|
||||
case "src":
|
||||
src = try URL(expect: attValue)
|
||||
continue
|
||||
case "type":
|
||||
type = attValue
|
||||
continue
|
||||
case "width":
|
||||
width = UInt(attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
super.init(globalAttr)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let height = height {
|
||||
result += " height='\(height)'"
|
||||
}
|
||||
if let src = src {
|
||||
result += " src='\(src.absoluteString)'"
|
||||
}
|
||||
if let type = type {
|
||||
result += " type='\(type)'"
|
||||
}
|
||||
if let width = width {
|
||||
result += " width='\(width)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "embed"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
79
Sources/HRW/GenHTML/Elements/Fieldset.swift
Normal file
79
Sources/HRW/GenHTML/Elements/Fieldset.swift
Normal file
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// Fieldset.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <fieldset> Group of form controls
|
||||
public class Fieldset : HTMLNode, IFlow, IFormAssociated, IListed, IPalpable, ISectioningRoot {
|
||||
|
||||
/// Whether the descendant form controls, except any inside legend, are disabled.
|
||||
public var disabled:Bool = false
|
||||
|
||||
/// Associates the element with a form element. ID. The actual rules are more complicated than indicated.
|
||||
public var form:String? = nil
|
||||
|
||||
/// Name of the element to use for form submission and in the form.elements API. Text. The actual rules are more complicated than indicated.
|
||||
public var name:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "disabled":
|
||||
disabled = true
|
||||
continue
|
||||
case "form":
|
||||
form = attValue
|
||||
continue
|
||||
case "name":
|
||||
name = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "fieldset", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if disabled {
|
||||
result += " disabled"
|
||||
}
|
||||
if let form = form {
|
||||
result += " form='\(form)'"
|
||||
}
|
||||
if let name = name {
|
||||
result += " name='\(name)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "fieldset"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Figcaption.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Figcaption.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Figcaption.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <figcaption> Caption for figure
|
||||
public class Figcaption : HTMLNode {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "figcaption", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "figcaption"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Figure.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Figure.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Figure.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <figure> Figure with optional caption
|
||||
public class Figure : HTMLNode, IFlow, IPalpable, ISectioningRoot {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "figure", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "figure"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Footer.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Footer.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Footer.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <footer> Footer for a page or section
|
||||
public class Footer : HTMLNode, IFlow, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "footer", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "footer"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
246
Sources/HRW/GenHTML/Elements/Form.swift
Normal file
246
Sources/HRW/GenHTML/Elements/Form.swift
Normal file
@@ -0,0 +1,246 @@
|
||||
//
|
||||
// Form.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <form> User-submittable form
|
||||
public class Form : HTMLNode, IFlow, IPalpable {
|
||||
|
||||
public enum Autocomplete : String, CaseIterable {
|
||||
|
||||
case off
|
||||
case on
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Autocomplete: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Autocomplete(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Autocomplete: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Autocomplete] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Autocomplete(rawValue: input), "unexpected value for Autocomplete: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
public enum Enctype : String, CaseIterable {
|
||||
|
||||
case application_xWwwFormUrlencoded = "application/x-www-form-urlencoded"
|
||||
case multipart_formData = "multipart/form-data"
|
||||
case text_plain = "text/plain"
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Enctype: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Enctype(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Enctype: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Enctype] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Enctype(rawValue: input), "unexpected value for Enctype: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
public enum Method : String, CaseIterable {
|
||||
|
||||
case GET
|
||||
case POST
|
||||
case dialog
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Method: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Method(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Method: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Method] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Method(rawValue: input), "unexpected value for Method: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/// Character encodings to use for form submission. ASCII case-insensitive match for "UTF-8".
|
||||
public var accept_charset:String? = nil
|
||||
|
||||
/// URL to use for form submission. Valid non-empty URL potentially surrounded by spaces.
|
||||
public var action:URL? = nil
|
||||
|
||||
/// Default setting for autofill feature for controls in the form.
|
||||
public var autocomplete:Autocomplete? = nil
|
||||
|
||||
/// Entry list encoding type to use for form submission.
|
||||
public var enctype:Enctype? = nil
|
||||
|
||||
/// Variant to use for form submission.
|
||||
public var method:Method? = nil
|
||||
|
||||
/// Name of form to use in the document.forms API. Text. The actual rules are more complicated than indicated.
|
||||
public var name:String? = nil
|
||||
|
||||
/// Bypass form control validation for form submission.
|
||||
public var novalidate:Bool = false
|
||||
|
||||
/// Browsing context for form submission. Valid browsing context name or keyword.
|
||||
public var target:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "accept-charset":
|
||||
accept_charset = attValue
|
||||
continue
|
||||
case "action":
|
||||
action = try URL(expect: attValue)
|
||||
continue
|
||||
case "autocomplete":
|
||||
autocomplete = try Autocomplete(expect: attValue)
|
||||
continue
|
||||
case "enctype":
|
||||
enctype = try Enctype(expect: attValue)
|
||||
continue
|
||||
case "method":
|
||||
method = try Method(expect: attValue)
|
||||
continue
|
||||
case "name":
|
||||
name = attValue
|
||||
continue
|
||||
case "novalidate":
|
||||
novalidate = true
|
||||
continue
|
||||
case "target":
|
||||
target = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "form", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let accept_charset = accept_charset {
|
||||
result += " accept-charset='\(accept_charset)'"
|
||||
}
|
||||
if let action = action {
|
||||
result += " action='\(action.absoluteString)'"
|
||||
}
|
||||
if let autocomplete = autocomplete {
|
||||
result += " autocomplete='\(autocomplete.rawValue)'"
|
||||
}
|
||||
if let enctype = enctype {
|
||||
result += " enctype='\(enctype.rawValue)'"
|
||||
}
|
||||
if let method = method {
|
||||
result += " method='\(method.rawValue)'"
|
||||
}
|
||||
if let name = name {
|
||||
result += " name='\(name)'"
|
||||
}
|
||||
if novalidate {
|
||||
result += " novalidate"
|
||||
}
|
||||
if let target = target {
|
||||
result += " target='\(target)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "form"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/H1.swift
Normal file
49
Sources/HRW/GenHTML/Elements/H1.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// H1.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <h1> Section heading
|
||||
public class H1 : HTMLNode, IFlow, IHeading, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "h1", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "h1"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/H2.swift
Normal file
49
Sources/HRW/GenHTML/Elements/H2.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// H2.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <h2> Section heading
|
||||
public class H2 : HTMLNode, IFlow, IHeading, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "h2", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "h2"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/H3.swift
Normal file
49
Sources/HRW/GenHTML/Elements/H3.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// H3.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <h3> Section heading
|
||||
public class H3 : HTMLNode, IFlow, IHeading, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "h3", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "h3"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/H4.swift
Normal file
49
Sources/HRW/GenHTML/Elements/H4.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// H4.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <h4> Section heading
|
||||
public class H4 : HTMLNode, IFlow, IHeading, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "h4", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "h4"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/H5.swift
Normal file
49
Sources/HRW/GenHTML/Elements/H5.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// H5.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <h5> Section heading
|
||||
public class H5 : HTMLNode, IFlow, IHeading, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "h5", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "h5"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/H6.swift
Normal file
49
Sources/HRW/GenHTML/Elements/H6.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// H6.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <h6> Section heading
|
||||
public class H6 : HTMLNode, IFlow, IHeading, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "h6", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "h6"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Head.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Head.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Head.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <head> Container for document metadata
|
||||
public class Head : HTMLNode {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "head", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IMetaData) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "head"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Header.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Header.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Header.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <header> Introductory or navigational aids for a page or section
|
||||
public class Header : HTMLNode, IFlow, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "header", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "header"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Hgroup.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Hgroup.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Hgroup.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <hgroup> heading group
|
||||
public class Hgroup : HTMLNode, IFlow, IHeading, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "hgroup", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IScriptSupporting) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "hgroup"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
41
Sources/HRW/GenHTML/Elements/Hr.swift
Normal file
41
Sources/HRW/GenHTML/Elements/Hr.swift
Normal file
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// Hr.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <hr> Thematic break
|
||||
public class Hr : HTMLNode, IFlow {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
super.init(globalAttr)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "hr"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
57
Sources/HRW/GenHTML/Elements/Html.swift
Normal file
57
Sources/HRW/GenHTML/Elements/Html.swift
Normal file
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// Html.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <html> Root element
|
||||
public class Html : HTMLNode {
|
||||
|
||||
/// Application cache manifest. Valid non-empty URL potentially surrounded by spaces.
|
||||
public var manifest:URL? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "manifest":
|
||||
manifest = try URL(expect: attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "html", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let manifest = manifest {
|
||||
result += " manifest='\(manifest.absoluteString)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "html"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/I.swift
Normal file
49
Sources/HRW/GenHTML/Elements/I.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// I.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <i> Alternate voice
|
||||
public class I : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "i", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "i"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
136
Sources/HRW/GenHTML/Elements/Iframe.swift
Normal file
136
Sources/HRW/GenHTML/Elements/Iframe.swift
Normal file
@@ -0,0 +1,136 @@
|
||||
//
|
||||
// Iframe.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <iframe> Nested browsing context
|
||||
public class Iframe : HTMLNode, IEmbedded, IFlow, IInteractive, IPalpable, IPhrasing {
|
||||
|
||||
/// Feature policy to be applied to the iframe's contents. Serialized feature policy.
|
||||
public var allow:String? = nil
|
||||
|
||||
/// Whether to allow the iframe's contents to use requestFullscreen().
|
||||
public var allowfullscreen:Bool = false
|
||||
|
||||
/// Whether the iframe's contents are allowed to use the PaymentRequest interface to make payment requests.
|
||||
public var allowpaymentrequest:Bool = false
|
||||
|
||||
/// Vertical dimension. Valid non-negative integer.
|
||||
public var height:UInt? = nil
|
||||
|
||||
/// Name of nested browsing context. Valid browsing context name or keyword.
|
||||
public var name:String? = nil
|
||||
|
||||
/// Referrer policy for fetches initiated by the element. Referrer policy.
|
||||
public var referrerpolicy:ReferrerPolicy? = nil
|
||||
|
||||
/// Security rules for nested content. Unordered set of unique space-separated tokens, ASCII case-insensitive, consisting of "allow-forms", "allow-modals", "allow-orientation-lock", "allow-pointer-lock", "allow-popups", "allow-popups-to-escape-sandbox", "allow-presentation", "allow-same-origin", "allow-scripts" and "allow-top-navigation".
|
||||
public var sandbox:Set<SandboxAttribute> = Set()
|
||||
|
||||
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
|
||||
public var src:URL? = nil
|
||||
|
||||
/// A document to render in the iframe. The source of an iframe srcdoc document. The actual rules are more complicated than indicated.
|
||||
public var srcdoc:String? = nil
|
||||
|
||||
/// Horizontal dimension. Valid non-negative integer.
|
||||
public var width:UInt? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "allow":
|
||||
allow = attValue
|
||||
continue
|
||||
case "allowfullscreen":
|
||||
allowfullscreen = true
|
||||
continue
|
||||
case "allowpaymentrequest":
|
||||
allowpaymentrequest = true
|
||||
continue
|
||||
case "height":
|
||||
height = UInt(attValue)
|
||||
continue
|
||||
case "name":
|
||||
name = attValue
|
||||
continue
|
||||
case "referrerpolicy":
|
||||
referrerpolicy = try ReferrerPolicy(expect: attValue)
|
||||
continue
|
||||
case "sandbox":
|
||||
sandbox = Set()
|
||||
continue
|
||||
case "src":
|
||||
src = try URL(expect: attValue)
|
||||
continue
|
||||
case "srcdoc":
|
||||
srcdoc = attValue
|
||||
continue
|
||||
case "width":
|
||||
width = UInt(attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "iframe", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let allow = allow {
|
||||
result += " allow='\(allow)'"
|
||||
}
|
||||
if allowfullscreen {
|
||||
result += " allowfullscreen"
|
||||
}
|
||||
if allowpaymentrequest {
|
||||
result += " allowpaymentrequest"
|
||||
}
|
||||
if let height = height {
|
||||
result += " height='\(height)'"
|
||||
}
|
||||
if let name = name {
|
||||
result += " name='\(name)'"
|
||||
}
|
||||
if let referrerpolicy = referrerpolicy {
|
||||
result += " referrerpolicy='\(referrerpolicy.rawValue)'"
|
||||
}
|
||||
result += " sandbox='\(sandbox.toStringList(" "))'"
|
||||
if let src = src {
|
||||
result += " src='\(src.absoluteString)'"
|
||||
}
|
||||
if let srcdoc = srcdoc {
|
||||
result += " srcdoc='\(srcdoc)'"
|
||||
}
|
||||
if let width = width {
|
||||
result += " width='\(width)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "iframe"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
269
Sources/HRW/GenHTML/Elements/Img.swift
Normal file
269
Sources/HRW/GenHTML/Elements/Img.swift
Normal file
@@ -0,0 +1,269 @@
|
||||
//
|
||||
// Img.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <img> Image
|
||||
public class Img : HTMLNode, IEmbedded, IFlow, IFormAssociated, IInteractive, IPalpable, IPhrasing {
|
||||
|
||||
public enum Crossorigin : String, CaseIterable {
|
||||
|
||||
case anonymous
|
||||
case useCredentials = "use-credentials"
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Crossorigin: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Crossorigin(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Crossorigin: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Crossorigin] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Crossorigin(rawValue: input), "unexpected value for Crossorigin: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
public enum Decoding : String, CaseIterable {
|
||||
|
||||
case async
|
||||
case auto
|
||||
case sync
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Decoding: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Decoding(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Decoding: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Decoding] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Decoding(rawValue: input), "unexpected value for Decoding: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
public enum Loading : String, CaseIterable {
|
||||
|
||||
case eager
|
||||
case lazy
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Loading: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Loading(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Loading: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Loading] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Loading(rawValue: input), "unexpected value for Loading: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/// Replacement text for use when images are not available. Text. The actual rules are more complicated than indicated.
|
||||
public var alt:String? = nil
|
||||
|
||||
/// How the element handles crossorigin requests.
|
||||
public var crossorigin:Crossorigin? = nil
|
||||
|
||||
/// Decoding hint to use when processing this image for presentation.
|
||||
public var decoding:Decoding? = nil
|
||||
|
||||
/// Vertical dimension. Valid non-negative integer.
|
||||
public var height:UInt? = nil
|
||||
|
||||
/// Whether the image is a server-side image map.
|
||||
public var ismap:Bool = false
|
||||
|
||||
/// Used when determining loading deferral.
|
||||
public var loading:Loading? = nil
|
||||
|
||||
/// Referrer policy for fetches initiated by the element. Referrer policy.
|
||||
public var referrerpolicy:ReferrerPolicy? = nil
|
||||
|
||||
/// Image sizes for different page layouts. Valid source size list.
|
||||
public var sizes:[String] = []
|
||||
|
||||
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
|
||||
public var src:URL? = nil
|
||||
|
||||
/// Images to use in different situations (e.g., high-resolution displays, small monitors, etc.). Comma-separated list of image candidate strings.
|
||||
public var srcset:[String] = []
|
||||
|
||||
/// Name of image map to use. Valid hash-name reference. The actual rules are more complicated than indicated.
|
||||
public var usemap:String? = nil
|
||||
|
||||
/// Horizontal dimension. Valid non-negative integer.
|
||||
public var width:UInt? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "alt":
|
||||
alt = attValue
|
||||
continue
|
||||
case "crossorigin":
|
||||
crossorigin = try Crossorigin(expect: attValue)
|
||||
continue
|
||||
case "decoding":
|
||||
decoding = try Decoding(expect: attValue)
|
||||
continue
|
||||
case "height":
|
||||
height = UInt(attValue)
|
||||
continue
|
||||
case "ismap":
|
||||
ismap = true
|
||||
continue
|
||||
case "loading":
|
||||
loading = try Loading(expect: attValue)
|
||||
continue
|
||||
case "referrerpolicy":
|
||||
referrerpolicy = try ReferrerPolicy(expect: attValue)
|
||||
continue
|
||||
case "sizes":
|
||||
sizes = try String.parseList(attValue, ",")
|
||||
continue
|
||||
case "src":
|
||||
src = try URL(expect: attValue)
|
||||
continue
|
||||
case "srcset":
|
||||
srcset = try String.parseList(attValue, ",")
|
||||
continue
|
||||
case "usemap":
|
||||
usemap = attValue
|
||||
continue
|
||||
case "width":
|
||||
width = UInt(attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
super.init(globalAttr)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let alt = alt {
|
||||
result += " alt='\(alt)'"
|
||||
}
|
||||
if let crossorigin = crossorigin {
|
||||
result += " crossorigin='\(crossorigin.rawValue)'"
|
||||
}
|
||||
if let decoding = decoding {
|
||||
result += " decoding='\(decoding.rawValue)'"
|
||||
}
|
||||
if let height = height {
|
||||
result += " height='\(height)'"
|
||||
}
|
||||
if ismap {
|
||||
result += " ismap"
|
||||
}
|
||||
if let loading = loading {
|
||||
result += " loading='\(loading.rawValue)'"
|
||||
}
|
||||
if let referrerpolicy = referrerpolicy {
|
||||
result += " referrerpolicy='\(referrerpolicy.rawValue)'"
|
||||
}
|
||||
result += " sizes='\(sizes.toStringList(","))'"
|
||||
if let src = src {
|
||||
result += " src='\(src.absoluteString)'"
|
||||
}
|
||||
result += " srcset='\(srcset.toStringList(","))'"
|
||||
if let usemap = usemap {
|
||||
result += " usemap='\(usemap)'"
|
||||
}
|
||||
if let width = width {
|
||||
result += " width='\(width)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "img"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
401
Sources/HRW/GenHTML/Elements/Input.swift
Normal file
401
Sources/HRW/GenHTML/Elements/Input.swift
Normal file
@@ -0,0 +1,401 @@
|
||||
//
|
||||
// Input.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <input> Form control
|
||||
public class Input : HTMLNode, IFlow, IFormAssociated, IInteractive, ILabelable, IListed, IPalpable, IPhrasing, IResettable, ISubmittable {
|
||||
|
||||
public enum Formenctype : String, CaseIterable {
|
||||
|
||||
case application_xWwwFormUrlencoded = "application/x-www-form-urlencoded"
|
||||
case multipart_formData = "multipart/form-data"
|
||||
case text_plain = "text/plain"
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Formenctype: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Formenctype(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Formenctype: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Formenctype] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Formenctype(rawValue: input), "unexpected value for Formenctype: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
public enum Formmethod : String, CaseIterable {
|
||||
|
||||
case GET
|
||||
case POST
|
||||
case dialog
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Formmethod: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Formmethod(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Formmethod: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Formmethod] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Formmethod(rawValue: input), "unexpected value for Formmethod: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/// Hint for expected file type in file upload controls. Set of comma-separated tokens* consisting of valid MIME type strings with no parameters or audio/*, video/*, or image/. The actual rules are more complicated than indicated.
|
||||
public var accept:[String] = []
|
||||
|
||||
/// Replacement text for use when images are not available. Text. The actual rules are more complicated than indicated.
|
||||
public var alt:String? = nil
|
||||
|
||||
/// Hint for form autofill feature. Autofill field name and related tokens. The actual rules are more complicated than indicated.
|
||||
public var autocomplete:String? = nil
|
||||
|
||||
/// Whether the control is checked.
|
||||
public var checked:Bool = false
|
||||
|
||||
/// Name of form control to use for sending the element's directionality in form submission. Text. The actual rules are more complicated than indicated.
|
||||
public var dirname:String? = nil
|
||||
|
||||
/// Whether the form control is disabled.
|
||||
public var disabled:Bool = false
|
||||
|
||||
/// Associates the element with a form element. ID. The actual rules are more complicated than indicated.
|
||||
public var form:String? = nil
|
||||
|
||||
/// URL to use for form submission. Valid non-empty URL potentially surrounded by spaces.
|
||||
public var formaction:URL? = nil
|
||||
|
||||
/// Entry list encoding type to use for form submission.
|
||||
public var formenctype:Formenctype? = nil
|
||||
|
||||
/// Variant to use for form submission.
|
||||
public var formmethod:Formmethod? = nil
|
||||
|
||||
/// Bypass form control validation for form submission.
|
||||
public var formnovalidate:Bool = false
|
||||
|
||||
/// Browsing context for form submission. Valid browsing context name or keyword.
|
||||
public var formtarget:String? = nil
|
||||
|
||||
/// Vertical dimension. Valid non-negative integer.
|
||||
public var height:UInt? = nil
|
||||
|
||||
/// List of autocomplete options. ID. The actual rules are more complicated than indicated.
|
||||
public var list:String? = nil
|
||||
|
||||
/// Maximum value. Varies. The actual rules are more complicated than indicated.
|
||||
public var max:String? = nil
|
||||
|
||||
/// Maximum length of value. Valid non-negative integer.
|
||||
public var maxlength:UInt? = nil
|
||||
|
||||
/// Minimum value. Varies. The actual rules are more complicated than indicated.
|
||||
public var min:String? = nil
|
||||
|
||||
/// Minimum length of value. Valid non-negative integer.
|
||||
public var minlength:UInt? = nil
|
||||
|
||||
/// Whether to allow multiple values.
|
||||
public var multiple:Bool = false
|
||||
|
||||
/// Name of the element to use for form submission and in the form.elements API. Text. The actual rules are more complicated than indicated.
|
||||
public var name:String? = nil
|
||||
|
||||
/// Pattern to be matched by the form control's value. Regular expression matching the JavaScript Pattern production.
|
||||
public var pattern:String? = nil
|
||||
|
||||
/// User-visible label to be placed within the form control. Text. The actual rules are more complicated than indicated.
|
||||
public var placeholder:String? = nil
|
||||
|
||||
/// Whether to allow the value to be edited by the user.
|
||||
public var readonly:Bool = false
|
||||
|
||||
/// Whether the control is required for form submission.
|
||||
public var required:Bool = false
|
||||
|
||||
/// Size of the control. Valid non-negative integer greater than zero.
|
||||
public var size:UInt? = nil
|
||||
|
||||
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
|
||||
public var src:URL? = nil
|
||||
|
||||
/// Granularity to be matched by the form control's value. Valid floating-point number greater than zero, or "any".
|
||||
public var step:Float? = nil
|
||||
|
||||
|
||||
/// Description of pattern (when used with pattern attribute).
|
||||
public var title:String? {
|
||||
get { return globalAttributes[.title] }
|
||||
set { globalAttributes[.title] = newValue }
|
||||
}
|
||||
|
||||
/// Type of form control or Type of form control. input type keyword or An input type e.g. "text"
|
||||
public var type:String? = nil
|
||||
|
||||
/// Value of the form control. Varies. The actual rules are more complicated than indicated.
|
||||
public var value:String? = nil
|
||||
|
||||
/// Horizontal dimension. Valid non-negative integer.
|
||||
public var width:UInt? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "accept":
|
||||
accept = try String.parseList(attValue, ",")
|
||||
continue
|
||||
case "alt":
|
||||
alt = attValue
|
||||
continue
|
||||
case "autocomplete":
|
||||
autocomplete = attValue
|
||||
continue
|
||||
case "checked":
|
||||
checked = true
|
||||
continue
|
||||
case "dirname":
|
||||
dirname = attValue
|
||||
continue
|
||||
case "disabled":
|
||||
disabled = true
|
||||
continue
|
||||
case "form":
|
||||
form = attValue
|
||||
continue
|
||||
case "formaction":
|
||||
formaction = try URL(expect: attValue)
|
||||
continue
|
||||
case "formenctype":
|
||||
formenctype = try Formenctype(expect: attValue)
|
||||
continue
|
||||
case "formmethod":
|
||||
formmethod = try Formmethod(expect: attValue)
|
||||
continue
|
||||
case "formnovalidate":
|
||||
formnovalidate = true
|
||||
continue
|
||||
case "formtarget":
|
||||
formtarget = attValue
|
||||
continue
|
||||
case "height":
|
||||
height = UInt(attValue)
|
||||
continue
|
||||
case "list":
|
||||
list = attValue
|
||||
continue
|
||||
case "max":
|
||||
max = attValue
|
||||
continue
|
||||
case "maxlength":
|
||||
maxlength = UInt(attValue)
|
||||
continue
|
||||
case "min":
|
||||
min = attValue
|
||||
continue
|
||||
case "minlength":
|
||||
minlength = UInt(attValue)
|
||||
continue
|
||||
case "multiple":
|
||||
multiple = true
|
||||
continue
|
||||
case "name":
|
||||
name = attValue
|
||||
continue
|
||||
case "pattern":
|
||||
pattern = attValue
|
||||
continue
|
||||
case "placeholder":
|
||||
placeholder = attValue
|
||||
continue
|
||||
case "readonly":
|
||||
readonly = true
|
||||
continue
|
||||
case "required":
|
||||
required = true
|
||||
continue
|
||||
case "size":
|
||||
size = UInt(attValue)
|
||||
continue
|
||||
case "src":
|
||||
src = try URL(expect: attValue)
|
||||
continue
|
||||
case "step":
|
||||
step = Float(attValue)
|
||||
continue
|
||||
case "type":
|
||||
type = attValue
|
||||
continue
|
||||
case "value":
|
||||
value = attValue
|
||||
continue
|
||||
case "width":
|
||||
width = UInt(attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
super.init(globalAttr)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
result += " accept='\(accept.toStringList(","))'"
|
||||
if let alt = alt {
|
||||
result += " alt='\(alt)'"
|
||||
}
|
||||
if let autocomplete = autocomplete {
|
||||
result += " autocomplete='\(autocomplete)'"
|
||||
}
|
||||
if checked {
|
||||
result += " checked"
|
||||
}
|
||||
if let dirname = dirname {
|
||||
result += " dirname='\(dirname)'"
|
||||
}
|
||||
if disabled {
|
||||
result += " disabled"
|
||||
}
|
||||
if let form = form {
|
||||
result += " form='\(form)'"
|
||||
}
|
||||
if let formaction = formaction {
|
||||
result += " formaction='\(formaction.absoluteString)'"
|
||||
}
|
||||
if let formenctype = formenctype {
|
||||
result += " formenctype='\(formenctype.rawValue)'"
|
||||
}
|
||||
if let formmethod = formmethod {
|
||||
result += " formmethod='\(formmethod.rawValue)'"
|
||||
}
|
||||
if formnovalidate {
|
||||
result += " formnovalidate"
|
||||
}
|
||||
if let formtarget = formtarget {
|
||||
result += " formtarget='\(formtarget)'"
|
||||
}
|
||||
if let height = height {
|
||||
result += " height='\(height)'"
|
||||
}
|
||||
if let list = list {
|
||||
result += " list='\(list)'"
|
||||
}
|
||||
if let max = max {
|
||||
result += " max='\(max)'"
|
||||
}
|
||||
if let maxlength = maxlength {
|
||||
result += " maxlength='\(maxlength)'"
|
||||
}
|
||||
if let min = min {
|
||||
result += " min='\(min)'"
|
||||
}
|
||||
if let minlength = minlength {
|
||||
result += " minlength='\(minlength)'"
|
||||
}
|
||||
if multiple {
|
||||
result += " multiple"
|
||||
}
|
||||
if let name = name {
|
||||
result += " name='\(name)'"
|
||||
}
|
||||
if let pattern = pattern {
|
||||
result += " pattern='\(pattern)'"
|
||||
}
|
||||
if let placeholder = placeholder {
|
||||
result += " placeholder='\(placeholder)'"
|
||||
}
|
||||
if readonly {
|
||||
result += " readonly"
|
||||
}
|
||||
if required {
|
||||
result += " required"
|
||||
}
|
||||
if let size = size {
|
||||
result += " size='\(size)'"
|
||||
}
|
||||
if let src = src {
|
||||
result += " src='\(src.absoluteString)'"
|
||||
}
|
||||
if let step = step {
|
||||
result += " step='\(step)'"
|
||||
}
|
||||
if let type = type {
|
||||
result += " type='\(type)'"
|
||||
}
|
||||
if let value = value {
|
||||
result += " value='\(value)'"
|
||||
}
|
||||
if let width = width {
|
||||
result += " width='\(width)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "input"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
66
Sources/HRW/GenHTML/Elements/Ins.swift
Normal file
66
Sources/HRW/GenHTML/Elements/Ins.swift
Normal file
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// Ins.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <ins> An addition to the document
|
||||
public class Ins : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
/// Link to the source of the quotation or more information about the edit. Valid URL potentially surrounded by spaces.
|
||||
public var cite:URL? = nil
|
||||
|
||||
/// Date and (optionally) time of the change. Valid date string with optional time.
|
||||
public var datetime:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "cite":
|
||||
cite = try URL(expect: attValue)
|
||||
continue
|
||||
case "datetime":
|
||||
datetime = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "ins", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let cite = cite {
|
||||
result += " cite='\(cite.absoluteString)'"
|
||||
}
|
||||
if let datetime = datetime {
|
||||
result += " datetime='\(datetime)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "ins"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Kbd.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Kbd.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Kbd.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <kbd> User input
|
||||
public class Kbd : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "kbd", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "kbd"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
61
Sources/HRW/GenHTML/Elements/Label.swift
Normal file
61
Sources/HRW/GenHTML/Elements/Label.swift
Normal file
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// Label.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <label> Caption for a form control
|
||||
public class Label : HTMLNode, IFlow, IInteractive, IPalpable, IPhrasing {
|
||||
|
||||
/// Associate the label with form control. ID. The actual rules are more complicated than indicated.
|
||||
public var for_:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "for":
|
||||
for_ = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "label", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let for_ = for_ {
|
||||
result += " for='\(for_)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "label"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
53
Sources/HRW/GenHTML/Elements/Legend.swift
Normal file
53
Sources/HRW/GenHTML/Elements/Legend.swift
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// Legend.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <legend> Caption for fieldset
|
||||
public class Legend : HTMLNode {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "legend", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IHeading) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "legend"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
61
Sources/HRW/GenHTML/Elements/Li.swift
Normal file
61
Sources/HRW/GenHTML/Elements/Li.swift
Normal file
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// Li.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <li> List item
|
||||
public class Li : HTMLNode {
|
||||
|
||||
/// Ordinal value of the list item. Valid integer.
|
||||
public var value:Int? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "value":
|
||||
value = Int(attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "li", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let value = value {
|
||||
result += " value='\(value)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "li"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
193
Sources/HRW/GenHTML/Elements/Link.swift
Normal file
193
Sources/HRW/GenHTML/Elements/Link.swift
Normal file
@@ -0,0 +1,193 @@
|
||||
//
|
||||
// Link.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <link> Link metadata
|
||||
public class Link : HTMLNode, IFlow, IMetaData, IPhrasing {
|
||||
|
||||
public enum Crossorigin : String, CaseIterable {
|
||||
|
||||
case anonymous
|
||||
case useCredentials = "use-credentials"
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Crossorigin: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Crossorigin(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Crossorigin: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Crossorigin] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Crossorigin(rawValue: input), "unexpected value for Crossorigin: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/// Potential destination for a preload request (for rel="preload" and rel="modulepreload"). Potential destination, for rel="preload"; script-like destination, for rel="modulepreload".
|
||||
public var as_:String? = nil
|
||||
|
||||
/// How the element handles crossorigin requests.
|
||||
public var crossorigin:Crossorigin? = nil
|
||||
|
||||
/// Address of the hyperlink. Valid non-empty URL potentially surrounded by spaces.
|
||||
public var href:URL? = nil
|
||||
|
||||
/// Language of the linked resource. Valid BCP 47 language tag.
|
||||
public var hreflang:String? = nil
|
||||
|
||||
/// Image sizes for different page layouts. Valid source size list.
|
||||
public var imagesizes:[String] = []
|
||||
|
||||
/// Images to use in different situations (e.g., high-resolution displays, small monitors, etc.). Comma-separated list of image candidate strings.
|
||||
public var imagesrcset:[String] = []
|
||||
|
||||
/// Integrity metadata used in Subresource Integrity checks [SRI].
|
||||
public var integrity:String? = nil
|
||||
|
||||
/// Applicable media. Valid media query list.
|
||||
public var media:String? = nil
|
||||
|
||||
/// Referrer policy for fetches initiated by the element. Referrer policy.
|
||||
public var referrerpolicy:ReferrerPolicy? = nil
|
||||
|
||||
/// Relationship between the document containing the hyperlink and the destination resource. Unordered set of unique space-separated tokens. The actual rules are more complicated than indicated.
|
||||
public var rel:[String] = []
|
||||
|
||||
/// Sizes of the icons (for rel="icon"). Unordered set of unique space-separated tokens, ASCII case-insensitive, consisting of sizes. The actual rules are more complicated than indicated.
|
||||
public var sizes:[String] = []
|
||||
|
||||
/// Title of the link or CSS style sheet set name. Text or Text
|
||||
public var title:String? = nil
|
||||
|
||||
/// Hint for the type of the referenced resource. Valid MIME type string.
|
||||
public var type:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "as":
|
||||
as_ = attValue
|
||||
continue
|
||||
case "crossorigin":
|
||||
crossorigin = try Crossorigin(expect: attValue)
|
||||
continue
|
||||
case "href":
|
||||
href = try URL(expect: attValue)
|
||||
continue
|
||||
case "hreflang":
|
||||
hreflang = attValue
|
||||
continue
|
||||
case "imagesizes":
|
||||
imagesizes = try String.parseList(attValue, ",")
|
||||
continue
|
||||
case "imagesrcset":
|
||||
imagesrcset = try String.parseList(attValue, ",")
|
||||
continue
|
||||
case "integrity":
|
||||
integrity = attValue
|
||||
continue
|
||||
case "media":
|
||||
media = attValue
|
||||
continue
|
||||
case "referrerpolicy":
|
||||
referrerpolicy = try ReferrerPolicy(expect: attValue)
|
||||
continue
|
||||
case "rel":
|
||||
rel = try String.parseList(attValue, " ")
|
||||
continue
|
||||
case "sizes":
|
||||
sizes = try String.parseList(attValue, " ")
|
||||
continue
|
||||
case "title":
|
||||
title = attValue
|
||||
continue
|
||||
case "type":
|
||||
type = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
super.init(globalAttr)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let as_ = as_ {
|
||||
result += " as='\(as_)'"
|
||||
}
|
||||
if let crossorigin = crossorigin {
|
||||
result += " crossorigin='\(crossorigin.rawValue)'"
|
||||
}
|
||||
if let href = href {
|
||||
result += " href='\(href.absoluteString)'"
|
||||
}
|
||||
if let hreflang = hreflang {
|
||||
result += " hreflang='\(hreflang)'"
|
||||
}
|
||||
result += " imagesizes='\(imagesizes.toStringList(","))'"
|
||||
result += " imagesrcset='\(imagesrcset.toStringList(","))'"
|
||||
if let integrity = integrity {
|
||||
result += " integrity='\(integrity)'"
|
||||
}
|
||||
if let media = media {
|
||||
result += " media='\(media)'"
|
||||
}
|
||||
if let referrerpolicy = referrerpolicy {
|
||||
result += " referrerpolicy='\(referrerpolicy.rawValue)'"
|
||||
}
|
||||
result += " rel='\(rel.toStringList(" "))'"
|
||||
result += " sizes='\(sizes.toStringList(" "))'"
|
||||
if let title = title {
|
||||
result += " title='\(title)'"
|
||||
}
|
||||
if let type = type {
|
||||
result += " type='\(type)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "link"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/MainElement.swift
Normal file
49
Sources/HRW/GenHTML/Elements/MainElement.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Main.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <main> Container for the dominant contents of the document
|
||||
public class Main : HTMLNode, IFlow, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "main", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "main"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
57
Sources/HRW/GenHTML/Elements/Map.swift
Normal file
57
Sources/HRW/GenHTML/Elements/Map.swift
Normal file
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// Map.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <map> Image map
|
||||
public class Map : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
/// Name of image map to reference from the usemap attribute. Text. The actual rules are more complicated than indicated.
|
||||
public var name:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "name":
|
||||
name = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "map", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let name = name {
|
||||
result += " name='\(name)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "map"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Mark.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Mark.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Mark.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <mark> Highlight
|
||||
public class Mark : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "mark", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "mark"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Menu.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Menu.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Menu.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <menu> Menu of commands
|
||||
public class Menu : HTMLNode, IFlow, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "menu", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IScriptSupporting) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "menu"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
162
Sources/HRW/GenHTML/Elements/Meta.swift
Normal file
162
Sources/HRW/GenHTML/Elements/Meta.swift
Normal file
@@ -0,0 +1,162 @@
|
||||
//
|
||||
// Meta.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <meta> Text metadata
|
||||
public class Meta : HTMLNode, IFlow, IMetaData, IPhrasing {
|
||||
|
||||
public enum Charset : String, CaseIterable {
|
||||
|
||||
case utf8 = "utf-8"
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Charset: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Charset(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Charset: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Charset] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Charset(rawValue: input), "unexpected value for Charset: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
public enum Http_equiv : String, CaseIterable {
|
||||
|
||||
case contentSecurityPolicy = "content-security-policy"
|
||||
case contentType = "content-type"
|
||||
case defaultStyle = "default-style"
|
||||
case refresh
|
||||
case xUaCompatible = "x-ua-compatible"
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Http_equiv: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Http_equiv(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Http_equiv: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Http_equiv] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Http_equiv(rawValue: input), "unexpected value for Http_equiv: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/// Character encoding declaration.
|
||||
public var charset:Charset? = nil
|
||||
|
||||
/// Value of the element. Text. The actual rules are more complicated than indicated.
|
||||
public var content:String? = nil
|
||||
|
||||
/// Pragma directive.
|
||||
public var http_equiv:Http_equiv? = nil
|
||||
|
||||
/// Metadata name. Text. The actual rules are more complicated than indicated.
|
||||
public var name:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "charset":
|
||||
charset = try Charset(expect: attValue)
|
||||
continue
|
||||
case "content":
|
||||
content = attValue
|
||||
continue
|
||||
case "http-equiv":
|
||||
http_equiv = try Http_equiv(expect: attValue)
|
||||
continue
|
||||
case "name":
|
||||
name = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
super.init(globalAttr)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let charset = charset {
|
||||
result += " charset='\(charset.rawValue)'"
|
||||
}
|
||||
if let content = content {
|
||||
result += " content='\(content)'"
|
||||
}
|
||||
if let http_equiv = http_equiv {
|
||||
result += " http-equiv='\(http_equiv.rawValue)'"
|
||||
}
|
||||
if let name = name {
|
||||
result += " name='\(name)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "meta"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
106
Sources/HRW/GenHTML/Elements/Meter.swift
Normal file
106
Sources/HRW/GenHTML/Elements/Meter.swift
Normal file
@@ -0,0 +1,106 @@
|
||||
//
|
||||
// Meter.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <meter> Gauge
|
||||
public class Meter : HTMLNode, IFlow, ILabelable, IPalpable, IPhrasing {
|
||||
|
||||
/// Low limit of high range. Valid floating-point number. The actual rules are more complicated than indicated.
|
||||
public var high:Float? = nil
|
||||
|
||||
/// High limit of low range. Valid floating-point number. The actual rules are more complicated than indicated.
|
||||
public var low:Float? = nil
|
||||
|
||||
/// Upper bound of range. Valid floating-point number. The actual rules are more complicated than indicated.
|
||||
public var max:Float? = nil
|
||||
|
||||
/// Lower bound of range. Valid floating-point number. The actual rules are more complicated than indicated.
|
||||
public var min:Float? = nil
|
||||
|
||||
/// Optimum value in gauge. Valid floating-point number. The actual rules are more complicated than indicated.
|
||||
public var optimum:Float? = nil
|
||||
|
||||
/// Current value of the element. Valid floating-point number.
|
||||
public var value:Float? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "high":
|
||||
high = Float(attValue)
|
||||
continue
|
||||
case "low":
|
||||
low = Float(attValue)
|
||||
continue
|
||||
case "max":
|
||||
max = Float(attValue)
|
||||
continue
|
||||
case "min":
|
||||
min = Float(attValue)
|
||||
continue
|
||||
case "optimum":
|
||||
optimum = Float(attValue)
|
||||
continue
|
||||
case "value":
|
||||
value = Float(attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "meter", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let high = high {
|
||||
result += " high='\(high)'"
|
||||
}
|
||||
if let low = low {
|
||||
result += " low='\(low)'"
|
||||
}
|
||||
if let max = max {
|
||||
result += " max='\(max)'"
|
||||
}
|
||||
if let min = min {
|
||||
result += " min='\(min)'"
|
||||
}
|
||||
if let optimum = optimum {
|
||||
result += " optimum='\(optimum)'"
|
||||
}
|
||||
if let value = value {
|
||||
result += " value='\(value)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "meter"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Nav.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Nav.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Nav.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <nav> Section with navigational links
|
||||
public class Nav : HTMLNode, IFlow, IPalpable, ISectioning {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "nav", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "nav"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
45
Sources/HRW/GenHTML/Elements/Noscript.swift
Normal file
45
Sources/HRW/GenHTML/Elements/Noscript.swift
Normal file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// Noscript.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <noscript> Fallback content for script
|
||||
public class Noscript : HTMLNode, IFlow, IMetaData, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "noscript", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "noscript"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
111
Sources/HRW/GenHTML/Elements/Object.swift
Normal file
111
Sources/HRW/GenHTML/Elements/Object.swift
Normal file
@@ -0,0 +1,111 @@
|
||||
//
|
||||
// Object.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <object> Image, nested browsing context, or plugin
|
||||
public class Object : HTMLNode, IEmbedded, IFlow, IFormAssociated, IInteractive, IListed, IPalpable, IPhrasing, ISubmittable {
|
||||
|
||||
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
|
||||
public var data:URL? = nil
|
||||
|
||||
/// Associates the element with a form element. ID. The actual rules are more complicated than indicated.
|
||||
public var form:String? = nil
|
||||
|
||||
/// Vertical dimension. Valid non-negative integer.
|
||||
public var height:UInt? = nil
|
||||
|
||||
/// Name of nested browsing context. Valid browsing context name or keyword.
|
||||
public var name:String? = nil
|
||||
|
||||
/// Type of embedded resource. Valid MIME type string.
|
||||
public var type:String? = nil
|
||||
|
||||
/// Name of image map to use. Valid hash-name reference. The actual rules are more complicated than indicated.
|
||||
public var usemap:String? = nil
|
||||
|
||||
/// Horizontal dimension. Valid non-negative integer.
|
||||
public var width:UInt? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "data":
|
||||
data = try URL(expect: attValue)
|
||||
continue
|
||||
case "form":
|
||||
form = attValue
|
||||
continue
|
||||
case "height":
|
||||
height = UInt(attValue)
|
||||
continue
|
||||
case "name":
|
||||
name = attValue
|
||||
continue
|
||||
case "type":
|
||||
type = attValue
|
||||
continue
|
||||
case "usemap":
|
||||
usemap = attValue
|
||||
continue
|
||||
case "width":
|
||||
width = UInt(attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "object", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let data = data {
|
||||
result += " data='\(data.absoluteString)'"
|
||||
}
|
||||
if let form = form {
|
||||
result += " form='\(form)'"
|
||||
}
|
||||
if let height = height {
|
||||
result += " height='\(height)'"
|
||||
}
|
||||
if let name = name {
|
||||
result += " name='\(name)'"
|
||||
}
|
||||
if let type = type {
|
||||
result += " type='\(type)'"
|
||||
}
|
||||
if let usemap = usemap {
|
||||
result += " usemap='\(usemap)'"
|
||||
}
|
||||
if let width = width {
|
||||
result += " width='\(width)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "object"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
122
Sources/HRW/GenHTML/Elements/Ol.swift
Normal file
122
Sources/HRW/GenHTML/Elements/Ol.swift
Normal file
@@ -0,0 +1,122 @@
|
||||
//
|
||||
// Ol.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <ol> Ordered list
|
||||
public class Ol : HTMLNode, IFlow, IPalpable {
|
||||
|
||||
public enum AttrType : String, CaseIterable {
|
||||
|
||||
case one = "1"
|
||||
case A
|
||||
case I
|
||||
case a
|
||||
case i
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for AttrType: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = AttrType(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for AttrType: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [AttrType] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(AttrType(rawValue: input), "unexpected value for AttrType: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/// Number the list backwards.
|
||||
public var reversed:Bool = false
|
||||
|
||||
/// Starting value of the list. Valid integer.
|
||||
public var start:Int? = nil
|
||||
|
||||
/// Kind of list marker.
|
||||
public var type:AttrType? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "reversed":
|
||||
reversed = true
|
||||
continue
|
||||
case "start":
|
||||
start = Int(attValue)
|
||||
continue
|
||||
case "type":
|
||||
type = try AttrType(expect: attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "ol", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IScriptSupporting) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if reversed {
|
||||
result += " reversed"
|
||||
}
|
||||
if let start = start {
|
||||
result += " start='\(start)'"
|
||||
}
|
||||
if let type = type {
|
||||
result += " type='\(type.rawValue)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "ol"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
70
Sources/HRW/GenHTML/Elements/Optgroup.swift
Normal file
70
Sources/HRW/GenHTML/Elements/Optgroup.swift
Normal file
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// Optgroup.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <optgroup> Group of options in a list box
|
||||
public class Optgroup : HTMLNode {
|
||||
|
||||
/// Whether the form control is disabled.
|
||||
public var disabled:Bool = false
|
||||
|
||||
/// User-visible label.
|
||||
public var label:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "disabled":
|
||||
disabled = true
|
||||
continue
|
||||
case "label":
|
||||
label = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "optgroup", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IScriptSupporting) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if disabled {
|
||||
result += " disabled"
|
||||
}
|
||||
if let label = label {
|
||||
result += " label='\(label)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "optgroup"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
84
Sources/HRW/GenHTML/Elements/Option.swift
Normal file
84
Sources/HRW/GenHTML/Elements/Option.swift
Normal file
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// Option.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <option> Option in a list box or combo box control
|
||||
public class Option : HTMLNode {
|
||||
|
||||
/// Whether the form control is disabled.
|
||||
public var disabled:Bool = false
|
||||
|
||||
/// User-visible label.
|
||||
public var label:String? = nil
|
||||
|
||||
/// Whether the option is selected by default.
|
||||
public var selected:Bool = false
|
||||
|
||||
/// Value to be used for form submission.
|
||||
public var value:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "disabled":
|
||||
disabled = true
|
||||
continue
|
||||
case "label":
|
||||
label = attValue
|
||||
continue
|
||||
case "selected":
|
||||
selected = true
|
||||
continue
|
||||
case "value":
|
||||
value = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "option", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if disabled {
|
||||
result += " disabled"
|
||||
}
|
||||
if let label = label {
|
||||
result += " label='\(label)'"
|
||||
}
|
||||
if selected {
|
||||
result += " selected"
|
||||
}
|
||||
if let value = value {
|
||||
result += " value='\(value)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "option"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
77
Sources/HRW/GenHTML/Elements/Output.swift
Normal file
77
Sources/HRW/GenHTML/Elements/Output.swift
Normal file
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// Output.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <output> Calculated output value
|
||||
public class Output : HTMLNode, IFlow, IFormAssociated, ILabelable, IListed, IPalpable, IPhrasing, IResettable {
|
||||
|
||||
/// Specifies controls from which the output was calculated. Unordered set of unique space-separated tokens, case-sensitive, consisting of IDs. The actual rules are more complicated than indicated.
|
||||
public var for_:[String] = []
|
||||
|
||||
/// Associates the element with a form element. ID. The actual rules are more complicated than indicated.
|
||||
public var form:String? = nil
|
||||
|
||||
/// Name of the element to use for form submission and in the form.elements API. Text. The actual rules are more complicated than indicated.
|
||||
public var name:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "for":
|
||||
for_ = try String.parseList(attValue, " ")
|
||||
continue
|
||||
case "form":
|
||||
form = attValue
|
||||
continue
|
||||
case "name":
|
||||
name = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "output", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
result += " for='\(for_.toStringList(" "))'"
|
||||
if let form = form {
|
||||
result += " form='\(form)'"
|
||||
}
|
||||
if let name = name {
|
||||
result += " name='\(name)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "output"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/P.swift
Normal file
49
Sources/HRW/GenHTML/Elements/P.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// P.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <p> Paragraph
|
||||
public class P : HTMLNode, IFlow, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "p", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "p"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
62
Sources/HRW/GenHTML/Elements/Param.swift
Normal file
62
Sources/HRW/GenHTML/Elements/Param.swift
Normal file
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// Param.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <param> Parameter for object
|
||||
public class Param : HTMLNode {
|
||||
|
||||
/// Name of parameter.
|
||||
public var name:String? = nil
|
||||
|
||||
/// Value of parameter.
|
||||
public var value:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "name":
|
||||
name = attValue
|
||||
continue
|
||||
case "value":
|
||||
value = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
super.init(globalAttr)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let name = name {
|
||||
result += " name='\(name)'"
|
||||
}
|
||||
if let value = value {
|
||||
result += " value='\(value)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "param"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
53
Sources/HRW/GenHTML/Elements/Picture.swift
Normal file
53
Sources/HRW/GenHTML/Elements/Picture.swift
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// Picture.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <picture> Image
|
||||
public class Picture : HTMLNode, IEmbedded, IFlow, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "picture", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IScriptSupporting) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public func addChild(_ someElement:Img) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "picture"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Pre.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Pre.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Pre.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <pre> Block of preformatted text
|
||||
public class Pre : HTMLNode, IFlow, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "pre", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "pre"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
70
Sources/HRW/GenHTML/Elements/Progress.swift
Normal file
70
Sources/HRW/GenHTML/Elements/Progress.swift
Normal file
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// Progress.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <progress> Progress bar
|
||||
public class Progress : HTMLNode, IFlow, ILabelable, IPalpable, IPhrasing {
|
||||
|
||||
/// Upper bound of range. Valid floating-point number. The actual rules are more complicated than indicated.
|
||||
public var max:Float? = nil
|
||||
|
||||
/// Current value of the element. Valid floating-point number.
|
||||
public var value:Float? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "max":
|
||||
max = Float(attValue)
|
||||
continue
|
||||
case "value":
|
||||
value = Float(attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "progress", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let max = max {
|
||||
result += " max='\(max)'"
|
||||
}
|
||||
if let value = value {
|
||||
result += " value='\(value)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "progress"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
61
Sources/HRW/GenHTML/Elements/Q.swift
Normal file
61
Sources/HRW/GenHTML/Elements/Q.swift
Normal file
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// Q.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <q> Quotation
|
||||
public class Q : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
/// Link to the source of the quotation or more information about the edit. Valid URL potentially surrounded by spaces.
|
||||
public var cite:URL? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "cite":
|
||||
cite = try URL(expect: attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "q", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let cite = cite {
|
||||
result += " cite='\(cite.absoluteString)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "q"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
45
Sources/HRW/GenHTML/Elements/Rp.swift
Normal file
45
Sources/HRW/GenHTML/Elements/Rp.swift
Normal file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// Rp.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <rp> Parenthesis for ruby annotation text
|
||||
public class Rp : HTMLNode {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "rp", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "rp"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Rt.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Rt.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Rt.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <rt> Ruby annotation text
|
||||
public class Rt : HTMLNode {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "rt", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "rt"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Ruby.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Ruby.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Ruby.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <ruby> Ruby annotation(s)
|
||||
public class Ruby : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "ruby", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "ruby"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/S.swift
Normal file
49
Sources/HRW/GenHTML/Elements/S.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// S.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <s> Inaccurate text
|
||||
public class S : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "s", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "s"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Samp.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Samp.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Samp.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <samp> Computer output
|
||||
public class Samp : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "samp", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "samp"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
151
Sources/HRW/GenHTML/Elements/Script.swift
Normal file
151
Sources/HRW/GenHTML/Elements/Script.swift
Normal file
@@ -0,0 +1,151 @@
|
||||
//
|
||||
// Script.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <script> Embedded script
|
||||
public class Script : HTMLNode, IFlow, IMetaData, IPhrasing, IScriptSupporting {
|
||||
|
||||
public enum Crossorigin : String, CaseIterable {
|
||||
|
||||
case anonymous
|
||||
case useCredentials = "use-credentials"
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Crossorigin: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Crossorigin(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Crossorigin: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Crossorigin] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Crossorigin(rawValue: input), "unexpected value for Crossorigin: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/// Execute script when available, without blocking while fetching.
|
||||
public var async:Bool = false
|
||||
|
||||
/// How the element handles crossorigin requests.
|
||||
public var crossorigin:Crossorigin? = nil
|
||||
|
||||
/// Defer script execution.
|
||||
public var defer_:Bool = false
|
||||
|
||||
/// Integrity metadata used in Subresource Integrity checks [SRI].
|
||||
public var integrity:String? = nil
|
||||
|
||||
/// Referrer policy for fetches initiated by the element. Referrer policy.
|
||||
public var referrerpolicy:ReferrerPolicy? = nil
|
||||
|
||||
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
|
||||
public var src:URL? = nil
|
||||
|
||||
/// Type of script. "module"; a valid MIME type string that is not a JavaScript MIME type essence match.
|
||||
public var type:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "async":
|
||||
async = true
|
||||
continue
|
||||
case "crossorigin":
|
||||
crossorigin = try Crossorigin(expect: attValue)
|
||||
continue
|
||||
case "defer":
|
||||
defer_ = true
|
||||
continue
|
||||
case "integrity":
|
||||
integrity = attValue
|
||||
continue
|
||||
case "referrerpolicy":
|
||||
referrerpolicy = try ReferrerPolicy(expect: attValue)
|
||||
continue
|
||||
case "src":
|
||||
src = try URL(expect: attValue)
|
||||
continue
|
||||
case "type":
|
||||
type = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "script", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if async {
|
||||
result += " async"
|
||||
}
|
||||
if let crossorigin = crossorigin {
|
||||
result += " crossorigin='\(crossorigin.rawValue)'"
|
||||
}
|
||||
if defer_ {
|
||||
result += " defer"
|
||||
}
|
||||
if let integrity = integrity {
|
||||
result += " integrity='\(integrity)'"
|
||||
}
|
||||
if let referrerpolicy = referrerpolicy {
|
||||
result += " referrerpolicy='\(referrerpolicy.rawValue)'"
|
||||
}
|
||||
if let src = src {
|
||||
result += " src='\(src.absoluteString)'"
|
||||
}
|
||||
if let type = type {
|
||||
result += " type='\(type)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "script"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Section.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Section.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Section.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <section> Generic document or application section
|
||||
public class Section : HTMLNode, IFlow, IPalpable, ISectioning {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "section", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "section"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
115
Sources/HRW/GenHTML/Elements/Select.swift
Normal file
115
Sources/HRW/GenHTML/Elements/Select.swift
Normal file
@@ -0,0 +1,115 @@
|
||||
//
|
||||
// Select.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <select> List box control
|
||||
public class Select : HTMLNode, IFlow, IFormAssociated, IInteractive, ILabelable, IListed, IPalpable, IPhrasing, IResettable, ISubmittable {
|
||||
|
||||
/// Hint for form autofill feature. Autofill field name and related tokens. The actual rules are more complicated than indicated.
|
||||
public var autocomplete:String? = nil
|
||||
|
||||
/// Whether the form control is disabled.
|
||||
public var disabled:Bool = false
|
||||
|
||||
/// Associates the element with a form element. ID. The actual rules are more complicated than indicated.
|
||||
public var form:String? = nil
|
||||
|
||||
/// Whether to allow multiple values.
|
||||
public var multiple:Bool = false
|
||||
|
||||
/// Name of the element to use for form submission and in the form.elements API. Text. The actual rules are more complicated than indicated.
|
||||
public var name:String? = nil
|
||||
|
||||
/// Whether the control is required for form submission.
|
||||
public var required:Bool = false
|
||||
|
||||
/// Size of the control. Valid non-negative integer greater than zero.
|
||||
public var size:UInt? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "autocomplete":
|
||||
autocomplete = attValue
|
||||
continue
|
||||
case "disabled":
|
||||
disabled = true
|
||||
continue
|
||||
case "form":
|
||||
form = attValue
|
||||
continue
|
||||
case "multiple":
|
||||
multiple = true
|
||||
continue
|
||||
case "name":
|
||||
name = attValue
|
||||
continue
|
||||
case "required":
|
||||
required = true
|
||||
continue
|
||||
case "size":
|
||||
size = UInt(attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "select", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IScriptSupporting) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let autocomplete = autocomplete {
|
||||
result += " autocomplete='\(autocomplete)'"
|
||||
}
|
||||
if disabled {
|
||||
result += " disabled"
|
||||
}
|
||||
if let form = form {
|
||||
result += " form='\(form)'"
|
||||
}
|
||||
if multiple {
|
||||
result += " multiple"
|
||||
}
|
||||
if let name = name {
|
||||
result += " name='\(name)'"
|
||||
}
|
||||
if required {
|
||||
result += " required"
|
||||
}
|
||||
if let size = size {
|
||||
result += " size='\(size)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "select"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
57
Sources/HRW/GenHTML/Elements/Slot.swift
Normal file
57
Sources/HRW/GenHTML/Elements/Slot.swift
Normal file
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// Slot.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <slot> Shadow tree slot
|
||||
public class Slot : HTMLNode, IFlow, IPhrasing {
|
||||
|
||||
/// Name of shadow tree slot.
|
||||
public var name:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "name":
|
||||
name = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "slot", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let name = name {
|
||||
result += " name='\(name)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "slot"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Small.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Small.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Small.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <small> Side comment
|
||||
public class Small : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "small", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "small"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
85
Sources/HRW/GenHTML/Elements/Source.swift
Normal file
85
Sources/HRW/GenHTML/Elements/Source.swift
Normal file
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// Source.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <source> Image source for img or media source for video or audio
|
||||
public class Source : HTMLNode {
|
||||
|
||||
/// Applicable media. Valid media query list.
|
||||
public var media:String? = nil
|
||||
|
||||
/// Image sizes for different page layouts. Valid source size list.
|
||||
public var sizes:[String] = []
|
||||
|
||||
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
|
||||
public var src:URL? = nil
|
||||
|
||||
/// Images to use in different situations (e.g., high-resolution displays, small monitors, etc.). Comma-separated list of image candidate strings.
|
||||
public var srcset:[String] = []
|
||||
|
||||
/// Type of embedded resource. Valid MIME type string.
|
||||
public var type:String? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "media":
|
||||
media = attValue
|
||||
continue
|
||||
case "sizes":
|
||||
sizes = try String.parseList(attValue, ",")
|
||||
continue
|
||||
case "src":
|
||||
src = try URL(expect: attValue)
|
||||
continue
|
||||
case "srcset":
|
||||
srcset = try String.parseList(attValue, ",")
|
||||
continue
|
||||
case "type":
|
||||
type = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
super.init(globalAttr)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let media = media {
|
||||
result += " media='\(media)'"
|
||||
}
|
||||
result += " sizes='\(sizes.toStringList(","))'"
|
||||
if let src = src {
|
||||
result += " src='\(src.absoluteString)'"
|
||||
}
|
||||
result += " srcset='\(srcset.toStringList(","))'"
|
||||
if let type = type {
|
||||
result += " type='\(type)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "source"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Span.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Span.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Span.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <span> Generic phrasing container
|
||||
public class Span : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "span", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "span"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Strong.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Strong.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Strong.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <strong> Importance
|
||||
public class Strong : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "strong", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "strong"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
64
Sources/HRW/GenHTML/Elements/Style.swift
Normal file
64
Sources/HRW/GenHTML/Elements/Style.swift
Normal file
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// Style.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <style> Embedded styling information
|
||||
public class Style : HTMLNode, IMetaData {
|
||||
|
||||
/// Applicable media. Valid media query list.
|
||||
public var media:String? = nil
|
||||
|
||||
|
||||
/// CSS style sheet set name.
|
||||
public var title:String? {
|
||||
get { return globalAttributes[.title] }
|
||||
set { globalAttributes[.title] = newValue }
|
||||
}
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "media":
|
||||
media = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "style", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let media = media {
|
||||
result += " media='\(media)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "style"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Sub.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Sub.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Sub.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <sub> Subscript
|
||||
public class Sub : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "sub", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "sub"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
53
Sources/HRW/GenHTML/Elements/Summary.swift
Normal file
53
Sources/HRW/GenHTML/Elements/Summary.swift
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// Summary.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <summary> Caption for details
|
||||
public class Summary : HTMLNode {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "summary", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IHeading) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "summary"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Sup.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Sup.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Sup.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <sup> Superscript
|
||||
public class Sup : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "sup", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IPhrasing) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "sup"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Table.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Table.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Table.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <table> Table
|
||||
public class Table : HTMLNode, IFlow, IPalpable {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "table", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IScriptSupporting) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "table"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
49
Sources/HRW/GenHTML/Elements/Tbody.swift
Normal file
49
Sources/HRW/GenHTML/Elements/Tbody.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Tbody.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <tbody> Group of rows in a table
|
||||
public class Tbody : HTMLNode {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "tbody", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IScriptSupporting) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "tbody"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
77
Sources/HRW/GenHTML/Elements/Td.swift
Normal file
77
Sources/HRW/GenHTML/Elements/Td.swift
Normal file
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// Td.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <td> Table cell
|
||||
public class Td : HTMLNode, ISectioningRoot {
|
||||
|
||||
/// Number of columns that the cell is to span. Valid non-negative integer greater than zero.
|
||||
public var colspan:UInt? = nil
|
||||
|
||||
/// The header cells for this cell. Unordered set of unique space-separated tokens, case-sensitive, consisting of IDs. The actual rules are more complicated than indicated.
|
||||
public var headers:[String] = []
|
||||
|
||||
/// Number of rows that the cell is to span. Valid non-negative integer.
|
||||
public var rowspan:UInt? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "colspan":
|
||||
colspan = UInt(attValue)
|
||||
continue
|
||||
case "headers":
|
||||
headers = try String.parseList(attValue, " ")
|
||||
continue
|
||||
case "rowspan":
|
||||
rowspan = UInt(attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "td", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IFlow) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let colspan = colspan {
|
||||
result += " colspan='\(colspan)'"
|
||||
}
|
||||
result += " headers='\(headers.toStringList(" "))'"
|
||||
if let rowspan = rowspan {
|
||||
result += " rowspan='\(rowspan)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "td"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
45
Sources/HRW/GenHTML/Elements/Template.swift
Normal file
45
Sources/HRW/GenHTML/Elements/Template.swift
Normal file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// Template.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <template> Template
|
||||
public class Template : HTMLNode, IFlow, IMetaData, IPhrasing, IScriptSupporting {
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "template", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "template"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
196
Sources/HRW/GenHTML/Elements/Textarea.swift
Normal file
196
Sources/HRW/GenHTML/Elements/Textarea.swift
Normal file
@@ -0,0 +1,196 @@
|
||||
//
|
||||
// Textarea.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <textarea> Multiline text controls
|
||||
public class Textarea : HTMLNode, IFlow, IFormAssociated, IInteractive, ILabelable, IListed, IPalpable, IPhrasing, IResettable, ISubmittable {
|
||||
|
||||
public enum Wrap : String, CaseIterable {
|
||||
|
||||
case hard
|
||||
case soft
|
||||
|
||||
public init?(rawValue: Substring) {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
|
||||
else
|
||||
{ return nil }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: Substring) throws {
|
||||
guard
|
||||
let value = Self.allCases.first(where: { $0.rawValue == expect })
|
||||
else
|
||||
{ throw AppError("Unexpected value for Wrap: \(expect)") }
|
||||
|
||||
self = value
|
||||
}
|
||||
|
||||
public init(expect: String) throws {
|
||||
guard let result = Wrap(rawValue: expect) else {
|
||||
throw AppError("Unexpected value for Wrap: \(expect)")
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Wrap] {
|
||||
guard let value = value else { return [] }
|
||||
var iterator = value.componentsIterator(separatedBy: separator)
|
||||
let result = try iterator.map { input in
|
||||
return try expect(Wrap(rawValue: input), "unexpected value for Wrap: \(input)")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/// Maximum number of characters per line. Valid non-negative integer greater than zero.
|
||||
public var cols:UInt? = nil
|
||||
|
||||
/// Name of form control to use for sending the element's directionality in form submission. Text. The actual rules are more complicated than indicated.
|
||||
public var dirname:String? = nil
|
||||
|
||||
/// Whether the form control is disabled.
|
||||
public var disabled:Bool = false
|
||||
|
||||
/// Associates the element with a form element. ID. The actual rules are more complicated than indicated.
|
||||
public var form:String? = nil
|
||||
|
||||
/// Maximum length of value. Valid non-negative integer.
|
||||
public var maxlength:UInt? = nil
|
||||
|
||||
/// Minimum length of value. Valid non-negative integer.
|
||||
public var minlength:UInt? = nil
|
||||
|
||||
/// Name of the element to use for form submission and in the form.elements API. Text. The actual rules are more complicated than indicated.
|
||||
public var name:String? = nil
|
||||
|
||||
/// User-visible label to be placed within the form control. Text. The actual rules are more complicated than indicated.
|
||||
public var placeholder:String? = nil
|
||||
|
||||
/// Whether to allow the value to be edited by the user.
|
||||
public var readonly:Bool = false
|
||||
|
||||
/// Whether the control is required for form submission.
|
||||
public var required:Bool = false
|
||||
|
||||
/// Number of lines to show. Valid non-negative integer greater than zero.
|
||||
public var rows:UInt? = nil
|
||||
|
||||
/// How the value of the form control is to be wrapped for form submission.
|
||||
public var wrap:Wrap? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "cols":
|
||||
cols = UInt(attValue)
|
||||
continue
|
||||
case "dirname":
|
||||
dirname = attValue
|
||||
continue
|
||||
case "disabled":
|
||||
disabled = true
|
||||
continue
|
||||
case "form":
|
||||
form = attValue
|
||||
continue
|
||||
case "maxlength":
|
||||
maxlength = UInt(attValue)
|
||||
continue
|
||||
case "minlength":
|
||||
minlength = UInt(attValue)
|
||||
continue
|
||||
case "name":
|
||||
name = attValue
|
||||
continue
|
||||
case "placeholder":
|
||||
placeholder = attValue
|
||||
continue
|
||||
case "readonly":
|
||||
readonly = true
|
||||
continue
|
||||
case "required":
|
||||
required = true
|
||||
continue
|
||||
case "rows":
|
||||
rows = UInt(attValue)
|
||||
continue
|
||||
case "wrap":
|
||||
wrap = try Wrap(expect: attValue)
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "textarea", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let cols = cols {
|
||||
result += " cols='\(cols)'"
|
||||
}
|
||||
if let dirname = dirname {
|
||||
result += " dirname='\(dirname)'"
|
||||
}
|
||||
if disabled {
|
||||
result += " disabled"
|
||||
}
|
||||
if let form = form {
|
||||
result += " form='\(form)'"
|
||||
}
|
||||
if let maxlength = maxlength {
|
||||
result += " maxlength='\(maxlength)'"
|
||||
}
|
||||
if let minlength = minlength {
|
||||
result += " minlength='\(minlength)'"
|
||||
}
|
||||
if let name = name {
|
||||
result += " name='\(name)'"
|
||||
}
|
||||
if let placeholder = placeholder {
|
||||
result += " placeholder='\(placeholder)'"
|
||||
}
|
||||
if readonly {
|
||||
result += " readonly"
|
||||
}
|
||||
if required {
|
||||
result += " required"
|
||||
}
|
||||
if let rows = rows {
|
||||
result += " rows='\(rows)'"
|
||||
}
|
||||
if let wrap = wrap {
|
||||
result += " wrap='\(wrap.rawValue)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "textarea"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user