Initial Commit
This commit is contained in:
61
Sources/HRW/GenHTML/Elements/Time.swift
Normal file
61
Sources/HRW/GenHTML/Elements/Time.swift
Normal file
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// Time.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <time> Machine-readable equivalent of date- or time-related data
|
||||
public class Time : HTMLNode, IFlow, IPalpable, IPhrasing {
|
||||
|
||||
/// Machine-readable value. Valid month string, valid date string, valid yearless date string, valid time string, valid local date and time string, valid time-zone offset string, valid global date and time string, valid week string, valid non-negative integer, or valid duration string.
|
||||
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 "datetime":
|
||||
datetime = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
throw AppError("Unexpected attribute: \(key)")
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "time", 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 datetime = datetime {
|
||||
result += " datetime='\(datetime)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "time"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user