Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added IE-specific values for textarea wrap attribute #266

Merged
merged 6 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions buildSrc/src/main/kotlin/kotlinx/html/generate/rules.kt
Expand Up @@ -78,8 +78,10 @@ fun isEnumExcluded(name: String) = excludedEnums.any { it.containsMatchIn(name)

val contentlessTags = setOf("html", "head", "script", "style")

val deprecated = listOf(".*FormMethod#(put|patch|delete)" to "method is not allowed in browsers")
.map { it.first.toRegex(RegexOption.IGNORE_CASE) to it.second }
val deprecated = listOf(
".*FormMethod#(put|patch|delete)" to "method is not allowed in browsers",
".*TextAreaWrap#(virtual|physical|off)" to "value only supported in IE"
).map { it.first.toRegex(RegexOption.IGNORE_CASE) to it.second }

fun findEnumDeprecation(attribute: AttributeInfo, value: AttributeEnumValue): String? {
return deprecated.firstOrNull { p -> p.first.matches("""${attribute.enumTypeName}#${value.realName}""") }?.second
Expand Down
3 changes: 3 additions & 0 deletions buildSrc/src/main/resources/html_5.xsd
Expand Up @@ -1706,6 +1706,9 @@
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="hard"/>
<xsd:enumeration value="soft"/>
<xsd:enumeration value="virtual"/>
<xsd:enumeration value="physical"/>
<xsd:enumeration value="off"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
Expand Down
5 changes: 4 additions & 1 deletion src/commonMain/kotlin/generated/gen-enums.kt
Expand Up @@ -423,7 +423,10 @@ object StyleMedia {
@Suppress("unused")
enum class TextAreaWrap(override val realValue : String) : AttributeEnum {
hard("hard"),
soft("soft")
soft("soft"),
@Deprecated("value only supported in IE") virtual("virtual"),
@Deprecated("value only supported in IE") physical("physical"),
@Deprecated("value only supported in IE") off("off")
}

internal val textAreaWrapValues : Map<String, TextAreaWrap> = TextAreaWrap.values().associateBy { it.realValue }
Expand Down
30 changes: 30 additions & 0 deletions src/commonMain/kotlin/generated/gen-tag-unions.kt
Expand Up @@ -1066,10 +1066,40 @@ inline fun FlowOrInteractiveOrPhrasingContent.softTextArea(rows : String? = null
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", TextAreaWrap.soft.realValue,"class", classes), consumer).visit(block)
}
@Suppress("DEPRECATION")
@HtmlTagMarker
@OptIn(ExperimentalContracts::class)
inline fun FlowOrInteractiveOrPhrasingContent.virtualTextArea(rows : String? = null, cols : String? = null, classes : String? = null, crossinline block : TEXTAREA.() -> Unit = {}) : Unit {
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", TextAreaWrap.virtual.realValue,"class", classes), consumer).visit(block)
}
@Suppress("DEPRECATION")
@HtmlTagMarker
@OptIn(ExperimentalContracts::class)
inline fun FlowOrInteractiveOrPhrasingContent.physicalTextArea(rows : String? = null, cols : String? = null, classes : String? = null, crossinline block : TEXTAREA.() -> Unit = {}) : Unit {
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", TextAreaWrap.physical.realValue,"class", classes), consumer).visit(block)
}
@Suppress("DEPRECATION")
@HtmlTagMarker
@OptIn(ExperimentalContracts::class)
inline fun FlowOrInteractiveOrPhrasingContent.offTextArea(rows : String? = null, cols : String? = null, classes : String? = null, crossinline block : TEXTAREA.() -> Unit = {}) : Unit {
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", TextAreaWrap.off.realValue,"class", classes), consumer).visit(block)
}
@HtmlTagMarker
fun FlowOrInteractiveOrPhrasingContent.hardTextArea(rows : String? = null, cols : String? = null, classes : String? = null, content : String = "") : Unit = TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", TextAreaWrap.hard.realValue,"class", classes), consumer).visit({+content})
@HtmlTagMarker
fun FlowOrInteractiveOrPhrasingContent.softTextArea(rows : String? = null, cols : String? = null, classes : String? = null, content : String = "") : Unit = TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", TextAreaWrap.soft.realValue,"class", classes), consumer).visit({+content})
@Suppress("DEPRECATION")
@HtmlTagMarker
fun FlowOrInteractiveOrPhrasingContent.virtualTextArea(rows : String? = null, cols : String? = null, classes : String? = null, content : String = "") : Unit = TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", TextAreaWrap.virtual.realValue,"class", classes), consumer).visit({+content})
@Suppress("DEPRECATION")
@HtmlTagMarker
fun FlowOrInteractiveOrPhrasingContent.physicalTextArea(rows : String? = null, cols : String? = null, classes : String? = null, content : String = "") : Unit = TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", TextAreaWrap.physical.realValue,"class", classes), consumer).visit({+content})
@Suppress("DEPRECATION")
@HtmlTagMarker
fun FlowOrInteractiveOrPhrasingContent.offTextArea(rows : String? = null, cols : String? = null, classes : String? = null, content : String = "") : Unit = TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", TextAreaWrap.off.realValue,"class", classes), consumer).visit({+content})

/**
* Video player
Expand Down