Compare commits
2 Commits
743fc51873
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
603a0aa0e3
|
|||
|
58a8419984
|
97
CLA.txt
Normal file
97
CLA.txt
Normal file
@@ -0,0 +1,97 @@
|
||||
You accept and agree to the following terms and conditions for Your
|
||||
Contributions (present and future) that you submit to the Grantee. In
|
||||
return, the Grantee shall not use Your Contributions in a way that
|
||||
is contrary to the public benefit. Except for the license granted
|
||||
herein to the Grantee and recipients of software distributed by the
|
||||
Grantee, You reserve all right, title, and interest in and to Your
|
||||
Contributions.
|
||||
|
||||
1. Definitions.
|
||||
"The Grantee" shall mean Isaac Roy Paul (a.k.a izackp@gmail.com), a
|
||||
individual with its principal place of business in Florida, USA.
|
||||
"You" (or "Your") shall mean the copyright owner or legal entity
|
||||
authorized by the copyright owner that is making this Agreement
|
||||
with the Grantee. For legal entities, the entity making a
|
||||
Contribution and all other entities that control, are controlled
|
||||
by, or are under common control with that entity are considered to
|
||||
be a single Contributor. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
"Contribution" shall mean any original work of authorship,
|
||||
including any modifications or additions to an existing work, that
|
||||
is intentionally submitted by You to the Grantee for inclusion
|
||||
in, or documentation of, any of the products owned or managed by
|
||||
the Grantee (the "Work"). For the purposes of this definition,
|
||||
"submitted" means any form of electronic, verbal, or written
|
||||
communication sent to the Grantee or its representatives,
|
||||
including but not limited to communication on electronic mailing
|
||||
lists, source code control systems, and issue tracking systems that
|
||||
are managed by, or on behalf of, the Grantee for the purpose of
|
||||
discussing and improving the Work, but excluding communication that
|
||||
is conspicuously marked or otherwise designated in writing by You
|
||||
as "Not a Contribution."
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this Agreement, You hereby grant to the Grantee and to
|
||||
recipients of software distributed by the Grantee a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare derivative works of,
|
||||
publicly display, publicly perform, sublicense, and distribute Your
|
||||
Contributions and such derivative works.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this Agreement, You hereby grant to the Grantee and to
|
||||
recipients of software distributed by the Grantee a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have
|
||||
made, use, offer to sell, sell, import, and otherwise transfer the
|
||||
Work, where such license applies only to those patent claims
|
||||
licensable by You that are necessarily infringed by Your
|
||||
Contribution(s) alone or by combination of Your Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If any
|
||||
entity institutes patent litigation against You or any other entity
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging
|
||||
that your Contribution, or the Work to which you have contributed,
|
||||
constitutes direct or contributory patent infringement, then any
|
||||
patent licenses granted to that entity under this Agreement for
|
||||
that Contribution or Work shall terminate as of the date such
|
||||
litigation is filed.
|
||||
|
||||
4. You represent that you are legally entitled to grant the above
|
||||
license. If your employer(s) has rights to intellectual property
|
||||
that you create that includes your Contributions, you represent
|
||||
that you have received permission to make Contributions on behalf
|
||||
of that employer, that your employer has waived such rights for
|
||||
your Contributions to the Grantee, or that your employer has
|
||||
executed a separate Corporate CLA with the Grantee.
|
||||
|
||||
5. You represent that each of Your Contributions is Your original
|
||||
creation (see section 7 for submissions on behalf of others). You
|
||||
represent that Your Contribution submissions include complete
|
||||
details of any third-party license or other restriction (including,
|
||||
but not limited to, related patents and trademarks) of which you
|
||||
are personally aware and which are associated with any part of Your
|
||||
Contributions.
|
||||
|
||||
6. You are not expected to provide support for Your Contributions,
|
||||
except to the extent You desire to provide support. You may provide
|
||||
support for free, for a fee, or not at all. Unless required by
|
||||
applicable law or agreed to in writing, You provide Your
|
||||
Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
OF ANY KIND, either express or implied, including, without
|
||||
limitation, any warranties or conditions of TITLE, NON-
|
||||
INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
7. Should You wish to submit work that is not Your original creation,
|
||||
You may submit it to the Grantee separately from any
|
||||
Contribution, identifying the complete details of its source and of
|
||||
any license or other restriction (including, but not limited to,
|
||||
related patents, trademarks, and license agreements) of which you
|
||||
are personally aware, and conspicuously marking the work as
|
||||
"Submitted on behalf of a third-party: [named here]".
|
||||
|
||||
8. You agree to notify the Grantee of any facts or circumstances of
|
||||
which you become aware that would make these representations
|
||||
inaccurate in any respect.
|
||||
2
LICENSE
2
LICENSE
@@ -33,7 +33,7 @@ URL for them above, as well as copies of any plain-text lines
|
||||
beginning with `Required Notice:` that the licensor provided
|
||||
with the software. For example:
|
||||
|
||||
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
||||
> Required Notice: Copyright Isaac Paul
|
||||
|
||||
## Changes and New Works License
|
||||
|
||||
|
||||
14
Package.resolved
Normal file
14
Package.resolved
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "swift-argument-parser",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-argument-parser",
|
||||
"state" : {
|
||||
"revision" : "309a47b2b1d9b5e991f36961c983ecec72275be3",
|
||||
"version" : "1.6.1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"version" : 2
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// swift-tools-version:5.9
|
||||
// swift-tools-version:6.1.0
|
||||
|
||||
//
|
||||
// Package.swift
|
||||
@@ -12,23 +12,45 @@ import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "HRW",
|
||||
platforms: [
|
||||
.macOS(.v13), //v10_15
|
||||
.iOS(.v13)],
|
||||
products: [
|
||||
.library(
|
||||
name: "HRW",
|
||||
targets: ["HRW"]
|
||||
)
|
||||
),
|
||||
.plugin(name: "BindingPlugin", targets: ["BindingPlugin"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(path: "/Users/isaacpaul/Projects/swift-projects/GenHTML5"),
|
||||
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.3.0"),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "HRW",
|
||||
dependencies: [
|
||||
]
|
||||
dependencies: [ ]
|
||||
),
|
||||
.executableTarget(name: "BindingGenerator", dependencies: [
|
||||
.product(name: "ArgumentParser", package: "swift-argument-parser")
|
||||
]),
|
||||
.testTarget(
|
||||
name: "HRWTests",
|
||||
dependencies: ["HRW"]
|
||||
dependencies: [
|
||||
"HRW"],
|
||||
plugins: [.plugin(name: "BindingPlugin")]
|
||||
),
|
||||
.plugin(
|
||||
name: "BindingPlugin",
|
||||
capability: .buildTool(),
|
||||
dependencies: [.target(name: "BindingGenerator")]
|
||||
)
|
||||
]
|
||||
)
|
||||
/*
|
||||
|
||||
Showing All Messages
|
||||
product 'BindingGenerator' required by package 'hrw' target 'HRWTests' not found. Did you mean ''?
|
||||
|
||||
|
||||
*/
|
||||
|
||||
173
Plugins/BindingPlugin/source.swift
Normal file
173
Plugins/BindingPlugin/source.swift
Normal file
@@ -0,0 +1,173 @@
|
||||
//
|
||||
// source.swift
|
||||
// gen_html
|
||||
//
|
||||
// Created by Isaac Paul on 9/30/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PackagePlugin
|
||||
|
||||
final class AppError: LocalizedError, Sendable {
|
||||
|
||||
let message: String
|
||||
|
||||
init(_ message: String) {
|
||||
self.message = message
|
||||
}
|
||||
init(_ message: String, _ error:Error) {
|
||||
self.message = "\(message) : \(error.localizedDescription)"
|
||||
}
|
||||
|
||||
static func failure<T>(_ message: String) -> Result<T, AppError> {
|
||||
return .failure(AppError(message))
|
||||
}
|
||||
|
||||
var errorDescription: String? {
|
||||
get {
|
||||
return message
|
||||
}
|
||||
}
|
||||
|
||||
var failureReason: String? { get { return message } }
|
||||
}
|
||||
|
||||
let toolName = "BindingGenerator"
|
||||
|
||||
extension BindingPlugin: BuildToolPlugin {
|
||||
func createBuildCommands(context: PluginContext, target: Target) async throws -> [Command] {
|
||||
guard let swiftTarget = target as? SwiftSourceModuleTarget else {
|
||||
print("Unexpected target: \(type(of: target)). Needs SwiftSourceModuleTarget")
|
||||
throw AppError("Unexpected target: \(type(of: target)). Needs SwiftSourceModuleTarget")
|
||||
}
|
||||
let toolUrl = try context.tool(named: toolName).url
|
||||
|
||||
return try createBuildCommands(
|
||||
outputDir: context.pluginWorkDirectoryURL,
|
||||
inputDir: swiftTarget.directoryURL,
|
||||
inputFiles: swiftTarget.sourceFiles,
|
||||
toolExe: toolUrl
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#if canImport(XcodeProjectPlugin)
|
||||
|
||||
import XcodeProjectPlugin
|
||||
import System
|
||||
|
||||
// The entry point for Xcode project builds.
|
||||
extension BindingPlugin: XcodeBuildToolPlugin {
|
||||
func createBuildCommands(context: XcodePluginContext, target: XcodeTarget) throws -> [Command] {
|
||||
let toolUrl = try context.tool(named: toolName).url
|
||||
return try createBuildCommands(
|
||||
outputDir: context.pluginWorkDirectoryURL,
|
||||
inputDir: context.xcodeProject.directoryURL,
|
||||
inputFiles: target.inputFiles,
|
||||
toolExe: toolUrl
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
struct Config: Codable {
|
||||
var root_path: String?
|
||||
}
|
||||
|
||||
extension URL {
|
||||
func isHtml() -> Bool {
|
||||
return self.pathExtension == "html" || self.pathExtension == "htm"
|
||||
}
|
||||
}
|
||||
|
||||
extension String {
|
||||
func uppercaseFirstLetter() -> String {
|
||||
guard let firstLetter = self.first else { return self }
|
||||
return firstLetter.uppercased() + self.dropFirst()
|
||||
}
|
||||
}
|
||||
|
||||
@main
|
||||
struct BindingPlugin {
|
||||
|
||||
private static let configFile = "binding_generator_plugin.json"
|
||||
|
||||
private func createBuildCommands(
|
||||
outputDir: URL,
|
||||
inputDir: URL,
|
||||
inputFiles: FileList,
|
||||
toolExe: URL
|
||||
) throws -> [Command] {
|
||||
|
||||
let configFilePath = inputFiles.first(where: { $0.url.lastPathComponent == BindingPlugin.configFile })
|
||||
let configFileURL = configFilePath?.url
|
||||
|
||||
//let listSearchDir: [String]
|
||||
let htmlFiles = inputFiles.filter { $0.url.isHtml() }.map { $0.url }
|
||||
let rootPath:URL
|
||||
|
||||
if let configFileURL = configFileURL {
|
||||
|
||||
let configData = try Data(contentsOf: configFileURL)
|
||||
let config = try JSONDecoder().decode(Config.self, from: configData)
|
||||
|
||||
let baseDirectory:URL = configFileURL.deletingLastPathComponent()
|
||||
if let configRootPath = config.root_path {
|
||||
rootPath = baseDirectory.appending(path: configRootPath)
|
||||
} else {
|
||||
rootPath = inputDir
|
||||
}
|
||||
/*
|
||||
for source in config.sources ?? [] {
|
||||
let sourceFileOrDirectory = baseDirectory.appendingPathComponent(source)
|
||||
if sourceFileOrDirectory.isHtml() {
|
||||
htmlFiles.append(sourceFileOrDirectory)
|
||||
} else {
|
||||
let files = try FileManager.default.contentsOfDirectory(
|
||||
at: sourceFileOrDirectory,
|
||||
includingPropertiesForKeys: nil
|
||||
)
|
||||
let filteredFiles = files.filter { $0.isHtml() }
|
||||
htmlFiles.append(contentsOf: filteredFiles)
|
||||
}
|
||||
}*/
|
||||
|
||||
} else {
|
||||
rootPath = inputDir
|
||||
}
|
||||
/*
|
||||
/Users/isaacpaul/Projects/swift-projects/HRW/Plugins/BindingPlugin/source.swift:146:13: error: 'let' cannot appear nested inside another 'var' or 'let' pattern
|
||||
<unknown>:0: error: error opening input file '/Users/isaacpaul/Library/Developer/Xcode/DerivedData/HRW-bicwrilrmihgqogjvxyqtcosfaro/Build/Intermediates.noindex/BuildToolPluginIntermediates/hrw.output/HRWTests/BindingPlugin/Example.swift' (No such file or directory)
|
||||
//
|
||||
Showing All Messages
|
||||
Error opening input file '/Users/isaacpaul/Library/Developer/Xcode/DerivedData/HRW-bicwrilrmihgqogjvxyqtcosfaro/Build/Intermediates.noindex/BuildToolPluginIntermediates/hrw.output/HRWTests/BindingPlugin/ExampleBinding.swift' (No such file or directory)
|
||||
*/
|
||||
return htmlFiles.map { eachFile in
|
||||
let fileName = eachFile.lastPathComponent
|
||||
let ext = eachFile.pathExtension
|
||||
let extIndex = fileName.index(fileName.startIndex, offsetBy: fileName.count - (ext.count + 1))
|
||||
let withoutExt = String(fileName[fileName.startIndex..<extIndex])
|
||||
let targetFileName = "\(withoutExt.uppercaseFirstLetter()).swift"
|
||||
|
||||
let rootFP = FilePath(rootPath.path)
|
||||
var inputFP = FilePath(eachFile.path)
|
||||
let outputDirFP = FilePath(outputDir.path)
|
||||
|
||||
let _ = inputFP.removePrefix(rootFP)
|
||||
inputFP.removeLastComponent()
|
||||
//let idk = outputDirFP.pushing(inputFP)
|
||||
let outputFileA = outputDir.appendingPathComponent(inputFP.string)
|
||||
let outputFile = outputFileA.appendingPathComponent(targetFileName)
|
||||
print("Expected path: \(outputFile.path)")
|
||||
|
||||
return .buildCommand(
|
||||
displayName: "Generating binding to \(outputFile.path)",
|
||||
executable: toolExe,
|
||||
arguments: ["-o", outputDir.path, "-i", eachFile.path, "-b", rootPath.path],
|
||||
inputFiles: [eachFile],
|
||||
outputFiles: [URL(fileURLWithPath: outputFile.path)]
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
13
README.txt
13
README.txt
@@ -1,10 +1,10 @@
|
||||
## HTML Reader Writer (H-RW)
|
||||
|
||||
The goal is to be able to load html into swift from a file, manipulate it, then spit out html while retaining the benefits of a type safe language which serves as an alternative to templating.
|
||||
The goal is to be able to load html into swift from a file, manipulate it, then spit out html while retaining the benefits of a type safe language which serves as an alternative to templating. A BindingPlugin is also provided, this will analyze the html files and produce a swift file that will let you access html elements with IDs while retaining type infomation. Similar to Android's ViewBinding.
|
||||
|
||||
#### Thoughts
|
||||
|
||||
I suppose I wanted to be able to use plain html as is. In hindsight, it was too much effort for the payoff. This is mostly so I can build multipage websites with swift without the use of JS as a silly experiement.
|
||||
I suppose I wanted to be able to use plain html as is. In hindsight, it was too much effort for the payoff. This is mostly so I can build multipage websites with swift without the use of JS as a silly experiment.
|
||||
|
||||
There is also a HTML library called Plot that also lets you manipulate html, but it doesn't let you load it in from a file and treats HTML generations similarly to SwiftUI.
|
||||
|
||||
@@ -12,11 +12,14 @@ Perhaps this project can be repurposed as an LSP for html, but that's not much o
|
||||
|
||||
There is also an HTML parser in LadyBird thats partially written in Swift. It seems to call into c++ for a handful of things, so it doesn't seem to be reusable without that.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
The license is a modified version of the PolyForm Noncommercial License (1.0.0) to add more non-commerical and non-ai use stipulations. I am open relicensing.
|
||||
The license is a modified version of the PolyForm Noncommercial License (1.0.0) to add more non-commercial and non-ai use stipulations. Basically, if you're not making money then it's free to use. Depending on the project, I am open to distributing this source under a different license.
|
||||
|
||||
## Contributions
|
||||
|
||||
All contributors must sign an CLA as I do not wish to restrict myself in the use of the code or future relicensing endevors.
|
||||
All contributors must agree to the CLA within. It is primarily based on Apache's ICLA.
|
||||
|
||||
By signing off your git commits you are agreeing the CLA within the repository inside the file CLA.txt.
|
||||
|
||||
You can sign off your commits via the signoff flag `git commit --signoff`
|
||||
|
||||
380
Sources/BindingGenerator/BaseComponents.swift
Normal file
380
Sources/BindingGenerator/BaseComponents.swift
Normal file
@@ -0,0 +1,380 @@
|
||||
//
|
||||
// BaseComponents.swift
|
||||
// HRW
|
||||
//
|
||||
// Created by Isaac Paul on 10/15/24.
|
||||
// Non-commercial license, see LICENSE.MD in the project root for details
|
||||
//
|
||||
|
||||
public protocol IFlowContent : HTMLNode {}
|
||||
|
||||
public protocol IGlobalContainer {
|
||||
var globalAttributes:Dictionary<GlobalAttributeKey, String> { get set }
|
||||
var globalEvents:Dictionary<GlobalEventKey, String> { get set }
|
||||
var dataAttributes:Dictionary<String, String> { get set }
|
||||
}
|
||||
|
||||
extension IGlobalContainer {
|
||||
mutating func trySetGlobalAttribute(_ key:String, _ value:String) -> Bool {
|
||||
if let attr = GlobalAttributeKey(rawValue: key) {
|
||||
globalAttributes.updateValue(value, forKey: attr)
|
||||
return true
|
||||
}
|
||||
if let attr = GlobalEventKey(rawValue: key.asSubstring()) {
|
||||
globalEvents[attr] = value
|
||||
return true
|
||||
}
|
||||
if (key.count >= 5) {
|
||||
if key[..<key.index(key.startIndex, offsetBy: 5)] == "data-" {
|
||||
dataAttributes[key] = value
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
public class NParent : NRenderable {
|
||||
public var children:[NRenderable] = []
|
||||
|
||||
public override init() {
|
||||
super.init()
|
||||
children = []
|
||||
}
|
||||
}
|
||||
|
||||
public class NRenderable {
|
||||
public var parent:NParent? = nil
|
||||
}
|
||||
|
||||
public class NNone: NRenderable { }
|
||||
|
||||
public struct GlobalAttributesBuilder : IGlobalContainer{
|
||||
public var globalAttributes:Dictionary<GlobalAttributeKey, String> = [:]
|
||||
public var globalEvents:Dictionary<GlobalEventKey, String> = [:]
|
||||
public var dataAttributes:Dictionary<String, String> = [:]
|
||||
|
||||
public init(globalAttributes: Dictionary<GlobalAttributeKey, String>, globalEvents: Dictionary<GlobalEventKey, String>, dataAttributes: Dictionary<String, String>) {
|
||||
self.globalAttributes = globalAttributes
|
||||
self.globalEvents = globalEvents
|
||||
self.dataAttributes = dataAttributes
|
||||
}
|
||||
|
||||
public init() {
|
||||
self.globalAttributes = [:]
|
||||
self.globalEvents = [:]
|
||||
self.dataAttributes = [:]
|
||||
}
|
||||
|
||||
public init(_ attributes: [String: String]) throws {
|
||||
self.globalAttributes = [:]
|
||||
self.globalEvents = [:]
|
||||
self.dataAttributes = [:]
|
||||
for (key, value) in attributes {
|
||||
if self.trySetGlobalAttribute(key, value) {
|
||||
continue
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The problem is pausing and resuming so this is a n-squared search, but is it faster than make allocations? do we even need this?
|
||||
/*
|
||||
public struct HtmlIterator : IteratorProtocol {
|
||||
public init(src: HTMLNode) {
|
||||
self._currentNode = src
|
||||
}
|
||||
|
||||
public typealias Element = HTMLNode
|
||||
|
||||
private var _currentNode:HTMLNode?
|
||||
|
||||
public mutating func next() -> HTMLNode? {
|
||||
let (index, result) = _src.renderableAtIndex(_index)
|
||||
_index += 1
|
||||
return result
|
||||
}
|
||||
}*/
|
||||
|
||||
public class HTMLNode : XMLNode, IGlobalContainer {
|
||||
|
||||
public var globalAttributes:Dictionary<GlobalAttributeKey, String> = [:]
|
||||
public var globalEvents:Dictionary<GlobalEventKey, String> = [:]
|
||||
|
||||
public var children:[HTMLNode] = []
|
||||
|
||||
public init(expectedAttributes:[String:String]) throws {
|
||||
super.init()
|
||||
for (key, value) in expectedAttributes {
|
||||
if let attr = GlobalAttributeKey(rawValue: key) {
|
||||
globalAttributes.updateValue(value, forKey: attr)
|
||||
continue
|
||||
}
|
||||
if let attr = GlobalEventKey(rawValue: key.asSubstring()) {
|
||||
globalEvents[attr] = value
|
||||
continue
|
||||
}
|
||||
if key[..<key.index(key.startIndex, offsetBy: 5)] == "data-" {
|
||||
dataAttributes[key] = value
|
||||
continue
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
public init(globalAttributes:Dictionary<GlobalAttributeKey, String>, globalEvents:Dictionary<GlobalEventKey, String>, dataAttributes:Dictionary<String, String>) {
|
||||
self.globalAttributes = globalAttributes
|
||||
self.globalEvents = globalEvents
|
||||
super.init(dataAttributes: dataAttributes)
|
||||
}
|
||||
|
||||
public init(_ builder:GlobalAttributesBuilder, _ children:[HTMLNode] = []) {
|
||||
self.globalAttributes = builder.globalAttributes
|
||||
self.globalEvents = builder.globalEvents
|
||||
self.children = children
|
||||
super.init(dataAttributes: builder.dataAttributes)
|
||||
}
|
||||
|
||||
public var id: String? { globalAttributes[.id] }
|
||||
|
||||
public func findById(_ id:String) -> HTMLNode? {
|
||||
if (globalAttributes[.id] == id) {
|
||||
return self
|
||||
}
|
||||
for eachChild in children {
|
||||
if let result = eachChild.findById(id) {
|
||||
return result
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
public func iterate(_ index:Int, _ skipTextNodes:Bool, _ cb:(HTMLNode, Int)->()) -> Int {
|
||||
if (skipTextNodes && self is HTMLText) {
|
||||
return index
|
||||
}
|
||||
cb(self, index)
|
||||
var newIndex = index + 1
|
||||
for eachChild in children {
|
||||
newIndex = eachChild.iterate(newIndex, skipTextNodes, cb)
|
||||
}
|
||||
return newIndex
|
||||
}
|
||||
|
||||
public func flatten() -> [HTMLNode] {
|
||||
let count = countElements()
|
||||
let result:[HTMLNode] = Array(unsafeUninitializedCapacity: count+1) { buffer, initializedCount in
|
||||
initializedCount = self.addTo(array: &buffer, index: 0)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
public func countElements() -> Int {
|
||||
var result = 1
|
||||
for eachChild in children {
|
||||
result += eachChild.countElements()
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
public func addTo(array:inout UnsafeMutableBufferPointer<HTMLNode>, index:Int) -> Int {
|
||||
array.initializeElement(at: index, to: self)
|
||||
var newIndex = index + 1
|
||||
for eachChild in children {
|
||||
newIndex = eachChild.addTo(array: &array, index: newIndex)
|
||||
}
|
||||
return newIndex
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
var first = result.count == 0
|
||||
for eachAttr in globalAttributes {
|
||||
if (!first) {
|
||||
result += " "
|
||||
}
|
||||
first = false
|
||||
if (eachAttr.value.count > 0) {
|
||||
result += "\(eachAttr.key)='\(eachAttr.value)'"
|
||||
} else {
|
||||
result += "\(eachAttr.key)"
|
||||
}
|
||||
}
|
||||
|
||||
for eachAttr in globalEvents {
|
||||
if (!first) {
|
||||
result += " "
|
||||
}
|
||||
first = false
|
||||
if (eachAttr.value.count > 0) {
|
||||
result += "\(eachAttr.key) = \(eachAttr.value)"
|
||||
} else {
|
||||
result += "\(eachAttr.key)"
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "HTML"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
override public func toString(_ depth:Int = 0, spacingStrat:SpacingStrat = .tabs) -> (Int, String) {
|
||||
var newDepth = depth
|
||||
var result = renderTag()
|
||||
if (!isVoidElement) {
|
||||
for eachChild in children {
|
||||
let (nextDepth, renderedChild) = eachChild.toString(newDepth, spacingStrat: spacingStrat)
|
||||
newDepth = nextDepth
|
||||
result += renderedChild
|
||||
}
|
||||
result += "<\(nodeName)/>"
|
||||
}
|
||||
return (newDepth, result)
|
||||
}
|
||||
}
|
||||
|
||||
public enum SpacingStrat {
|
||||
case tabs
|
||||
case spaces(num:Int)
|
||||
}
|
||||
|
||||
public class GenericXMLNode : XMLNode {
|
||||
|
||||
public var attributes:Dictionary<String, String> = [:]
|
||||
public var children:[XMLNode] = []
|
||||
public var name:String
|
||||
|
||||
public init(_ name:String, _ attributes:[String:String], _ children:[XMLNode] = []) {
|
||||
self.attributes = attributes
|
||||
self.children = children
|
||||
self.name = name
|
||||
super.init(attributes)
|
||||
}
|
||||
|
||||
public init(_ name:String, _ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
self.attributes = attributes
|
||||
self.name = name
|
||||
super.init(attributes)
|
||||
|
||||
|
||||
var allItems:[XMLNode] = []
|
||||
while let obj = try parser?.readObjectXml(endTag: "a") {
|
||||
allItems.append(obj)
|
||||
}
|
||||
children = allItems
|
||||
}
|
||||
}
|
||||
|
||||
public class XMLNode { //Not sure if should be a parent class or just protocol
|
||||
|
||||
public var dataAttributes:Dictionary<String, String> = [:]
|
||||
public var parent:XMLNode? = nil
|
||||
var nodeName: String {
|
||||
return ""
|
||||
}
|
||||
var isVoidElement: Bool {
|
||||
return true
|
||||
}
|
||||
/*
|
||||
public func it() -> HtmlIterator {
|
||||
return HtmlIterator(src: self)
|
||||
}*/
|
||||
|
||||
public init() {
|
||||
|
||||
}
|
||||
|
||||
public init(_ attributes:[String:String]) {
|
||||
for (key, value) in attributes {
|
||||
if key[..<key.index(key.startIndex, offsetBy: 5)] == "data-" {
|
||||
dataAttributes[key] = value
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public init(dataAttributes:[String:String]) {
|
||||
self.dataAttributes = dataAttributes
|
||||
}
|
||||
|
||||
public func renderAttributes() -> String {
|
||||
var result = ""
|
||||
var first = true
|
||||
for eachAttr in dataAttributes {
|
||||
if (!first) {
|
||||
result += " "
|
||||
}
|
||||
first = false
|
||||
if (eachAttr.value.count > 0) {
|
||||
result += "\(eachAttr.key) = \(eachAttr.value)"
|
||||
} else {
|
||||
result += "\(eachAttr.key)"
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/*
|
||||
public func renderableAtIndex(_ index:Int) -> (Int, NHTMLRenderable?) {
|
||||
if (index == 0) {
|
||||
return (-1, self)
|
||||
}
|
||||
var nextIndex = index - 1
|
||||
for eachChild in children {
|
||||
let (index, result) = eachChild.renderableAtIndex(nextIndex)
|
||||
if let result = result {
|
||||
return (-1, result)
|
||||
}
|
||||
nextIndex = index
|
||||
}
|
||||
return (nextIndex, nil)
|
||||
}*/
|
||||
|
||||
public func toString(_ depth:Int = 0, spacingStrat:SpacingStrat = .tabs) -> (Int, String) {
|
||||
var newDepth = depth
|
||||
var result = "<\(nodeName) \(renderAttributes())"
|
||||
if (isVoidElement) {
|
||||
result += "/>"
|
||||
} else {
|
||||
result += ">"
|
||||
}
|
||||
return (newDepth, result)
|
||||
}
|
||||
|
||||
public func renderTag() -> String {
|
||||
let closing = isVoidElement ? "/" : ""
|
||||
let attributes = renderAttributes()
|
||||
if (attributes.isEmpty) {
|
||||
let result = "<\(nodeName)\(closing)>"
|
||||
return result
|
||||
} else {
|
||||
let result = "<\(nodeName) \(renderAttributes()) \(closing)>"
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func isGlobalHTMLAttribute(_ key:String) -> Bool {
|
||||
if let _ = GlobalAttributeKey(rawValue: key) {
|
||||
return true
|
||||
}
|
||||
if let _ = GlobalEventKey(rawValue: key.asSubstring()) {
|
||||
return true
|
||||
}
|
||||
if key[..<key.index(key.startIndex, offsetBy: 5)] == "data-" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
public protocol IHTMLParent : HTMLNode {
|
||||
var childrenAny:[HTMLNode] { get set }
|
||||
}
|
||||
387
Sources/BindingGenerator/CLI.swift
Normal file
387
Sources/BindingGenerator/CLI.swift
Normal file
@@ -0,0 +1,387 @@
|
||||
//#!/usr/env/swift
|
||||
|
||||
import Foundation
|
||||
import ArgumentParser
|
||||
|
||||
struct HtmlElement {
|
||||
let id:String
|
||||
let index:Int
|
||||
let type:String
|
||||
}
|
||||
|
||||
struct StandardError: TextOutputStream {
|
||||
mutating func write(_ string: String) {
|
||||
for byte in string.utf8 { putc(numericCast(byte), stderr) }
|
||||
}
|
||||
}
|
||||
nonisolated(unsafe) var standardError: StandardError = StandardError()
|
||||
|
||||
extension String {
|
||||
|
||||
public func swiftSafe() -> String {
|
||||
if (self == "for") {
|
||||
return "for_"
|
||||
}
|
||||
if (self == "defer") {
|
||||
return "defer_"
|
||||
}
|
||||
if (self == "class") {
|
||||
return "class_"
|
||||
}
|
||||
if (self == "is") {
|
||||
return "is_"
|
||||
}
|
||||
if (self == "as") {
|
||||
return "as_"
|
||||
}
|
||||
if (self == "subscript") {
|
||||
return "subscript_"
|
||||
}
|
||||
if (self == "default") {
|
||||
return "default_"
|
||||
}
|
||||
if (self == "type") {
|
||||
return "type_"
|
||||
}
|
||||
let final = self.replacingOccurrences(of: "-", with: "_")
|
||||
return final
|
||||
}
|
||||
}
|
||||
|
||||
@available(macOS 10.15.4, *)
|
||||
struct Process: AsyncParsableCommand {
|
||||
|
||||
static let configuration = CommandConfiguration(
|
||||
abstract: "A utility to generate Swift Bindings for HTML IDs",
|
||||
version: "0.0.1")
|
||||
|
||||
@Flag(name:[.customShort("r"), .long], help: "Recursively searches for html to create bindings for.")
|
||||
var recursive: Bool = false
|
||||
|
||||
@Flag(name:[.customShort("f"), .long], help: "When specifying an output dir, do not recreate the folder structure.")
|
||||
var flatten: Bool = false
|
||||
|
||||
@Option(name:[.customShort("i"), .customLong("input")], help: "Path to file or folder. Defaults to working directory.", completion: .file(), transform: URL.init(fileURLWithPath:))
|
||||
var inputFilePath: URL? = nil
|
||||
|
||||
@Option(name:[.customShort("o"), .customLong("output")], help: "Destination to write output. Defaults to same directory as source file.", completion: .file(), transform: URL.init(fileURLWithPath:))
|
||||
var outputFilePath: URL? = nil
|
||||
|
||||
@Option(name:[.customShort("b"), .customLong("basePath")], help: "", completion: .file(), transform: URL.init(fileURLWithPath:))
|
||||
var baseFilePath: URL? = nil
|
||||
|
||||
var workingDirectory: String = ""
|
||||
|
||||
func inputPath() throws -> URL {
|
||||
if let inputFilePath = inputFilePath {
|
||||
return inputFilePath
|
||||
}
|
||||
let workingDirUrl = URL(filePath: workingDirectory)
|
||||
/* TODO: Verify valid path
|
||||
guard let workingDirUrl = URL(filePath: CLI.workingDirectory) else {
|
||||
throw AppError("Error: could not convert \(CLI.workingDirectory) to a url.")
|
||||
}*/
|
||||
let parentDirectory = workingDirUrl.deletingLastPathComponent()
|
||||
return parentDirectory
|
||||
}
|
||||
|
||||
func outputFileDirectory() throws -> URL {
|
||||
if let outputFilePath = outputFilePath {
|
||||
return outputFilePath
|
||||
}
|
||||
guard let workingDirUrl = URL(string: workingDirectory) else {
|
||||
throw AppError("Error: could not convert \(workingDirectory) to a url.")
|
||||
}
|
||||
let parentDirectory = workingDirUrl.deletingLastPathComponent()
|
||||
return parentDirectory
|
||||
}
|
||||
|
||||
mutating func run() async throws {
|
||||
self.workingDirectory = await CLI.workingDirectory
|
||||
let iPath = try inputPath()
|
||||
let fileType = try iPath.fetchFileType()
|
||||
let fileList:[URL]
|
||||
|
||||
let iPathDir:URL
|
||||
|
||||
switch (fileType) {
|
||||
case .directory:
|
||||
print("Checking directory for html files: \(iPath.absoluteString)")
|
||||
let fm:FileManager = FileManager.default
|
||||
fileList = try fm.listFiles(iPath, withLowercaseExtensions: ["htm", "html"])
|
||||
if let baseFilePath = baseFilePath {
|
||||
iPathDir = baseFilePath
|
||||
} else {
|
||||
iPathDir = iPath
|
||||
}
|
||||
break;
|
||||
|
||||
case .regularFile:
|
||||
fileList = [iPath]
|
||||
if let baseFilePath = baseFilePath {
|
||||
iPathDir = baseFilePath
|
||||
} else {
|
||||
iPathDir = iPath.deletingLastPathComponent()
|
||||
}
|
||||
break;
|
||||
|
||||
case .other:
|
||||
throw AppError("path \(iPath.absoluteString) is not a file or directory")
|
||||
}
|
||||
for eachUrl in fileList {
|
||||
do {
|
||||
print("Generating binding for: \(eachUrl.absoluteString)")
|
||||
//Read file into html tree
|
||||
let fileName = eachUrl.lastPathComponent
|
||||
let ext = eachUrl.pathExtension
|
||||
let extIndex = fileName.index(fileName.startIndex, offsetBy: fileName.count - (ext.count + 1))
|
||||
let withoutExt = String(fileName[fileName.startIndex..<extIndex])
|
||||
let srcParent = eachUrl.deletingLastPathComponent()
|
||||
let relativePath = try iPathDir.getRelativePathComponents(to: srcParent)
|
||||
let relativePathStr = relativePath.toStringList("/") //TODO: Seperator might be different on windows
|
||||
|
||||
let fileStr = try String.init(readFromUrl: eachUrl)
|
||||
guard let xmlReader = XMLParser(str: fileStr) else { throw EmptyStringError() }
|
||||
let rootNodes:[HTMLNode] = try xmlReader.readObjects()
|
||||
var somePrimaryNode:HTMLNode? = nil
|
||||
if (rootNodes.count == 1) {
|
||||
somePrimaryNode = rootNodes.first
|
||||
} else {
|
||||
for eachNode in rootNodes {
|
||||
if let targetNode = eachNode as? Html {
|
||||
somePrimaryNode = targetNode
|
||||
break
|
||||
}
|
||||
}
|
||||
if somePrimaryNode == nil {
|
||||
somePrimaryNode = rootNodes.first
|
||||
}
|
||||
}
|
||||
guard let htmlNode = somePrimaryNode else { throw AppError("Did not find html root node")}
|
||||
|
||||
print("Parsed into node tree")
|
||||
let outputStr = generateFileWithHtmlNode(htmlNode, fileNameNoExt: withoutExt, relativeDirPath: relativePathStr)
|
||||
print("Generated Binding")
|
||||
|
||||
//Figure out output directory and filename
|
||||
//write data to file
|
||||
let targetFileName = "\(withoutExt.uppercaseFirstLetter()).swift"
|
||||
let userOutputDir:URL = try outputFileDirectory()
|
||||
let targetOutputDir:URL
|
||||
if (flatten) {
|
||||
targetOutputDir = userOutputDir
|
||||
} else {
|
||||
targetOutputDir = try userOutputDir.appendRelativePath(from: srcParent, base: iPathDir)
|
||||
}
|
||||
let targetPath = targetOutputDir.appending(path: targetFileName)
|
||||
let fm = FileManager.default
|
||||
if (fm.fileExists(atPath: targetOutputDir.path()) == false) {
|
||||
print("Creating Directory: \(targetOutputDir.path())")
|
||||
try fm.createDirectory(atPath: targetOutputDir.path(), withIntermediateDirectories: true)
|
||||
}
|
||||
print("Writing binding to file: \(targetPath.path)")
|
||||
try outputStr.write(toFile: targetPath.path, atomically: true, encoding: .utf8)
|
||||
} catch {
|
||||
print("\(eachUrl.path()):0:0: error: \(error.localizedDescription)", to: &standardError)
|
||||
throw AppError("\(eachUrl.path()):0:0: error: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
/*
|
||||
let outElementsDir = outputDir.appending(path: "Elements")
|
||||
let fm = FileManager.default
|
||||
if (fm.fileExists(atPath: outElementsDir.path()) == false) {
|
||||
print("Creating Directory: \(outElementsDir.path())")
|
||||
try fm.createDirectory(atPath: outElementsDir.path(), withIntermediateDirectories: true)
|
||||
try fileBody.write(toFile: strOutput, atomically: true, encoding: .utf8)
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
func generateFileWithHtmlNode(_ rootNode:HTMLNode, fileNameNoExt:String, relativeDirPath:String) -> String {
|
||||
|
||||
var indexedElements:[HtmlElement] = []
|
||||
var usedIds:Set<String> = Set()
|
||||
/* It's possible to do everything on the stack. But the generated code is larger and more complex
|
||||
let _ = rootNode.iterate(0, true) { (eachNode:HTMLNode, i:Int) in
|
||||
if let nodeId = eachNode.id {
|
||||
if (usedIds.contains(nodeId)) { return }
|
||||
let dynamicType = type(of: eachNode)
|
||||
indexedElements.append(HtmlElement(id: nodeId, index: i, type: "\(dynamicType)"))
|
||||
usedIds.insert(nodeId)
|
||||
}
|
||||
}*/
|
||||
|
||||
let allNodes = rootNode.flatten()
|
||||
let rootNode = allNodes.first!
|
||||
let rootNodeType = "\(type(of: rootNode))"
|
||||
for (i, eachNode) in allNodes.enumerated() {
|
||||
if let nodeId = eachNode.id {
|
||||
if (usedIds.contains(nodeId)) { continue }
|
||||
let dynamicType = type(of: eachNode)
|
||||
indexedElements.append(HtmlElement(id: nodeId, index: i, type: "\(dynamicType)"))
|
||||
usedIds.insert(nodeId)
|
||||
}
|
||||
}
|
||||
var variables:String = ""
|
||||
var initCode:String = ""
|
||||
for eachElement in indexedElements {
|
||||
let swiftSafeId = eachElement.id.swiftSafe()
|
||||
variables += " public var \(swiftSafeId): \(eachElement.type)\n"
|
||||
initCode += " \(swiftSafeId) = allNodes[\(eachElement.index)] as! \(eachElement.type)\n"
|
||||
//initCode += " case \(eachElement.index):\n"
|
||||
//initCode += " \(swiftSafeId) = eachNode as! \(eachElement.type); break\n"
|
||||
}
|
||||
|
||||
let className = "\(fileNameNoExt.uppercaseFirstLetter())"
|
||||
let fileName = "\(className).swift"
|
||||
let htmlFileName = "\(fileNameNoExt).html"
|
||||
let relativeFilePath:String
|
||||
if (relativeDirPath.isEmpty) {
|
||||
relativeFilePath = " static let relativeFilePath = \"\(htmlFileName)\""
|
||||
} else {
|
||||
relativeFilePath = " static let relativeFilePath = \"\(relativeDirPath)/\(htmlFileName)\""
|
||||
}
|
||||
|
||||
let header = Process.genHeader(fileName)
|
||||
return """
|
||||
\(header)
|
||||
|
||||
import HRW
|
||||
|
||||
public class \(className) : IHtmlNodeContainer {
|
||||
|
||||
\(relativeFilePath)
|
||||
|
||||
\(variables)
|
||||
public let rootNode: \(rootNodeType)
|
||||
public var rootNodeGeneric: HTMLNode { get { rootNode } }
|
||||
|
||||
public init(rootNode: \(rootNodeType)) throws {
|
||||
self.rootNode = rootNode
|
||||
let allNodes = rootNode.flatten()
|
||||
\(initCode)
|
||||
}
|
||||
|
||||
public init(_ rootDirectory:String? = nil) throws {
|
||||
let nodes = try IHtmlNodeContainerUtility.readHtmlFromFile(rootDirectory, \(className).relativeFilePath)
|
||||
let rootNode = nodes.first as! \(rootNodeType)
|
||||
self.rootNode = rootNode
|
||||
|
||||
let allNodes = rootNode.flatten()
|
||||
\(initCode)
|
||||
}
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
struct HomePage {
|
||||
let binding:HomePageBinding
|
||||
let rootNode:Html
|
||||
|
||||
public init(_ app:Application, isAdmin:Bool) throws {
|
||||
let nodes = try app.readHtmlFromFile("HomePage.html")
|
||||
let rootNode = nodes.first as! Html
|
||||
binding = try HomePageBinding(rootNode: rootNode)
|
||||
self.rootNode = rootNode
|
||||
|
||||
binding.nav_bar.addChild(try NavBar(app, isAdmin: isAdmin).rootNode)
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
static func genHeader(_ fileName:String) -> String {
|
||||
let dateFormatter = DateFormatter()
|
||||
dateFormatter.dateFormat = "MM/dd/yyyy"
|
||||
let date = dateFormatter.string(from: Date())
|
||||
|
||||
return """
|
||||
//
|
||||
// \(fileName)
|
||||
//
|
||||
// Generated on \(date).
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
@main
|
||||
struct CLI {
|
||||
@MainActor static var workingDirectory:String = ""
|
||||
static func main() async throws {
|
||||
if #available(macOS 13, *) {
|
||||
|
||||
if (CommandLine.arguments.count == 0) {
|
||||
print("Error: Expected at least 1 command line argument (the program directory)")
|
||||
exit(EXIT_FAILURE)
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
workingDirectory = "/Users/isaacpaul/Downloads/test/dummy.ece"//CommandLine.arguments[0]
|
||||
#else
|
||||
workingDirectory = CommandLine.arguments[0]
|
||||
#endif
|
||||
|
||||
let cmdLinArgs = CommandLine.arguments.dropFirst()
|
||||
|
||||
#if DEBUG
|
||||
var args:[String] = Array(cmdLinArgs)
|
||||
args.append(contentsOf: ["-r"])
|
||||
#else
|
||||
#endif
|
||||
|
||||
await Process.main(args)
|
||||
} else {
|
||||
print("This only works on mac 13 and newer.")
|
||||
exit(EXIT_FAILURE)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/*
|
||||
let _ = rootNode.interate(0, true) { (eachNode:HTMLNode, i:Int) in
|
||||
switch (i) {
|
||||
\(initCode)
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
public class ExampleBinding {
|
||||
|
||||
public var top: Html
|
||||
public var theme_style: Style
|
||||
public var page: Main
|
||||
public var page_content: Div
|
||||
|
||||
|
||||
public init(rootNode: HTMLNode) throws {
|
||||
var top_: Html
|
||||
var theme_style_: Style
|
||||
var page_: Main
|
||||
var page_content_: Div
|
||||
let _ = rootNode.iterate(0, true) { (eachNode:HTMLNode, i:Int) in
|
||||
switch (i) {
|
||||
case 0:
|
||||
top_ = eachNode as! Html; break
|
||||
case 16:
|
||||
theme_style_ = eachNode as! Style; break
|
||||
case 58:
|
||||
page_ = eachNode as! Main; break
|
||||
case 60:
|
||||
page_content_ = eachNode as! Div; break
|
||||
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
top = top_
|
||||
theme_style = theme_style_
|
||||
page = page_
|
||||
page_content = page_content_
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
33
Sources/BindingGenerator/Extensions/FileManager+Ext.swift
Normal file
33
Sources/BindingGenerator/Extensions/FileManager+Ext.swift
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// FileManager+Ext.swift
|
||||
// gen_html
|
||||
//
|
||||
// Created by Isaac Paul on 4/30/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension FileManager {
|
||||
//TODO: should also check if url is file
|
||||
func listFiles(_ directory:URL, withLowercaseExtensions:[String] = [], recursive:Bool = false) throws -> [URL] {
|
||||
let options:FileManager.DirectoryEnumerationOptions = recursive ? [] : [.skipsSubdirectoryDescendants]
|
||||
let fileIterator = try self.contentsOfDirectory(at: directory, includingPropertiesForKeys: [.isDirectoryKey], options: options)
|
||||
let filesOnly = fileIterator.filter { (url) -> Bool in
|
||||
do {
|
||||
let resourceValues = try url.resourceValues(forKeys: [.isDirectoryKey])
|
||||
let isDirectory = resourceValues.isDirectory ?? true
|
||||
if (isDirectory) {
|
||||
return false
|
||||
}
|
||||
} catch { return false }
|
||||
|
||||
if withLowercaseExtensions.count > 0 {
|
||||
let pathExt = url.pathExtension.lowercased()
|
||||
let contains = withLowercaseExtensions.firstIndex(of: pathExt)
|
||||
return contains != nil
|
||||
}
|
||||
return true
|
||||
}
|
||||
return filesOnly
|
||||
}
|
||||
}
|
||||
43
Sources/BindingGenerator/Extensions/String+Ext.swift
Normal file
43
Sources/BindingGenerator/Extensions/String+Ext.swift
Normal file
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// String+Ext.swift
|
||||
// gen_html
|
||||
//
|
||||
// Created by Isaac Paul on 9/25/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension String {
|
||||
init(readFromUrl:URL) throws {
|
||||
let inputHandle = try FileHandle(forReadingFrom: readFromUrl)
|
||||
guard let data = try inputHandle.readToEnd() else {
|
||||
throw AppError("Empty input.")
|
||||
}
|
||||
guard let fileStr = String(data: data, encoding: .utf8) else {
|
||||
throw AppError("Unable to decode data as utf-8 string")
|
||||
}
|
||||
self = fileStr
|
||||
}
|
||||
|
||||
func uppercaseFirstLetter() -> String {
|
||||
guard let firstLetter = self.first else { return self }
|
||||
return firstLetter.uppercased() + self.dropFirst()
|
||||
}
|
||||
|
||||
func fixPoorCharactersForVariables() -> String {
|
||||
let firstPass = self.camelCaseBy("-")
|
||||
let secondPass = firstPass.replacingOccurrences(of: "/", with: "_")
|
||||
|
||||
return secondPass
|
||||
}
|
||||
|
||||
func camelCaseBy(_ c: Character) -> String {
|
||||
let components = self.split(separator: c)
|
||||
guard let first = components.first?.lowercased() else { return "" }
|
||||
|
||||
let rest = components.dropFirst().map { $0.capitalized }
|
||||
let camelCase = ([first] + rest).joined()
|
||||
|
||||
return camelCase
|
||||
}
|
||||
}
|
||||
68
Sources/BindingGenerator/Extensions/Url+Ext.swift
Normal file
68
Sources/BindingGenerator/Extensions/Url+Ext.swift
Normal file
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// Url+Ext.swift
|
||||
// gen_html
|
||||
//
|
||||
// Created by Isaac Paul on 9/25/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension URL {
|
||||
|
||||
enum FileType {
|
||||
case directory
|
||||
case regularFile
|
||||
case other
|
||||
}
|
||||
|
||||
func fetchFileType() throws -> FileType {
|
||||
let values = try self.resourceValues(forKeys: [.isDirectoryKey, .isRegularFileKey])
|
||||
|
||||
if values.isDirectory == true {
|
||||
return .directory
|
||||
}
|
||||
if values.isRegularFile == true {
|
||||
return .regularFile
|
||||
}
|
||||
if self.hasDirectoryPath {
|
||||
return .directory
|
||||
}
|
||||
return .other
|
||||
}
|
||||
|
||||
func getRelativePathComponents(
|
||||
to toFolder: URL, // URL A
|
||||
) throws -> [String] {
|
||||
// 1) Get path components of A’s directory
|
||||
let aDirComponents = toFolder.pathComponents
|
||||
// 2) Get path components of B
|
||||
let bComponents = self.pathComponents
|
||||
|
||||
// Ensure B is actually a prefix of A’s directory
|
||||
guard bComponents.count <= aDirComponents.count,
|
||||
aDirComponents[0..<bComponents.count] == bComponents[0..<bComponents.count]
|
||||
else {
|
||||
// B is not a parent of A’s directory; just return destFolder
|
||||
throw AppError("Url \(self.absoluteString) is not a relative path to \(toFolder.absoluteString)")
|
||||
}
|
||||
|
||||
// 3) Compute the “relative” components from B to A’s directory
|
||||
let relativeComponents = Array(aDirComponents[bComponents.count...])
|
||||
return relativeComponents
|
||||
}
|
||||
|
||||
func appendRelativePath(
|
||||
from fromFolder: URL, // URL A
|
||||
base baseFolder: URL // URL B
|
||||
) throws -> URL {
|
||||
let relativeComponents = try baseFolder.getRelativePathComponents(to: fromFolder)
|
||||
|
||||
// 4) Append them one by one onto C
|
||||
var result = self
|
||||
for comp in relativeComponents {
|
||||
result.appendPathComponent(comp)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
116
Sources/BindingGenerator/Generated/Elements/A.swift
Normal file
116
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Abbr.swift
Normal file
56
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Address.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Area.swift
Normal file
161
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Article.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Aside.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Audio.swift
Normal file
192
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/B.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Base.swift
Normal file
62
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Bdi.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Bdo.swift
Normal file
55
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Blockquote.swift
Normal file
61
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Body.swift
Normal file
196
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Br.swift
Normal file
41
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Button.swift
Normal file
265
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Canvas.swift
Normal file
66
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Caption.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Cite.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Code.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Col.swift
Normal file
53
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Colgroup.swift
Normal file
57
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Data.swift
Normal file
61
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Datalist.swift
Normal file
53
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Dd.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Del.swift
Normal file
66
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Details.swift
Normal file
61
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Dfn.swift
Normal file
56
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Dialog.swift
Normal file
61
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Div.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Dl.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Dt.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Em.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Embed.swift
Normal file
80
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Fieldset.swift
Normal file
79
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Figcaption.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Figure.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Footer.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Form.swift
Normal file
246
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/H1.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/H2.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/H3.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/H4.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/H5.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/H6.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Head.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Header.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Hgroup.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Hr.swift
Normal file
41
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Html.swift
Normal file
57
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/I.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Iframe.swift
Normal file
136
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Img.swift
Normal file
269
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Input.swift
Normal file
401
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Ins.swift
Normal file
66
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Kbd.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Label.swift
Normal file
61
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Legend.swift
Normal file
53
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Li.swift
Normal file
61
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Link.swift
Normal file
193
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Map.swift
Normal file
57
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Mark.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Menu.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Meta.swift
Normal file
162
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Meter.swift
Normal file
106
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Nav.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Noscript.swift
Normal file
45
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Object.swift
Normal file
111
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Ol.swift
Normal file
122
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Optgroup.swift
Normal file
70
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Option.swift
Normal file
84
Sources/BindingGenerator/Generated/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 OptionHtml : 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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Output.swift
Normal file
77
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/P.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Param.swift
Normal file
62
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Picture.swift
Normal file
53
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Pre.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Progress.swift
Normal file
70
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Q.swift
Normal file
61
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Rp.swift
Normal file
45
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Rt.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Ruby.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/S.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Samp.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Script.swift
Normal file
151
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Section.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Select.swift
Normal file
115
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Slot.swift
Normal file
57
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Small.swift
Normal file
49
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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/BindingGenerator/Generated/Elements/Source.swift
Normal file
85
Sources/BindingGenerator/Generated/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
|
||||
}
|
||||
continue
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user