diff options
author | Vadim Mishenev <vad-mishenev@yandex.ru> | 2022-02-22 12:56:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 12:56:41 +0300 |
commit | b9b1b588fad604c0cfc3e481f48338437dcaba5f (patch) | |
tree | 7c6a04d95f0f9b0c931b25dca91f1cf411f01105 /plugins/all-modules-page | |
parent | c44bf5487bd32f90a4576859548f1db0e9355a07 (diff) | |
download | dokka-b9b1b588fad604c0cfc3e481f48338437dcaba5f.tar.gz dokka-b9b1b588fad604c0cfc3e481f48338437dcaba5f.tar.bz2 dokka-b9b1b588fad604c0cfc3e481f48338437dcaba5f.zip |
Fix HTML head and favicon in multi-module projects (#2365)
Diffstat (limited to 'plugins/all-modules-page')
-rw-r--r-- | plugins/all-modules-page/api/all-modules-page.api | 2 | ||||
-rw-r--r-- | plugins/all-modules-page/src/main/kotlin/ResolveLinkCommandHandler.kt | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/plugins/all-modules-page/api/all-modules-page.api b/plugins/all-modules-page/api/all-modules-page.api index 9d8bca9b..0763d75a 100644 --- a/plugins/all-modules-page/api/all-modules-page.api +++ b/plugins/all-modules-page/api/all-modules-page.api @@ -83,5 +83,7 @@ public final class org/jetbrains/dokka/allModulesPage/ResolveLinkCommandHandler public fun canHandle (Lorg/jetbrains/dokka/base/templating/Command;)Z public fun finish (Ljava/io/File;)V public fun handleCommand (Lorg/jsoup/nodes/Element;Lorg/jetbrains/dokka/base/templating/Command;Ljava/io/File;Ljava/io/File;)V + public fun handleCommandAsComment (Lorg/jetbrains/dokka/base/templating/Command;Ljava/util/List;Ljava/io/File;Ljava/io/File;)V + public fun handleCommandAsTag (Lorg/jetbrains/dokka/base/templating/Command;Lorg/jsoup/nodes/Element;Ljava/io/File;Ljava/io/File;)V } diff --git a/plugins/all-modules-page/src/main/kotlin/ResolveLinkCommandHandler.kt b/plugins/all-modules-page/src/main/kotlin/ResolveLinkCommandHandler.kt index e881a5ab..7976ba5a 100644 --- a/plugins/all-modules-page/src/main/kotlin/ResolveLinkCommandHandler.kt +++ b/plugins/all-modules-page/src/main/kotlin/ResolveLinkCommandHandler.kt @@ -16,29 +16,29 @@ class ResolveLinkCommandHandler(context: DokkaContext) : CommandHandler { private val externalModuleLinkResolver = context.plugin<AllModulesPagePlugin>().querySingle { externalModuleLinkResolver } - override fun handleCommand(element: Element, command: Command, input: File, output: File) { + override fun handleCommandAsTag(command: Command, body: Element, input: File, output: File) { command as ResolveLinkCommand val link = externalModuleLinkResolver.resolve(command.dri, output) if (link == null) { - val children = element.childNodes().toList() + val children = body.childNodes().toList() val attributes = Attributes().apply { put("data-unresolved-link", command.dri.toString()) } val el = Element(Tag.valueOf("span"), "", attributes).apply { children.forEach { ch -> appendChild(ch) } } - element.replaceWith(el) + body.replaceWith(el) return } val attributes = Attributes().apply { put("href", link) } - val children = element.childNodes().toList() + val children = body.childNodes().toList() val el = Element(Tag.valueOf("a"), "", attributes).apply { children.forEach { ch -> appendChild(ch) } } - element.replaceWith(el) + body.replaceWith(el) } override fun canHandle(command: Command): Boolean = command is ResolveLinkCommand |