Skip to content

Commit 0832e98

Browse files
Added IE-specific values for textarea wrap attribute (#266)
* Added IE-specific values for textarea wrap attribute * Reworded deprecation message * Regenerated TextAreaWrap with corrected deprecation message * Updated gen-tag-unions.kt for code merged in from master
1 parent 8531fec commit 0832e98

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed

buildSrc/src/main/kotlin/kotlinx/html/generate/rules.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ fun isEnumExcluded(name: String) = excludedEnums.any { it.containsMatchIn(name)
7878

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

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

8486
fun findEnumDeprecation(attribute: AttributeInfo, value: AttributeEnumValue): String? {
8587
return deprecated.firstOrNull { p -> p.first.matches("""${attribute.enumTypeName}#${value.realName}""") }?.second

buildSrc/src/main/resources/html_5.xsd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,9 @@
17061706
<xsd:restriction base="xsd:NMTOKEN">
17071707
<xsd:enumeration value="hard"/>
17081708
<xsd:enumeration value="soft"/>
1709+
<xsd:enumeration value="virtual"/>
1710+
<xsd:enumeration value="physical"/>
1711+
<xsd:enumeration value="off"/>
17091712
</xsd:restriction>
17101713
</xsd:simpleType>
17111714
</xsd:attribute>

src/commonMain/kotlin/generated/gen-enums.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,10 @@ object StyleMedia {
423423
@Suppress("unused")
424424
enum class TextAreaWrap(override val realValue : String) : AttributeEnum {
425425
hard("hard"),
426-
soft("soft")
426+
soft("soft"),
427+
@Deprecated("value only supported in IE") virtual("virtual"),
428+
@Deprecated("value only supported in IE") physical("physical"),
429+
@Deprecated("value only supported in IE") off("off")
427430
}
428431

429432
internal val textAreaWrapValues : Map<String, TextAreaWrap> = TextAreaWrap.values().associateBy { it.realValue }

src/commonMain/kotlin/generated/gen-tag-unions.kt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,10 +1066,40 @@ inline fun FlowOrInteractiveOrPhrasingContent.softTextArea(rows : String? = null
10661066
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
10671067
TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", TextAreaWrap.soft.realValue,"class", classes), consumer).visit(block)
10681068
}
1069+
@Suppress("DEPRECATION")
1070+
@HtmlTagMarker
1071+
@OptIn(ExperimentalContracts::class)
1072+
inline fun FlowOrInteractiveOrPhrasingContent.virtualTextArea(rows : String? = null, cols : String? = null, classes : String? = null, crossinline block : TEXTAREA.() -> Unit = {}) : Unit {
1073+
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
1074+
TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", TextAreaWrap.virtual.realValue,"class", classes), consumer).visit(block)
1075+
}
1076+
@Suppress("DEPRECATION")
1077+
@HtmlTagMarker
1078+
@OptIn(ExperimentalContracts::class)
1079+
inline fun FlowOrInteractiveOrPhrasingContent.physicalTextArea(rows : String? = null, cols : String? = null, classes : String? = null, crossinline block : TEXTAREA.() -> Unit = {}) : Unit {
1080+
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
1081+
TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", TextAreaWrap.physical.realValue,"class", classes), consumer).visit(block)
1082+
}
1083+
@Suppress("DEPRECATION")
1084+
@HtmlTagMarker
1085+
@OptIn(ExperimentalContracts::class)
1086+
inline fun FlowOrInteractiveOrPhrasingContent.offTextArea(rows : String? = null, cols : String? = null, classes : String? = null, crossinline block : TEXTAREA.() -> Unit = {}) : Unit {
1087+
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
1088+
TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", TextAreaWrap.off.realValue,"class", classes), consumer).visit(block)
1089+
}
10691090
@HtmlTagMarker
10701091
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})
10711092
@HtmlTagMarker
10721093
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})
1094+
@Suppress("DEPRECATION")
1095+
@HtmlTagMarker
1096+
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})
1097+
@Suppress("DEPRECATION")
1098+
@HtmlTagMarker
1099+
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})
1100+
@Suppress("DEPRECATION")
1101+
@HtmlTagMarker
1102+
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})
10731103

10741104
/**
10751105
* Video player

0 commit comments

Comments
 (0)