diff options
author | Andrzej Ratajczak <andrzej.ratajczak98@gmail.com> | 2020-04-03 13:57:33 +0200 |
---|---|---|
committer | Kamil Doległo <kamilok1965@users.noreply.github.com> | 2020-04-15 14:33:24 +0200 |
commit | fee86d79a3aa7357c68c2f8f519d187f43447e8c (patch) | |
tree | 7ba7ef24bf7733e7778f0a5344756ed39c364a3a /plugins/jekyll/src/main | |
parent | 64e600b126ae8edcfbb3c2716febb01d221520b5 (diff) | |
download | dokka-fee86d79a3aa7357c68c2f8f519d187f43447e8c.tar.gz dokka-fee86d79a3aa7357c68c2f8f519d187f43447e8c.tar.bz2 dokka-fee86d79a3aa7357c68c2f8f519d187f43447e8c.zip |
Refactor package list to be a preprocessor
Diffstat (limited to 'plugins/jekyll/src/main')
-rw-r--r-- | plugins/jekyll/src/main/kotlin/JekyllPlugin.kt | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/jekyll/src/main/kotlin/JekyllPlugin.kt b/plugins/jekyll/src/main/kotlin/JekyllPlugin.kt index c4f7f2c7..b9f5e1a5 100644 --- a/plugins/jekyll/src/main/kotlin/JekyllPlugin.kt +++ b/plugins/jekyll/src/main/kotlin/JekyllPlugin.kt @@ -1,24 +1,47 @@ package org.jetbrains.dokka.jekyll import org.jetbrains.dokka.CoreExtensions +import org.jetbrains.dokka.base.renderers.PackageListCreator +import org.jetbrains.dokka.base.renderers.RootCreator import org.jetbrains.dokka.gfm.CommonmarkRenderer import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.DokkaPlugin +import org.jetbrains.dokka.plugability.plugin +import org.jetbrains.dokka.plugability.query +import org.jetbrains.dokka.transformers.pages.PageTransformer import java.lang.StringBuilder class JekyllPlugin : DokkaPlugin() { + val jekyllPreprocessors by extensionPoint<PageTransformer>() + val renderer by extending { CoreExtensions.renderer providing { JekyllRenderer(it) } applyIf { format == "jekyll" } } + + val rootCreator by extending { + jekyllPreprocessors with RootCreator + } + + val packageListCreator by extending { + jekyllPreprocessors providing { + PackageListCreator( + it, + "jekyll", + "md" + ) + } order { after(rootCreator) } + } } class JekyllRenderer( context: DokkaContext ) : CommonmarkRenderer(context) { + override val preprocessors = context.plugin<JekyllPlugin>().query { jekyllPreprocessors } + override fun buildPage(page: ContentPage, content: (StringBuilder, ContentPage) -> Unit): String { val builder = StringBuilder() builder.append("---\n") |