diff options
author | Błażej Kardyś <bkardys@virtuslab.com> | 2020-11-13 22:05:15 +0100 |
---|---|---|
committer | Błażej Kardyś <bkardys@virtuslab.com> | 2020-11-27 03:15:02 +0100 |
commit | c203be9fb65ee221875b4e1c865bcd289a85e69c (patch) | |
tree | 40384c13d98f722dbb7c819f8ebadb6caac01651 /plugins/gfm/src | |
parent | 4639cbda50359c8dcbaa61f0a960c002c060d3b9 (diff) | |
download | dokka-c203be9fb65ee221875b4e1c865bcd289a85e69c.tar.gz dokka-c203be9fb65ee221875b4e1c865bcd289a85e69c.tar.bz2 dokka-c203be9fb65ee221875b4e1c865bcd289a85e69c.zip |
Adding multimodule all modules page creation for gfm
Diffstat (limited to 'plugins/gfm/src')
-rw-r--r-- | plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/GfmPlugin.kt | 36 | ||||
-rw-r--r-- | plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/location/MarkdownLocationProvider.kt | 16 | ||||
-rw-r--r-- | plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt (renamed from plugins/gfm/src/main/kotlin/GfmPlugin.kt) | 54 | ||||
-rw-r--r-- | plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt | 2 | ||||
-rw-r--r-- | plugins/gfm/src/test/kotlin/renderers/gfm/GfmRenderingOnlyTestBase.kt | 2 | ||||
-rw-r--r-- | plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt | 2 | ||||
-rw-r--r-- | plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt | 2 | ||||
-rw-r--r-- | plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt | 2 |
8 files changed, 60 insertions, 56 deletions
diff --git a/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/GfmPlugin.kt b/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/GfmPlugin.kt new file mode 100644 index 00000000..3f2eae4d --- /dev/null +++ b/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/GfmPlugin.kt @@ -0,0 +1,36 @@ +package org.jetbrains.dokka.gfm + +import org.jetbrains.dokka.CoreExtensions +import org.jetbrains.dokka.base.DokkaBase +import org.jetbrains.dokka.base.renderers.PackageListCreator +import org.jetbrains.dokka.base.renderers.RootCreator +import org.jetbrains.dokka.base.resolvers.shared.RecognizedLinkFormat +import org.jetbrains.dokka.gfm.location.MarkdownLocationProviderFactory +import org.jetbrains.dokka.gfm.renderer.CommonmarkRenderer +import org.jetbrains.dokka.plugability.DokkaPlugin +import org.jetbrains.dokka.transformers.pages.PageTransformer + +class GfmPlugin : DokkaPlugin() { + + val gfmPreprocessors by extensionPoint<PageTransformer>() + + private val dokkaBase by lazy { plugin<DokkaBase>() } + + val renderer by extending { + CoreExtensions.renderer providing ::CommonmarkRenderer override dokkaBase.htmlRenderer + } + + val locationProvider by extending { + dokkaBase.locationProviderFactory providing ::MarkdownLocationProviderFactory override dokkaBase.locationProvider + } + + val rootCreator by extending { + gfmPreprocessors with RootCreator + } + + val packageListCreator by extending { + (gfmPreprocessors + providing { PackageListCreator(it, RecognizedLinkFormat.DokkaGFM) } + order { after(rootCreator) }) + } +} diff --git a/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/location/MarkdownLocationProvider.kt b/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/location/MarkdownLocationProvider.kt new file mode 100644 index 00000000..6f96dbd5 --- /dev/null +++ b/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/location/MarkdownLocationProvider.kt @@ -0,0 +1,16 @@ +package org.jetbrains.dokka.gfm.location + +import org.jetbrains.dokka.base.resolvers.local.DokkaLocationProvider +import org.jetbrains.dokka.base.resolvers.local.LocationProviderFactory +import org.jetbrains.dokka.pages.RootPageNode +import org.jetbrains.dokka.plugability.DokkaContext + +class MarkdownLocationProviderFactory(val context: DokkaContext) : LocationProviderFactory { + override fun getLocationProvider(pageNode: RootPageNode) = MarkdownLocationProvider(pageNode, context) +} + +class MarkdownLocationProvider( + pageGraphRoot: RootPageNode, + dokkaContext: DokkaContext +) : DokkaLocationProvider(pageGraphRoot, dokkaContext, ".md") + diff --git a/plugins/gfm/src/main/kotlin/GfmPlugin.kt b/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt index 780e4cb2..0655ce20 100644 --- a/plugins/gfm/src/main/kotlin/GfmPlugin.kt +++ b/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt @@ -1,52 +1,14 @@ -package org.jetbrains.dokka.gfm +package org.jetbrains.dokka.gfm.renderer -import org.jetbrains.dokka.CoreExtensions -import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.DokkaException -import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.renderers.DefaultRenderer -import org.jetbrains.dokka.base.renderers.PackageListCreator -import org.jetbrains.dokka.base.renderers.RootCreator import org.jetbrains.dokka.base.renderers.isImage -import org.jetbrains.dokka.base.resolvers.local.DokkaLocationProvider -import org.jetbrains.dokka.base.resolvers.local.LocationProviderFactory +import org.jetbrains.dokka.gfm.GfmPlugin import org.jetbrains.dokka.model.DisplaySourceSet -import org.jetbrains.dokka.base.resolvers.shared.RecognizedLinkFormat 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 - -class GfmPlugin : DokkaPlugin() { - - val gfmPreprocessors by extensionPoint<PageTransformer>() - - private val dokkaBase by lazy { plugin<DokkaBase>() } - - val renderer by extending { - (CoreExtensions.renderer - providing { CommonmarkRenderer(it) } - override dokkaBase.htmlRenderer) - } - - val locationProvider by extending { - (dokkaBase.locationProviderFactory - providing { MarkdownLocationProviderFactory(it) } - override dokkaBase.locationProvider) - } - - val rootCreator by extending { - gfmPreprocessors with RootCreator - } - - val packageListCreator by extending { - (gfmPreprocessors - providing { PackageListCreator(it, RecognizedLinkFormat.DokkaGFM) } - order { after(rootCreator) }) - } -} open class CommonmarkRenderer( context: DokkaContext @@ -357,14 +319,4 @@ open class CommonmarkRenderer( private fun StringBuilder.buildSourceSetTags(sourceSets: Set<DisplaySourceSet>) = append(sourceSets.joinToString(prefix = "[", postfix = "]") { it.name }) -} - -class MarkdownLocationProviderFactory(val context: DokkaContext) : LocationProviderFactory { - - override fun getLocationProvider(pageNode: RootPageNode) = MarkdownLocationProvider(pageNode, context) -} - -class MarkdownLocationProvider( - pageGraphRoot: RootPageNode, - dokkaContext: DokkaContext -) : DokkaLocationProvider(pageGraphRoot, dokkaContext, ".md") +}
\ No newline at end of file diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt index a205aa2f..b0eead1b 100644 --- a/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt +++ b/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt @@ -2,7 +2,7 @@ package renderers.gfm import org.jetbrains.dokka.DokkaSourceSetID import org.jetbrains.dokka.Platform -import org.jetbrains.dokka.gfm.CommonmarkRenderer +import org.jetbrains.dokka.gfm.renderer.CommonmarkRenderer import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.pages.ContentDivergentGroup import org.junit.jupiter.api.Test diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/GfmRenderingOnlyTestBase.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/GfmRenderingOnlyTestBase.kt index a118a20e..165aef98 100644 --- a/plugins/gfm/src/test/kotlin/renderers/gfm/GfmRenderingOnlyTestBase.kt +++ b/plugins/gfm/src/test/kotlin/renderers/gfm/GfmRenderingOnlyTestBase.kt @@ -2,7 +2,7 @@ package renderers.gfm import org.jetbrains.dokka.DokkaConfigurationImpl import org.jetbrains.dokka.gfm.GfmPlugin -import org.jetbrains.dokka.gfm.MarkdownLocationProviderFactory +import org.jetbrains.dokka.gfm.location.MarkdownLocationProviderFactory import org.jetbrains.dokka.testApi.context.MockContext import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.renderers.RootCreator diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt index 53bee558..93aee5e1 100644 --- a/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt +++ b/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt @@ -1,6 +1,6 @@ package renderers.gfm -import org.jetbrains.dokka.gfm.CommonmarkRenderer +import org.jetbrains.dokka.gfm.renderer.CommonmarkRenderer import org.jetbrains.dokka.pages.TextStyle import org.junit.jupiter.api.Test import renderers.* diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt index 9055fbc3..7b887071 100644 --- a/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt +++ b/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt @@ -1,6 +1,6 @@ package renderers.gfm -import org.jetbrains.dokka.gfm.CommonmarkRenderer +import org.jetbrains.dokka.gfm.renderer.CommonmarkRenderer import org.junit.jupiter.api.Test import renderers.testPage import org.jetbrains.dokka.links.DRI diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt index 0d845a98..4d05c602 100644 --- a/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt +++ b/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt @@ -2,7 +2,7 @@ package renderers.gfm import org.jetbrains.dokka.DokkaSourceSetID import org.jetbrains.dokka.Platform -import org.jetbrains.dokka.gfm.CommonmarkRenderer +import org.jetbrains.dokka.gfm.renderer.CommonmarkRenderer import org.jetbrains.dokka.pages.TextStyle import org.junit.jupiter.api.Test import renderers.testPage |