diff --git a/buildSrc/src/main/kotlin/kotlinx/html/generate/attributes.kt b/buildSrc/src/main/kotlin/kotlinx/html/generate/attributes.kt index f100086e..5ef288d8 100644 --- a/buildSrc/src/main/kotlin/kotlinx/html/generate/attributes.kt +++ b/buildSrc/src/main/kotlin/kotlinx/html/generate/attributes.kt @@ -62,10 +62,11 @@ fun Appendable.facade(repository: Repository, facade: AttributeFacade) { fun Appendable.eventProperty(parent: String, attribute: AttributeInfo, shouldUnsafeCast: Boolean) { val type = "(org.w3c.dom.events.Event) -> Unit" variable( - receiver = parent, variable = Var( + receiver = parent, + variable = Var( name = attribute.fieldName + "Function", type = type, - mutable = true + varType = VarType.MUTABLE, ) ) emptyLine() diff --git a/buildSrc/src/main/kotlin/kotlinx/html/generate/codegen.kt b/buildSrc/src/main/kotlin/kotlinx/html/generate/codegen.kt index 33319c8d..52c11c53 100644 --- a/buildSrc/src/main/kotlin/kotlinx/html/generate/codegen.kt +++ b/buildSrc/src/main/kotlin/kotlinx/html/generate/codegen.kt @@ -46,10 +46,16 @@ fun Appendable.const(value: Const<*>) { append(value.asValue) } +enum class VarType { + MUTABLE, + IMMUTABLE, + CONST, +} + data class Var( val name: String, val type: String, - val mutable: Boolean = false, + val varType: VarType = VarType.IMMUTABLE, val override: Boolean = false, val forceOmitValVar: Boolean = false, val defaultValue: String = "", @@ -72,7 +78,12 @@ fun Appendable.variable(variable: Var, omitValVar: Boolean = false, receiver: St if (variable.override) { append("override ") } - append(if (variable.mutable) "var " else "val ") + val typeString = when (variable.varType) { + VarType.MUTABLE -> "var " + VarType.IMMUTABLE -> "val " + VarType.CONST -> "const val " + } + append(typeString) } if (receiver.isNotEmpty()) { diff --git a/buildSrc/src/main/kotlin/kotlinx/html/generate/enums.kt b/buildSrc/src/main/kotlin/kotlinx/html/generate/enums.kt index 023a08e7..133d5799 100644 --- a/buildSrc/src/main/kotlin/kotlinx/html/generate/enums.kt +++ b/buildSrc/src/main/kotlin/kotlinx/html/generate/enums.kt @@ -1,7 +1,5 @@ package kotlinx.html.generate -import java.util.* - val reservedNames = setOf("class", "val", "var", "object", "true", "false", "as", "is", "for") fun String.replaceIfReserved() = if (this in reservedNames) "html" + this.capitalize() else this @@ -12,18 +10,25 @@ fun List.toAttributeValues() : List = fun Appendable.enumObject(attribute : AttributeInfo) { val name = attribute.enumTypeName - appendLine("@Suppress(\"unused\")") + appendLine("@Suppress(\"unused\", \"ConstPropertyName\")") clazz(Clazz(name, isObject = true)) { attribute.enumValues.forEach { append(" ") - variable(Var(it.fieldName, "String", false, defaultValue = "\"${it.realName}\"")) + variable(Var(it.fieldName, "String", varType = VarType.CONST, defaultValue = "\"${it.realName}\"")) emptyLine() } emptyLine() append(" ") -// append("private ") - variable(Var("values", "List", defaultValue = attribute.enumValues.map {"\"${it.fieldName}\""}.joinToString(", ", "listOf(", ")"))) + variable( + Var( + name = "values", + type = "List", + defaultValue = attribute + .enumValues + .joinToString(", ", "listOf(", ")") { "\"${it.fieldName}\"" }, + ) + ) emptyLine() } @@ -32,9 +37,9 @@ fun Appendable.enumObject(attribute : AttributeInfo) { fun Appendable.enum(attribute : AttributeInfo) { val name = attribute.enumTypeName - val realValue = Var("realValue", "String", false, true) + val realValue = Var(name = "realValue", type = "String", varType = VarType.IMMUTABLE, override = true) - appendLine("@Suppress(\"unused\")") + appendLine("@Suppress(\"unused\", \"EnumEntryName\")") append("enum ") clazz(Clazz(name, variables = listOf(realValue), parents = listOf("AttributeEnum"))) { attribute.enumValues.forEachIndexed { idx, it -> @@ -53,6 +58,13 @@ fun Appendable.enum(attribute : AttributeInfo) { emptyLine() append("internal ") - variable(Var(name.decapitalize() + "Values", "Map", false, defaultValue = "$name.values().associateBy { it.realValue }")) + variable( + Var( + name = name.decapitalize() + "Values", + type = "Map", + varType = VarType.IMMUTABLE, + defaultValue = "$name.entries.associateBy { it.realValue }", + ), + ) emptyLine() } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/kotlinx/html/generate/tagsgen.kt b/buildSrc/src/main/kotlin/kotlinx/html/generate/tagsgen.kt index 801a5922..a870f8c6 100644 --- a/buildSrc/src/main/kotlin/kotlinx/html/generate/tagsgen.kt +++ b/buildSrc/src/main/kotlin/kotlinx/html/generate/tagsgen.kt @@ -29,18 +29,18 @@ fun Appendable.tagClass(repository: Repository, tag: TagInfo, excludeAttributes: Var( name = "initialAttributes", type = "Map", - mutable = false, + varType = VarType.IMMUTABLE, override = false, forceOmitValVar = true ) ) - add(Var(name = "consumer", type = "TagConsumer<*>", mutable = false, override = true)) + add(Var(name = "consumer", type = "TagConsumer<*>", varType = VarType.IMMUTABLE, override = true)) if (customizableNamespace) { add( Var( name = "namespace", type = "String?", - mutable = false, + varType = VarType.IMMUTABLE, override = false, forceOmitValVar = true, defaultValue = namespace?.quote() ?: "null" @@ -197,7 +197,10 @@ internal fun Appendable.tagAttributeVar( repository.attributeDelegateRequests.add(attributeRequest) indent(indent) - variable(Var(attribute.fieldName, attribute.typeName, true), receiver = receiver ?: "") + variable( + Var(name = attribute.fieldName, type = attribute.typeName, varType = VarType.MUTABLE), + receiver = receiver ?: "", + ) return attributeRequest } @@ -524,7 +527,7 @@ private fun tagBuilderFunctionArguments(tag: TagInfo, blockOrContent: Boolean): Var( name = "namespace", type = "String?", - mutable = false, + varType = VarType.IMMUTABLE, override = false, forceOmitValVar = true, defaultValue = defaultNamespace diff --git a/src/commonMain/kotlin/generated/gen-enums.kt b/src/commonMain/kotlin/generated/gen-enums.kt index 0445335e..7aef8a8f 100644 --- a/src/commonMain/kotlin/generated/gen-enums.kt +++ b/src/commonMain/kotlin/generated/gen-enums.kt @@ -7,75 +7,75 @@ import kotlinx.html.* This file was generated by module generate *******************************************************************************/ -@Suppress("unused") +@Suppress("unused", "EnumEntryName") enum class Dir(override val realValue : String) : AttributeEnum { ltr("ltr"), rtl("rtl") } -internal val dirValues : Map = Dir.values().associateBy { it.realValue } -@Suppress("unused") +internal val dirValues : Map = Dir.entries.associateBy { it.realValue } +@Suppress("unused", "EnumEntryName") enum class Draggable(override val realValue : String) : AttributeEnum { htmlTrue("true"), htmlFalse("false"), auto("auto") } -internal val draggableValues : Map = Draggable.values().associateBy { it.realValue } -@Suppress("unused") +internal val draggableValues : Map = Draggable.entries.associateBy { it.realValue } +@Suppress("unused", "EnumEntryName") enum class RunAt(override val realValue : String) : AttributeEnum { server("server") } -internal val runAtValues : Map = RunAt.values().associateBy { it.realValue } -@Suppress("unused") +internal val runAtValues : Map = RunAt.entries.associateBy { it.realValue } +@Suppress("unused", "ConstPropertyName") object ATarget { - val blank : String = "_blank" - val parent : String = "_parent" - val self : String = "_self" - val top : String = "_top" + const val blank : String = "_blank" + const val parent : String = "_parent" + const val self : String = "_self" + const val top : String = "_top" val values : List = listOf("blank", "parent", "self", "top") } -@Suppress("unused") +@Suppress("unused", "ConstPropertyName") object ARel { - val alternate : String = "Alternate" - val appEndIx : String = "Appendix" - val bookmark : String = "Bookmark" - val chapter : String = "Chapter" - val contentS : String = "Contents" - val copyright : String = "Copyright" - val glossary : String = "Glossary" - val help : String = "Help" - val index : String = "Index" - val next : String = "Next" - val prev : String = "Prev" - val section : String = "Section" - val start : String = "Start" - val stylesheet : String = "Stylesheet" - val subsection : String = "Subsection" + const val alternate : String = "Alternate" + const val appEndIx : String = "Appendix" + const val bookmark : String = "Bookmark" + const val chapter : String = "Chapter" + const val contentS : String = "Contents" + const val copyright : String = "Copyright" + const val glossary : String = "Glossary" + const val help : String = "Help" + const val index : String = "Index" + const val next : String = "Next" + const val prev : String = "Prev" + const val section : String = "Section" + const val start : String = "Start" + const val stylesheet : String = "Stylesheet" + const val subsection : String = "Subsection" val values : List = listOf("alternate", "appEndIx", "bookmark", "chapter", "contentS", "copyright", "glossary", "help", "index", "next", "prev", "section", "start", "stylesheet", "subsection") } -@Suppress("unused") +@Suppress("unused", "ConstPropertyName") object AType { - val textAsp : String = "text/asp" - val textAsa : String = "text/asa" - val textCss : String = "text/css" - val textHtml : String = "text/html" - val textJavaScript : String = "text/javascript" - val textPlain : String = "text/plain" - val textScriptLet : String = "text/scriptlet" - val textXComponent : String = "text/x-component" - val textXHtmlInsertion : String = "text/x-html-insertion" - val textXml : String = "text/xml" + const val textAsp : String = "text/asp" + const val textAsa : String = "text/asa" + const val textCss : String = "text/css" + const val textHtml : String = "text/html" + const val textJavaScript : String = "text/javascript" + const val textPlain : String = "text/plain" + const val textScriptLet : String = "text/scriptlet" + const val textXComponent : String = "text/x-component" + const val textXHtmlInsertion : String = "text/x-html-insertion" + const val textXml : String = "text/xml" val values : List = listOf("textAsp", "textAsa", "textCss", "textHtml", "textJavaScript", "textPlain", "textScriptLet", "textXComponent", "textXHtmlInsertion", "textXml") } -@Suppress("unused") +@Suppress("unused", "EnumEntryName") enum class AreaShape(override val realValue : String) : AttributeEnum { rect("rect"), circle("circle"), @@ -83,57 +83,57 @@ enum class AreaShape(override val realValue : String) : AttributeEnum { default("default") } -internal val areaShapeValues : Map = AreaShape.values().associateBy { it.realValue } -@Suppress("unused") +internal val areaShapeValues : Map = AreaShape.entries.associateBy { it.realValue } +@Suppress("unused", "ConstPropertyName") object AreaTarget { - val blank : String = "_blank" - val parent : String = "_parent" - val self : String = "_self" - val top : String = "_top" + const val blank : String = "_blank" + const val parent : String = "_parent" + const val self : String = "_self" + const val top : String = "_top" val values : List = listOf("blank", "parent", "self", "top") } -@Suppress("unused") +@Suppress("unused", "ConstPropertyName") object AreaRel { - val alternate : String = "Alternate" - val appEndIx : String = "Appendix" - val bookmark : String = "Bookmark" - val chapter : String = "Chapter" - val contentS : String = "Contents" - val copyright : String = "Copyright" - val glossary : String = "Glossary" - val help : String = "Help" - val index : String = "Index" - val next : String = "Next" - val prev : String = "Prev" - val section : String = "Section" - val start : String = "Start" - val stylesheet : String = "Stylesheet" - val subsection : String = "Subsection" + const val alternate : String = "Alternate" + const val appEndIx : String = "Appendix" + const val bookmark : String = "Bookmark" + const val chapter : String = "Chapter" + const val contentS : String = "Contents" + const val copyright : String = "Copyright" + const val glossary : String = "Glossary" + const val help : String = "Help" + const val index : String = "Index" + const val next : String = "Next" + const val prev : String = "Prev" + const val section : String = "Section" + const val start : String = "Start" + const val stylesheet : String = "Stylesheet" + const val subsection : String = "Subsection" val values : List = listOf("alternate", "appEndIx", "bookmark", "chapter", "contentS", "copyright", "glossary", "help", "index", "next", "prev", "section", "start", "stylesheet", "subsection") } -@Suppress("unused") +@Suppress("unused", "ConstPropertyName") object BaseTarget { - val blank : String = "_blank" - val parent : String = "_parent" - val self : String = "_self" - val top : String = "_top" + const val blank : String = "_blank" + const val parent : String = "_parent" + const val self : String = "_self" + const val top : String = "_top" val values : List = listOf("blank", "parent", "self", "top") } -@Suppress("unused") +@Suppress("unused", "EnumEntryName") enum class ButtonFormEncType(override val realValue : String) : AttributeEnum { multipartFormData("multipart/form-data"), applicationXWwwFormUrlEncoded("application/x-www-form-urlencoded"), textPlain("text/plain") } -internal val buttonFormEncTypeValues : Map = ButtonFormEncType.values().associateBy { it.realValue } -@Suppress("unused") +internal val buttonFormEncTypeValues : Map = ButtonFormEncType.entries.associateBy { it.realValue } +@Suppress("unused", "EnumEntryName") enum class ButtonFormMethod(override val realValue : String) : AttributeEnum { get("get"), post("post"), @@ -142,42 +142,42 @@ enum class ButtonFormMethod(override val realValue : String) : AttributeEnum { @Deprecated("method is not allowed in browsers") patch("patch") } -internal val buttonFormMethodValues : Map = ButtonFormMethod.values().associateBy { it.realValue } -@Suppress("unused") +internal val buttonFormMethodValues : Map = ButtonFormMethod.entries.associateBy { it.realValue } +@Suppress("unused", "ConstPropertyName") object ButtonFormTarget { - val blank : String = "_blank" - val parent : String = "_parent" - val self : String = "_self" - val top : String = "_top" + const val blank : String = "_blank" + const val parent : String = "_parent" + const val self : String = "_self" + const val top : String = "_top" val values : List = listOf("blank", "parent", "self", "top") } -@Suppress("unused") +@Suppress("unused", "EnumEntryName") enum class ButtonType(override val realValue : String) : AttributeEnum { button("button"), reset("reset"), submit("submit") } -internal val buttonTypeValues : Map = ButtonType.values().associateBy { it.realValue } -@Suppress("unused") +internal val buttonTypeValues : Map = ButtonType.entries.associateBy { it.realValue } +@Suppress("unused", "EnumEntryName") enum class CommandType(override val realValue : String) : AttributeEnum { command("command"), checkBox("checkbox"), radio("radio") } -internal val commandTypeValues : Map = CommandType.values().associateBy { it.realValue } -@Suppress("unused") +internal val commandTypeValues : Map = CommandType.entries.associateBy { it.realValue } +@Suppress("unused", "EnumEntryName") enum class FormEncType(override val realValue : String) : AttributeEnum { multipartFormData("multipart/form-data"), applicationXWwwFormUrlEncoded("application/x-www-form-urlencoded"), textPlain("text/plain") } -internal val formEncTypeValues : Map = FormEncType.values().associateBy { it.realValue } -@Suppress("unused") +internal val formEncTypeValues : Map = FormEncType.entries.associateBy { it.realValue } +@Suppress("unused", "EnumEntryName") enum class FormMethod(override val realValue : String) : AttributeEnum { get("get"), post("post"), @@ -186,43 +186,43 @@ enum class FormMethod(override val realValue : String) : AttributeEnum { @Deprecated("method is not allowed in browsers") patch("patch") } -internal val formMethodValues : Map = FormMethod.values().associateBy { it.realValue } -@Suppress("unused") +internal val formMethodValues : Map = FormMethod.entries.associateBy { it.realValue } +@Suppress("unused", "ConstPropertyName") object FormTarget { - val blank : String = "_blank" - val parent : String = "_parent" - val self : String = "_self" - val top : String = "_top" + const val blank : String = "_blank" + const val parent : String = "_parent" + const val self : String = "_self" + const val top : String = "_top" val values : List = listOf("blank", "parent", "self", "top") } -@Suppress("unused") +@Suppress("unused", "ConstPropertyName") object IframeName { - val blank : String = "_blank" - val parent : String = "_parent" - val self : String = "_self" - val top : String = "_top" + const val blank : String = "_blank" + const val parent : String = "_parent" + const val self : String = "_self" + const val top : String = "_top" val values : List = listOf("blank", "parent", "self", "top") } -@Suppress("unused") +@Suppress("unused", "EnumEntryName") enum class IframeSandbox(override val realValue : String) : AttributeEnum { allowSameOrigin("allow-same-origin"), allowFormS("allow-forms"), allowScripts("allow-scripts") } -internal val iframeSandboxValues : Map = IframeSandbox.values().associateBy { it.realValue } -@Suppress("unused") +internal val iframeSandboxValues : Map = IframeSandbox.entries.associateBy { it.realValue } +@Suppress("unused", "EnumEntryName") enum class ImgLoading(override val realValue : String) : AttributeEnum { eager("eager"), lazy("lazy") } -internal val imgLoadingValues : Map = ImgLoading.values().associateBy { it.realValue } -@Suppress("unused") +internal val imgLoadingValues : Map = ImgLoading.entries.associateBy { it.realValue } +@Suppress("unused", "EnumEntryName") enum class InputType(override val realValue : String) : AttributeEnum { button("button"), checkBox("checkbox"), @@ -249,16 +249,16 @@ enum class InputType(override val realValue : String) : AttributeEnum { week("week") } -internal val inputTypeValues : Map = InputType.values().associateBy { it.realValue } -@Suppress("unused") +internal val inputTypeValues : Map = InputType.entries.associateBy { it.realValue } +@Suppress("unused", "EnumEntryName") enum class InputFormEncType(override val realValue : String) : AttributeEnum { multipartFormData("multipart/form-data"), applicationXWwwFormUrlEncoded("application/x-www-form-urlencoded"), textPlain("text/plain") } -internal val inputFormEncTypeValues : Map = InputFormEncType.values().associateBy { it.realValue } -@Suppress("unused") +internal val inputFormEncTypeValues : Map = InputFormEncType.entries.associateBy { it.realValue } +@Suppress("unused", "EnumEntryName") enum class InputFormMethod(override val realValue : String) : AttributeEnum { get("get"), post("post"), @@ -267,76 +267,76 @@ enum class InputFormMethod(override val realValue : String) : AttributeEnum { @Deprecated("method is not allowed in browsers") patch("patch") } -internal val inputFormMethodValues : Map = InputFormMethod.values().associateBy { it.realValue } -@Suppress("unused") +internal val inputFormMethodValues : Map = InputFormMethod.entries.associateBy { it.realValue } +@Suppress("unused", "ConstPropertyName") object InputFormTarget { - val blank : String = "_blank" - val parent : String = "_parent" - val self : String = "_self" - val top : String = "_top" + const val blank : String = "_blank" + const val parent : String = "_parent" + const val self : String = "_self" + const val top : String = "_top" val values : List = listOf("blank", "parent", "self", "top") } -@Suppress("unused") +@Suppress("unused", "EnumEntryName") enum class KeyGenKeyType(override val realValue : String) : AttributeEnum { rsa("rsa") } -internal val keyGenKeyTypeValues : Map = KeyGenKeyType.values().associateBy { it.realValue } -@Suppress("unused") +internal val keyGenKeyTypeValues : Map = KeyGenKeyType.entries.associateBy { it.realValue } +@Suppress("unused", "ConstPropertyName") object LinkRel { - val alternate : String = "Alternate" - val appEndIx : String = "Appendix" - val bookmark : String = "Bookmark" - val chapter : String = "Chapter" - val contentS : String = "Contents" - val copyright : String = "Copyright" - val glossary : String = "Glossary" - val help : String = "Help" - val index : String = "Index" - val next : String = "Next" - val prev : String = "Prev" - val section : String = "Section" - val start : String = "Start" - val stylesheet : String = "Stylesheet" - val subsection : String = "Subsection" + const val alternate : String = "Alternate" + const val appEndIx : String = "Appendix" + const val bookmark : String = "Bookmark" + const val chapter : String = "Chapter" + const val contentS : String = "Contents" + const val copyright : String = "Copyright" + const val glossary : String = "Glossary" + const val help : String = "Help" + const val index : String = "Index" + const val next : String = "Next" + const val prev : String = "Prev" + const val section : String = "Section" + const val start : String = "Start" + const val stylesheet : String = "Stylesheet" + const val subsection : String = "Subsection" val values : List = listOf("alternate", "appEndIx", "bookmark", "chapter", "contentS", "copyright", "glossary", "help", "index", "next", "prev", "section", "start", "stylesheet", "subsection") } -@Suppress("unused") +@Suppress("unused", "ConstPropertyName") object LinkMedia { - val screen : String = "screen" - val print : String = "print" - val tty : String = "tty" - val tv : String = "tv" - val projection : String = "projection" - val handheld : String = "handheld" - val braille : String = "braille" - val aural : String = "aural" - val all : String = "all" + const val screen : String = "screen" + const val print : String = "print" + const val tty : String = "tty" + const val tv : String = "tv" + const val projection : String = "projection" + const val handheld : String = "handheld" + const val braille : String = "braille" + const val aural : String = "aural" + const val all : String = "all" val values : List = listOf("screen", "print", "tty", "tv", "projection", "handheld", "braille", "aural", "all") } -@Suppress("unused") +@Suppress("unused", "ConstPropertyName") object LinkType { - val textAsp : String = "text/asp" - val textAsa : String = "text/asa" - val textCss : String = "text/css" - val textHtml : String = "text/html" - val textJavaScript : String = "text/javascript" - val textPlain : String = "text/plain" - val textScriptLet : String = "text/scriptlet" - val textXComponent : String = "text/x-component" - val textXHtmlInsertion : String = "text/x-html-insertion" - val textXml : String = "text/xml" + const val textAsp : String = "text/asp" + const val textAsa : String = "text/asa" + const val textCss : String = "text/css" + const val textHtml : String = "text/html" + const val textJavaScript : String = "text/javascript" + const val textPlain : String = "text/plain" + const val textScriptLet : String = "text/scriptlet" + const val textXComponent : String = "text/x-component" + const val textXHtmlInsertion : String = "text/x-html-insertion" + const val textXml : String = "text/xml" val values : List = listOf("textAsp", "textAsa", "textCss", "textHtml", "textJavaScript", "textPlain", "textScriptLet", "textXComponent", "textXHtmlInsertion", "textXml") } -@Suppress("unused") +@Suppress("unused", "EnumEntryName") enum class LinkAs(override val realValue : String) : AttributeEnum { audio("audio"), document("document"), @@ -352,82 +352,82 @@ enum class LinkAs(override val realValue : String) : AttributeEnum { worker("worker") } -internal val linkAsValues : Map = LinkAs.values().associateBy { it.realValue } -@Suppress("unused") +internal val linkAsValues : Map = LinkAs.entries.associateBy { it.realValue } +@Suppress("unused", "ConstPropertyName") object MetaHttpEquiv { - val contentLanguage : String = "content-language" - val contentType : String = "content-type" - val defaultStyle : String = "default-style" - val refresh : String = "refresh" + const val contentLanguage : String = "content-language" + const val contentType : String = "content-type" + const val defaultStyle : String = "default-style" + const val refresh : String = "refresh" val values : List = listOf("contentLanguage", "contentType", "defaultStyle", "refresh") } -@Suppress("unused") +@Suppress("unused", "ConstPropertyName") object ObjectName { - val blank : String = "_blank" - val parent : String = "_parent" - val self : String = "_self" - val top : String = "_top" + const val blank : String = "_blank" + const val parent : String = "_parent" + const val self : String = "_self" + const val top : String = "_top" val values : List = listOf("blank", "parent", "self", "top") } -@Suppress("unused") +@Suppress("unused", "ConstPropertyName") object ScriptType { - val textEcmaScript : String = "text/ecmascript" - val textJavaScript : String = "text/javascript" - val textJavaScript10 : String = "text/javascript1.0" - val textJavaScript11 : String = "text/javascript1.1" - val textJavaScript12 : String = "text/javascript1.2" - val textJavaScript13 : String = "text/javascript1.3" - val textJavaScript14 : String = "text/javascript1.4" - val textJavaScript15 : String = "text/javascript1.5" - val textJScript : String = "text/jscript" - val textXJavaScript : String = "text/x-javascript" - val textXEcmaScript : String = "text/x-ecmascript" - val textVbScript : String = "text/vbscript" + const val textEcmaScript : String = "text/ecmascript" + const val textJavaScript : String = "text/javascript" + const val textJavaScript10 : String = "text/javascript1.0" + const val textJavaScript11 : String = "text/javascript1.1" + const val textJavaScript12 : String = "text/javascript1.2" + const val textJavaScript13 : String = "text/javascript1.3" + const val textJavaScript14 : String = "text/javascript1.4" + const val textJavaScript15 : String = "text/javascript1.5" + const val textJScript : String = "text/jscript" + const val textXJavaScript : String = "text/x-javascript" + const val textXEcmaScript : String = "text/x-ecmascript" + const val textVbScript : String = "text/vbscript" val values : List = listOf("textEcmaScript", "textJavaScript", "textJavaScript10", "textJavaScript11", "textJavaScript12", "textJavaScript13", "textJavaScript14", "textJavaScript15", "textJScript", "textXJavaScript", "textXEcmaScript", "textVbScript") } -@Suppress("unused") +@Suppress("unused", "EnumEntryName") enum class ScriptCrossorigin(override val realValue : String) : AttributeEnum { anonymous("anonymous"), useCredentials("use-credentials") } -internal val scriptCrossoriginValues : Map = ScriptCrossorigin.values().associateBy { it.realValue } -@Suppress("unused") +internal val scriptCrossoriginValues : Map = ScriptCrossorigin.entries.associateBy { it.realValue } +@Suppress("unused", "ConstPropertyName") object StyleType { - val textCss : String = "text/css" + const val textCss : String = "text/css" val values : List = listOf("textCss") } -@Suppress("unused") +@Suppress("unused", "ConstPropertyName") object StyleMedia { - val screen : String = "screen" - val print : String = "print" - val tty : String = "tty" - val tv : String = "tv" - val projection : String = "projection" - val handheld : String = "handheld" - val braille : String = "braille" - val aural : String = "aural" - val all : String = "all" + const val screen : String = "screen" + const val print : String = "print" + const val tty : String = "tty" + const val tv : String = "tv" + const val projection : String = "projection" + const val handheld : String = "handheld" + const val braille : String = "braille" + const val aural : String = "aural" + const val all : String = "all" val values : List = listOf("screen", "print", "tty", "tv", "projection", "handheld", "braille", "aural", "all") } -@Suppress("unused") +@Suppress("unused", "EnumEntryName") enum class TextAreaWrap(override val realValue : String) : AttributeEnum { hard("hard"), soft("soft") } -internal val textAreaWrapValues : Map = TextAreaWrap.values().associateBy { it.realValue } -@Suppress("unused") +internal val textAreaWrapValues : Map = TextAreaWrap.entries.associateBy { it.realValue } +@Suppress("unused", "EnumEntryName") enum class ThScope(override val realValue : String) : AttributeEnum { col("col"), colGroup("colgroup"), @@ -435,4 +435,4 @@ enum class ThScope(override val realValue : String) : AttributeEnum { rowGroup("rowgroup") } -internal val thScopeValues : Map = ThScope.values().associateBy { it.realValue } +internal val thScopeValues : Map = ThScope.entries.associateBy { it.realValue }