-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make versioning navigator for WebHelp
- Loading branch information
Showing
18 changed files
with
114 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
plugins/base/src/main/kotlin/renderers/html/command/consumers/ReplaceVersionsConsumer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(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() | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
plugins/base/src/main/kotlin/templating/ReplaceVersionsCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package org.jetbrains.dokka.base.templating | ||
|
||
data class ReplaceVersionsCommand(var location: String = ""): Command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
plugins/templating/src/main/kotlin/templates/ReplaceVersionCommandHandler.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package templates | ||
|
||
import org.jetbrains.dokka.base.templating.Command | ||
import org.jetbrains.dokka.base.templating.ReplaceVersionsCommand | ||
import org.jetbrains.dokka.plugability.DokkaContext | ||
import org.jetbrains.dokka.templates.CommandHandler | ||
import org.jsoup.nodes.Element | ||
import org.jsoup.nodes.TextNode | ||
import java.io.File | ||
|
||
class ReplaceVersionCommandHandler(val context: DokkaContext) : CommandHandler { | ||
|
||
override fun canHandle(command: Command): Boolean = command is ReplaceVersionsCommand | ||
|
||
override fun handleCommand(element: Element, command: Command, input: File, output: File) { | ||
val position = element.elementSiblingIndex() | ||
val parent = element.parent() | ||
element.remove() | ||
|
||
parent.insertChildren(position, TextNode(context.configuration.moduleVersion.orEmpty())) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 0 additions & 57 deletions
57
plugins/versioning/src/main/kotlin/versioning/VersionsNavigationAdder.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.