64 lines
1.6 KiB
Swift
64 lines
1.6 KiB
Swift
//
|
|
// Style.swift
|
|
// HTMLStandard
|
|
//
|
|
// Generated on 09/23/2025.
|
|
// THIS FILE IS GENERATED. DO NOT EDIT.
|
|
//
|
|
import Foundation
|
|
|
|
/// <style> Embedded styling information
|
|
public class Style : HTMLNode, IMetaData {
|
|
|
|
/// Applicable media. Valid media query list.
|
|
public var media:String? = nil
|
|
|
|
|
|
/// CSS style sheet set name.
|
|
public var title:String? {
|
|
get { return globalAttributes[.title] }
|
|
set { globalAttributes[.title] = newValue }
|
|
}
|
|
|
|
|
|
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
|
var globalAttr = GlobalAttributesBuilder()
|
|
for (key, attValue) in attributes {
|
|
switch (key) {
|
|
case "media":
|
|
media = attValue
|
|
continue
|
|
|
|
default: break
|
|
}
|
|
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
|
continue
|
|
}
|
|
throw AppError("Unexpected attribute: \(key)")
|
|
}
|
|
var allItems:[HTMLNode] = []
|
|
while let obj = try parser?.readObject(endTag: "style", xmlToHtmlMapper) {
|
|
allItems.append(obj)
|
|
}
|
|
super.init(globalAttr, allItems)
|
|
}
|
|
|
|
|
|
public override func renderAttributes() -> String {
|
|
var result = super.renderAttributes()
|
|
if let media = media {
|
|
result += " media='\(media)'"
|
|
}
|
|
|
|
|
|
return result
|
|
}
|
|
|
|
override var nodeName: String {
|
|
return "style"
|
|
}
|
|
|
|
override var isVoidElement: Bool {
|
|
return false
|
|
}
|
|
} |