diff --git a/buildSrc/src/main/resources/html_5.xsd b/buildSrc/src/main/resources/html_5.xsd index 6bc4ed82..fe114f3e 100644 --- a/buildSrc/src/main/resources/html_5.xsd +++ b/buildSrc/src/main/resources/html_5.xsd @@ -495,6 +495,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/commonMain/kotlin/generated/gen-attributes.kt b/src/commonMain/kotlin/generated/gen-attributes.kt index ad0b0dd8..a342c1d6 100644 --- a/src/commonMain/kotlin/generated/gen-attributes.kt +++ b/src/commonMain/kotlin/generated/gen-attributes.kt @@ -46,6 +46,8 @@ internal val attributeInputTypeEnumInputTypeValues : Attribute = Enum internal val attributeKeyGenKeyTypeEnumKeyGenKeyTypeValues : Attribute = EnumAttribute(keyGenKeyTypeValues) +internal val attributeLinkAsEnumLinkAsValues : Attribute = EnumAttribute(linkAsValues) + internal val attributeRunAtEnumRunAtValues : Attribute = EnumAttribute(runAtValues) internal val attributeScriptCrossoriginEnumScriptCrossoriginValues : Attribute = EnumAttribute(scriptCrossoriginValues) diff --git a/src/commonMain/kotlin/generated/gen-consumer-tags.kt b/src/commonMain/kotlin/generated/gen-consumer-tags.kt index e60657d4..f4d27e49 100644 --- a/src/commonMain/kotlin/generated/gen-consumer-tags.kt +++ b/src/commonMain/kotlin/generated/gen-consumer-tags.kt @@ -88,6 +88,7 @@ import kotlinx.html.LABEL import kotlinx.html.LEGEND import kotlinx.html.LI import kotlinx.html.LINK +import kotlinx.html.LinkAs import kotlinx.html.MAIN import kotlinx.html.MAP import kotlinx.html.MARK @@ -938,10 +939,12 @@ public inline fun > C.link( href: String? = null, rel: String? = null, type: String? = null, + htmlAs: LinkAs? = null, crossinline block: LINK.() -> Unit = {}, ): T { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } - return LINK(attributesMapOf("href", href,"rel", rel,"type", type), this) + return LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", htmlAs?.enumEncode()), + this) .visitAndFinalize(this, block) } diff --git a/src/commonMain/kotlin/generated/gen-enums.kt b/src/commonMain/kotlin/generated/gen-enums.kt index 6c666c19..0445335e 100644 --- a/src/commonMain/kotlin/generated/gen-enums.kt +++ b/src/commonMain/kotlin/generated/gen-enums.kt @@ -336,6 +336,23 @@ object LinkType { val values : List = listOf("textAsp", "textAsa", "textCss", "textHtml", "textJavaScript", "textPlain", "textScriptLet", "textXComponent", "textXHtmlInsertion", "textXml") } +@Suppress("unused") +enum class LinkAs(override val realValue : String) : AttributeEnum { + audio("audio"), + document("document"), + embed("embed"), + fetch("fetch"), + font("font"), + image("image"), + htmlObject("object"), + script("script"), + style("style"), + track("track"), + video("video"), + worker("worker") +} + +internal val linkAsValues : Map = LinkAs.values().associateBy { it.realValue } @Suppress("unused") object MetaHttpEquiv { val contentLanguage : String = "content-language" diff --git a/src/commonMain/kotlin/generated/gen-tag-unions.kt b/src/commonMain/kotlin/generated/gen-tag-unions.kt index 3b117df0..391b0d18 100644 --- a/src/commonMain/kotlin/generated/gen-tag-unions.kt +++ b/src/commonMain/kotlin/generated/gen-tag-unions.kt @@ -65,9 +65,81 @@ inline fun FlowOrMetaDataOrPhrasingContent.radioCommand(classes : String? = null */ @HtmlTagMarker @OptIn(ExperimentalContracts::class) -inline fun FlowOrMetaDataOrPhrasingContent.link(href : String? = null, rel : String? = null, type : String? = null, crossinline block : LINK.() -> Unit = {}) : Unit { +inline fun FlowOrMetaDataOrPhrasingContent.link(href : String? = null, rel : String? = null, type : String? = null, htmlAs : LinkAs? = null, crossinline block : LINK.() -> Unit = {}) : Unit { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } - LINK(attributesMapOf("href", href,"rel", rel,"type", type), consumer).visit(block) + LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", htmlAs?.enumEncode()), consumer).visit(block) +} +@HtmlTagMarker +@OptIn(ExperimentalContracts::class) +inline fun FlowOrMetaDataOrPhrasingContent.audioLink(href : String? = null, rel : String? = null, type : String? = null, crossinline block : LINK.() -> Unit = {}) : Unit { + contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } + LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", LinkAs.audio.realValue), consumer).visit(block) +} +@HtmlTagMarker +@OptIn(ExperimentalContracts::class) +inline fun FlowOrMetaDataOrPhrasingContent.documentLink(href : String? = null, rel : String? = null, type : String? = null, crossinline block : LINK.() -> Unit = {}) : Unit { + contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } + LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", LinkAs.document.realValue), consumer).visit(block) +} +@HtmlTagMarker +@OptIn(ExperimentalContracts::class) +inline fun FlowOrMetaDataOrPhrasingContent.embedLink(href : String? = null, rel : String? = null, type : String? = null, crossinline block : LINK.() -> Unit = {}) : Unit { + contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } + LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", LinkAs.embed.realValue), consumer).visit(block) +} +@HtmlTagMarker +@OptIn(ExperimentalContracts::class) +inline fun FlowOrMetaDataOrPhrasingContent.fetchLink(href : String? = null, rel : String? = null, type : String? = null, crossinline block : LINK.() -> Unit = {}) : Unit { + contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } + LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", LinkAs.fetch.realValue), consumer).visit(block) +} +@HtmlTagMarker +@OptIn(ExperimentalContracts::class) +inline fun FlowOrMetaDataOrPhrasingContent.fontLink(href : String? = null, rel : String? = null, type : String? = null, crossinline block : LINK.() -> Unit = {}) : Unit { + contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } + LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", LinkAs.font.realValue), consumer).visit(block) +} +@HtmlTagMarker +@OptIn(ExperimentalContracts::class) +inline fun FlowOrMetaDataOrPhrasingContent.imageLink(href : String? = null, rel : String? = null, type : String? = null, crossinline block : LINK.() -> Unit = {}) : Unit { + contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } + LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", LinkAs.image.realValue), consumer).visit(block) +} +@HtmlTagMarker +@OptIn(ExperimentalContracts::class) +inline fun FlowOrMetaDataOrPhrasingContent.htmlObjectLink(href : String? = null, rel : String? = null, type : String? = null, crossinline block : LINK.() -> Unit = {}) : Unit { + contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } + LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", LinkAs.htmlObject.realValue), consumer).visit(block) +} +@HtmlTagMarker +@OptIn(ExperimentalContracts::class) +inline fun FlowOrMetaDataOrPhrasingContent.scriptLink(href : String? = null, rel : String? = null, type : String? = null, crossinline block : LINK.() -> Unit = {}) : Unit { + contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } + LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", LinkAs.script.realValue), consumer).visit(block) +} +@HtmlTagMarker +@OptIn(ExperimentalContracts::class) +inline fun FlowOrMetaDataOrPhrasingContent.styleLink(href : String? = null, rel : String? = null, type : String? = null, crossinline block : LINK.() -> Unit = {}) : Unit { + contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } + LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", LinkAs.style.realValue), consumer).visit(block) +} +@HtmlTagMarker +@OptIn(ExperimentalContracts::class) +inline fun FlowOrMetaDataOrPhrasingContent.trackLink(href : String? = null, rel : String? = null, type : String? = null, crossinline block : LINK.() -> Unit = {}) : Unit { + contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } + LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", LinkAs.track.realValue), consumer).visit(block) +} +@HtmlTagMarker +@OptIn(ExperimentalContracts::class) +inline fun FlowOrMetaDataOrPhrasingContent.videoLink(href : String? = null, rel : String? = null, type : String? = null, crossinline block : LINK.() -> Unit = {}) : Unit { + contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } + LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", LinkAs.video.realValue), consumer).visit(block) +} +@HtmlTagMarker +@OptIn(ExperimentalContracts::class) +inline fun FlowOrMetaDataOrPhrasingContent.workerLink(href : String? = null, rel : String? = null, type : String? = null, crossinline block : LINK.() -> Unit = {}) : Unit { + contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } + LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", LinkAs.worker.realValue), consumer).visit(block) } /** diff --git a/src/commonMain/kotlin/generated/gen-tags-l.kt b/src/commonMain/kotlin/generated/gen-tags-l.kt index 15286c62..587d3477 100644 --- a/src/commonMain/kotlin/generated/gen-tags-l.kt +++ b/src/commonMain/kotlin/generated/gen-tags-l.kt @@ -84,6 +84,10 @@ open class LINK(initialAttributes : Map, override val consumer : get() = attributeStringString.get(this, "integrity") set(newValue) {attributeStringString.set(this, "integrity", newValue)} + var htmlAs : LinkAs + get() = attributeLinkAsEnumLinkAsValues.get(this, "as") + set(newValue) {attributeLinkAsEnumLinkAsValues.set(this, "as", newValue)} + } val LINK.asFlowContent : FlowContent diff --git a/src/jsMain/kotlin/generated/gen-consumer-tags-js.kt b/src/jsMain/kotlin/generated/gen-consumer-tags-js.kt index 0da5c12d..51ec3641 100644 --- a/src/jsMain/kotlin/generated/gen-consumer-tags-js.kt +++ b/src/jsMain/kotlin/generated/gen-consumer-tags-js.kt @@ -88,6 +88,7 @@ import kotlinx.html.LABEL import kotlinx.html.LEGEND import kotlinx.html.LI import kotlinx.html.LINK +import kotlinx.html.LinkAs import kotlinx.html.MAIN import kotlinx.html.MAP import kotlinx.html.MARK @@ -992,10 +993,12 @@ public inline fun TagConsumer.link( href: String? = null, rel: String? = null, type: String? = null, + htmlAs: LinkAs? = null, crossinline block: LINK.() -> Unit = {}, ): HTMLLinkElement { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } - return LINK(attributesMapOf("href", href,"rel", rel,"type", type), this) + return LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", htmlAs?.enumEncode()), + this) .visitAndFinalize(this, block) as HTMLLinkElement } diff --git a/src/jvmTest/kotlin/streaming.kt b/src/jvmTest/kotlin/streaming.kt index 5212800f..ae796264 100644 --- a/src/jvmTest/kotlin/streaming.kt +++ b/src/jvmTest/kotlin/streaming.kt @@ -181,10 +181,14 @@ class TestStreaming { } @Test fun `test generated enum could be used`() { - assertEquals("", StringBuilder().appendHTML(false).link { - rel = LinkRel.stylesheet - href = "/path" - }.toString()) + assertEquals( + "", + StringBuilder().appendHTML(false).link { + rel = LinkRel.stylesheet + href = "/path" + htmlAs = LinkAs.style + }.toString() + ) } @Test fun `anchor with href syntax`() { diff --git a/src/wasmJsMain/kotlin/generated/gen-consumer-tags-wasm-js.kt b/src/wasmJsMain/kotlin/generated/gen-consumer-tags-wasm-js.kt index 99ccb9d6..03acc713 100644 --- a/src/wasmJsMain/kotlin/generated/gen-consumer-tags-wasm-js.kt +++ b/src/wasmJsMain/kotlin/generated/gen-consumer-tags-wasm-js.kt @@ -88,6 +88,7 @@ import kotlinx.html.LABEL import kotlinx.html.LEGEND import kotlinx.html.LI import kotlinx.html.LINK +import kotlinx.html.LinkAs import kotlinx.html.MAIN import kotlinx.html.MAP import kotlinx.html.MARK @@ -991,10 +992,12 @@ public inline fun TagConsumer.link( href: String? = null, rel: String? = null, type: String? = null, + htmlAs: LinkAs? = null, crossinline block: LINK.() -> Unit = {}, ): HTMLLinkElement { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } - return LINK(attributesMapOf("href", href,"rel", rel,"type", type), this) + return LINK(attributesMapOf("href", href,"rel", rel,"type", type,"as", htmlAs?.enumEncode()), + this) .visitAndFinalize(this, block) as HTMLLinkElement }