diff options
author | vmishenev <vad-mishenev@yandex.ru> | 2021-09-01 00:03:13 +0300 |
---|---|---|
committer | vmishenev <vad-mishenev@yandex.ru> | 2021-09-20 19:01:44 +0300 |
commit | fc5496fb8bb888c3a50717260dc05d8fe2d54306 (patch) | |
tree | 2b61c01babe696065c4b8bafad61cce7479561ad /plugins/base/src/main/kotlin/renderers/html/command/consumers | |
parent | 8efe04e127e3bf0aef395b31f3f3d9f49a0afe26 (diff) | |
download | dokka-fc5496fb8bb888c3a50717260dc05d8fe2d54306.tar.gz dokka-fc5496fb8bb888c3a50717260dc05d8fe2d54306.tar.bz2 dokka-fc5496fb8bb888c3a50717260dc05d8fe2d54306.zip |
Improve versioning plugin (#2104)
- support for single module projects
- version navigator is on all pages
- dropdown arrow for version navigator
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html/command/consumers')
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/command/consumers/ReplaceVersionsConsumer.kt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/command/consumers/ReplaceVersionsConsumer.kt b/plugins/base/src/main/kotlin/renderers/html/command/consumers/ReplaceVersionsConsumer.kt new file mode 100644 index 00000000..ea8cde0f --- /dev/null +++ b/plugins/base/src/main/kotlin/renderers/html/command/consumers/ReplaceVersionsConsumer.kt @@ -0,0 +1,25 @@ +package org.jetbrains.dokka.base.renderers.html.command.consumers + +import org.jetbrains.dokka.base.renderers.html.TemplateBlock +import org.jetbrains.dokka.base.templating.Command +import org.jetbrains.dokka.base.templating.ImmediateHtmlCommandConsumer +import org.jetbrains.dokka.base.templating.ReplaceVersionsCommand +import org.jetbrains.dokka.plugability.DokkaContext + +class ReplaceVersionsConsumer(private val context: DokkaContext) : ImmediateHtmlCommandConsumer { + override fun canProcess(command: Command) = command is ReplaceVersionsCommand + + override fun <R> processCommand( + command: Command, + block: TemplateBlock, + tagConsumer: ImmediateResolutionTagConsumer<R> + ) { + command as ReplaceVersionsCommand + tagConsumer.onTagContentUnsafe { +context.configuration.moduleVersion.orEmpty() } + } + + override fun <R> processCommandAndFinalize(command: Command, block: TemplateBlock, tagConsumer: ImmediateResolutionTagConsumer<R>): R { + PathToRootConsumer.processCommand(command, block, tagConsumer) + return tagConsumer.finalize() + } +}
\ No newline at end of file |