blob: 2d2c8e36d656af506e75a9c5a3f613dfcfee9431 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package org.jetbrains.dokka.versioning
import org.jetbrains.dokka.base.templating.Command
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.plugin
import org.jetbrains.dokka.plugability.querySingle
import org.jetbrains.dokka.templates.CommandHandler
import org.jsoup.nodes.Element
import java.io.File
object ReplaceVersionsCommand : Command
class ReplaceVersionCommandHandler(context: DokkaContext) : CommandHandler {
val versionsNavigationCreator by lazy {
context.plugin<VersioningPlugin>().querySingle { versionsNavigationCreator }
}
override fun canHandle(command: Command): Boolean = command is ReplaceVersionsCommand
override fun handleCommand(element: Element, command: Command, input: File, output: File) {
element.empty()
element.append(versionsNavigationCreator(output))
}
}
|