// // Ol.swift // HTMLStandard // // Generated on 09/23/2025. // THIS FILE IS GENERATED. DO NOT EDIT. // import Foundation ///
    Ordered list public class Ol : HTMLNode, IFlow, IPalpable { public enum AttrType : String, CaseIterable { case one = "1" case A case I case a case i public init?(rawValue: Substring) { guard let value = Self.allCases.first(where: { $0.rawValue == rawValue }) else { return nil } self = value } public init(expect: Substring) throws { guard let value = Self.allCases.first(where: { $0.rawValue == expect }) else { throw AppError("Unexpected value for AttrType: \(expect)") } self = value } public init(expect: String) throws { guard let result = AttrType(rawValue: expect) else { throw AppError("Unexpected value for AttrType: \(expect)") } self = result } static func parseList(_ value:String?, _ separator:String = " ") throws -> [AttrType] { guard let value = value else { return [] } var iterator = value.componentsIterator(separatedBy: separator) let result = try iterator.map { input in return try expect(AttrType(rawValue: input), "unexpected value for AttrType: \(input)") } return result } } /// Number the list backwards. public var reversed:Bool = false /// Starting value of the list. Valid integer. public var start:Int? = nil /// Kind of list marker. public var type:AttrType? = nil public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws { var globalAttr = GlobalAttributesBuilder() for (key, attValue) in attributes { switch (key) { case "reversed": reversed = true continue case "start": start = Int(attValue) continue case "type": type = try AttrType(expect: attValue) continue default: break } if globalAttr.trySetGlobalAttribute(key, attValue) { continue } throw AppError("Unexpected attribute: \(key)") } var allItems:[HTMLNode] = [] while let obj = try parser?.readObject(endTag: "ol", xmlToHtmlMapper) { allItems.append(obj) } super.init(globalAttr, allItems) } public func addChild(_ someElement:IScriptSupporting) { children.append(someElement) } public override func renderAttributes() -> String { var result = super.renderAttributes() if reversed { result += " reversed" } if let start = start { result += " start='\(start)'" } if let type = type { result += " type='\(type.rawValue)'" } return result } override var nodeName: String { return "ol" } override var isVoidElement: Bool { return false } }