blob: 262dd0a099704f1028dd5232eddbd4a302ece04a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
package org.jetbrains.dokka.utilities
import org.jetbrains.dokka.InternalDokkaApi
import java.net.URLEncoder
/**
* Replaces symbols reserved in HTML with their respective entities.
* Replaces & with &, < with < and > with >
*/
@InternalDokkaApi
fun String.htmlEscape(): String = replace("&", "&").replace("<", "<").replace(">", ">").replace("\"", """)
@InternalDokkaApi
fun String.urlEncoded(): String = URLEncoder.encode(this, "UTF-8")
@InternalDokkaApi
fun String.formatToEndWithHtml() =
if (endsWith(".html") || contains(Regex("\\.html#"))) this else "$this.html"
|