mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
generate_descriptor_pages.main.kts: Support attributes deprecation info
This commit is contained in:
parent
e7ef8add6f
commit
e2a2d03a5e
@ -266,6 +266,7 @@ fun StringBuilder.appendAttributes(attributeWrappers: List<AttributeWrapper>) {
|
||||
fun StringBuilder.appendAttribute(attribute: Attribute) {
|
||||
append("- `${attribute.name}`")
|
||||
appendAttributeRequirementAndAvailability(attribute)
|
||||
appendAttributeDeprecationInfo(attribute)
|
||||
attribute.description?.trim()?.let { append(it.indentLines(level = 1)) }
|
||||
attribute.defaultValue?.trim()?.let {
|
||||
appendLine("<br/>")
|
||||
@ -302,6 +303,23 @@ fun StringBuilder.appendAttributeRequirementAndAvailability(attribute: Attribute
|
||||
}
|
||||
}
|
||||
|
||||
fun StringBuilder.appendAttributeDeprecationInfo(attribute: Attribute) {
|
||||
val deprecatedSince = attribute.deprecatedSince
|
||||
val deprecationNote = attribute.deprecationNote
|
||||
if (deprecatedSince != null || deprecationNote != null) {
|
||||
if (deprecatedSince != null) {
|
||||
append("**_Deprecated since ${deprecatedSince}_**".indentLines(4))
|
||||
} else {
|
||||
append("**_Deprecated_**")
|
||||
}
|
||||
if (deprecationNote != null) {
|
||||
val noteWithoutLineBreaks = deprecationNote.replace('\n', ' ')
|
||||
append(": $noteWithoutLineBreaks")
|
||||
}
|
||||
}
|
||||
append("")
|
||||
}
|
||||
|
||||
fun StringBuilder.appendChildren(parent: Element, parentPath: String) {
|
||||
if (parent.children.isEmpty() && parent.childrenDescription == null) return
|
||||
if (parent.childrenDescription != null) {
|
||||
@ -454,6 +472,8 @@ data class Attribute(
|
||||
var name: String? = null,
|
||||
var since: String? = null,
|
||||
var until: String? = null,
|
||||
var deprecatedSince: String? = null,
|
||||
var deprecationNote: String? = null,
|
||||
var requirement: Requirement? = null,
|
||||
var description: String? = null,
|
||||
var defaultValue: String? = null,
|
||||
|
Loading…
x
Reference in New Issue
Block a user