diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/api/core.api | 1 | ||||
-rw-r--r-- | core/src/main/kotlin/links/DRI.kt | 12 | ||||
-rw-r--r-- | core/src/main/kotlin/utilities/Html.kt | 4 |
3 files changed, 14 insertions, 3 deletions
diff --git a/core/api/core.api b/core/api/core.api index 8b9e5c7b..32d388f7 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -520,6 +520,7 @@ public final class org/jetbrains/dokka/links/DRIKt { public static final fun getSureClassNames (Lorg/jetbrains/dokka/links/DRI;)Ljava/lang/String; public static final fun nextTarget (Lorg/jetbrains/dokka/links/DriTarget;)Lorg/jetbrains/dokka/links/DriTarget; public static final fun withClass (Lorg/jetbrains/dokka/links/DRI;Ljava/lang/String;)Lorg/jetbrains/dokka/links/DRI; + public static final fun withEnumEntryExtra (Lorg/jetbrains/dokka/links/DRI;)Lorg/jetbrains/dokka/links/DRI; public static final fun withTargetToDeclaration (Lorg/jetbrains/dokka/links/DRI;)Lorg/jetbrains/dokka/links/DRI; } diff --git a/core/src/main/kotlin/links/DRI.kt b/core/src/main/kotlin/links/DRI.kt index 2cbae8cc..a1322ef6 100644 --- a/core/src/main/kotlin/links/DRI.kt +++ b/core/src/main/kotlin/links/DRI.kt @@ -56,9 +56,19 @@ fun DRI.withClass(name: String) = copy(classNames = if (classNames.isNullOrBlank fun DRI.withTargetToDeclaration() = copy(target = PointingToDeclaration) +fun DRI.withEnumEntryExtra() = copy( + extra = DRIExtraContainer(this.extra).also { it[EnumEntryDRIExtra] = EnumEntryDRIExtra }.encode() +) + val DRI.parent: DRI get() = when { - extra != null -> copy(extra = null) + extra != null -> when { + DRIExtraContainer(extra)[EnumEntryDRIExtra] != null -> copy( + classNames = classNames?.substringBeforeLast(".", "")?.takeIf { it.isNotBlank() }, + extra = null + ) + else -> copy(extra = null) + } target != PointingToDeclaration -> copy(target = PointingToDeclaration) callable != null -> copy(callable = null) classNames != null -> copy(classNames = classNames.substringBeforeLast(".", "").takeIf { it.isNotBlank() }) diff --git a/core/src/main/kotlin/utilities/Html.kt b/core/src/main/kotlin/utilities/Html.kt index 3226ca9d..874c9fb1 100644 --- a/core/src/main/kotlin/utilities/Html.kt +++ b/core/src/main/kotlin/utilities/Html.kt @@ -7,9 +7,9 @@ import java.net.URLEncoder * Replaces symbols reserved in HTML with their respective entities. * Replaces & with &, < with < and > with > */ -fun String.htmlEscape(): String = replace("&", "&").replace("<", "<").replace(">", ">") +fun String.htmlEscape(): String = replace("&", "&").replace("<", "<").replace(">", ">").replace("\"", """) fun String.urlEncoded(): String = URLEncoder.encode(this, "UTF-8") fun String.formatToEndWithHtml() = - if (endsWith(".html") || contains(Regex("\\.html#"))) this else "$this.html"
\ No newline at end of file + if (endsWith(".html") || contains(Regex("\\.html#"))) this else "$this.html" |