From c8a83153a88fe6f5b50b6f459295421f90a21583 Mon Sep 17 00:00:00 2001 From: Paweł Marks Date: Wed, 16 Sep 2020 16:36:54 +0200 Subject: Extracting dokka generation to the dedicated extension point --- plugins/all-module-page/build.gradle.kts | 9 ++ .../src/main/kotlin/AllModulesPageGeneration.kt | 31 +++++++ .../src/main/kotlin/AllModulesPagePlugin.kt | 25 ++++++ .../src/main/kotlin/MultimoduleLocationProvider.kt | 41 +++++++++ .../src/main/kotlin/MultimodulePageCreator.kt | 100 +++++++++++++++++++++ .../org.jetbrains.dokka.plugability.DokkaPlugin | 1 + plugins/base/src/main/kotlin/DokkaBase.kt | 7 -- .../kotlin/allModulePage/MultimodulePageCreator.kt | 100 --------------------- .../ModuleAndPackageDocumentation.kt | 2 +- .../ModuleAndPackageDocumentationFragment.kt | 2 +- .../ModuleAndPackageDocumentationParsingContext.kt | 4 +- .../ModuleAndPackageDocumentationSource.kt | 2 +- .../parseModuleAndPackageDocumentation.kt | 2 +- .../parseModuleAndPackageDocumentationFragments.kt | 4 +- .../resolvers/local/DokkaLocationProvider.kt | 4 +- 15 files changed, 217 insertions(+), 117 deletions(-) create mode 100644 plugins/all-module-page/build.gradle.kts create mode 100644 plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt create mode 100644 plugins/all-module-page/src/main/kotlin/AllModulesPagePlugin.kt create mode 100644 plugins/all-module-page/src/main/kotlin/MultimoduleLocationProvider.kt create mode 100644 plugins/all-module-page/src/main/kotlin/MultimodulePageCreator.kt create mode 100644 plugins/all-module-page/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin delete mode 100644 plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt (limited to 'plugins') diff --git a/plugins/all-module-page/build.gradle.kts b/plugins/all-module-page/build.gradle.kts new file mode 100644 index 00000000..dc5e0a6a --- /dev/null +++ b/plugins/all-module-page/build.gradle.kts @@ -0,0 +1,9 @@ +import org.jetbrains.registerDokkaArtifactPublication + +registerDokkaArtifactPublication("dokkaAllModulesPage") { + artifactId = "all-modules-page-plugin" +} + +dependencies { + implementation(project(":plugins:base")) +} \ No newline at end of file diff --git a/plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt b/plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt new file mode 100644 index 00000000..815cf160 --- /dev/null +++ b/plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt @@ -0,0 +1,31 @@ +package org.jetbrains.dokka.allModulesPage + +import org.jetbrains.dokka.CoreExtensions +import org.jetbrains.dokka.Timer +import org.jetbrains.dokka.generation.Generation +import org.jetbrains.dokka.pages.RootPageNode +import org.jetbrains.dokka.plugability.DokkaContext + +class AllModulesPageGeneration(private val context: DokkaContext) : Generation { + override fun Timer.generate() { + report("Creating all modules page") + val pages = createAllModulePage() + + report("Transforming pages") + val transformedPages = transformAllModulesPage(pages) + + report("Rendering") + render(transformedPages) + } + + override val generationName = "index page for project" + + fun createAllModulePage() = context.single(CoreExtensions.allModulePageCreator).invoke() + + fun transformAllModulesPage(pages: RootPageNode) = + context[CoreExtensions.allModulePageTransformer].fold(pages) { acc, t -> t(acc) } + + fun render(transformedPages: RootPageNode) { + context.single(CoreExtensions.renderer).render(transformedPages) + } +} \ No newline at end of file diff --git a/plugins/all-module-page/src/main/kotlin/AllModulesPagePlugin.kt b/plugins/all-module-page/src/main/kotlin/AllModulesPagePlugin.kt new file mode 100644 index 00000000..163f13ab --- /dev/null +++ b/plugins/all-module-page/src/main/kotlin/AllModulesPagePlugin.kt @@ -0,0 +1,25 @@ +package org.jetbrains.dokka.allModulesPage + +import org.jetbrains.dokka.CoreExtensions +import org.jetbrains.dokka.base.DokkaBase +import org.jetbrains.dokka.plugability.DokkaPlugin + +class AllModulesPagePlugin : DokkaPlugin() { + val allModulePageCreators by extending { + (CoreExtensions.allModulePageCreator + providing ::MultimodulePageCreator) + } + + val multimoduleLocationProvider by extending { + (plugin().locationProviderFactory + providing MultimoduleLocationProvider::Factory + override plugin().locationProvider + applyIf { modules.size > 1 }) + } + + val allModulesPageGeneration by extending { + (CoreExtensions.generation + providing ::AllModulesPageGeneration + override CoreExtensions.singleGeneration) + } +} \ No newline at end of file diff --git a/plugins/all-module-page/src/main/kotlin/MultimoduleLocationProvider.kt b/plugins/all-module-page/src/main/kotlin/MultimoduleLocationProvider.kt new file mode 100644 index 00000000..29107136 --- /dev/null +++ b/plugins/all-module-page/src/main/kotlin/MultimoduleLocationProvider.kt @@ -0,0 +1,41 @@ +package org.jetbrains.dokka.allModulesPage + +import org.jetbrains.dokka.base.resolvers.local.DokkaLocationProvider +import org.jetbrains.dokka.base.resolvers.local.DokkaLocationProvider.Companion.identifierToFilename +import org.jetbrains.dokka.base.resolvers.local.LocationProvider +import org.jetbrains.dokka.base.resolvers.local.LocationProviderFactory +import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.model.DisplaySourceSet +import org.jetbrains.dokka.pages.PageNode +import org.jetbrains.dokka.pages.RootPageNode +import org.jetbrains.dokka.plugability.DokkaContext + +class MultimoduleLocationProvider(private val root: RootPageNode, context: DokkaContext) : LocationProvider { + + private val defaultLocationProvider = DokkaLocationProvider(root, context) + + val paths = context.configuration.modules.map { + it.name to it.relativePathToOutputDirectory + }.toMap() + + override fun resolve(dri: DRI, sourceSets: Set, context: PageNode?) = + dri.takeIf { it.packageName == MULTIMODULE_PACKAGE_PLACEHOLDER }?.classNames?.let { paths[it] }?.let { + "$it/${identifierToFilename(dri.classNames.orEmpty())}/index.html" + } ?: defaultLocationProvider.resolve(dri, sourceSets, context) + + override fun resolve(node: PageNode, context: PageNode?, skipExtension: Boolean) = + defaultLocationProvider.resolve(node, context, skipExtension) + + override fun pathToRoot(from: PageNode): String = defaultLocationProvider.pathToRoot(from) + + override fun ancestors(node: PageNode): List = listOf(root) + + companion object { + const val MULTIMODULE_PACKAGE_PLACEHOLDER = ".ext" + } + + class Factory(private val context: DokkaContext): LocationProviderFactory { + override fun getLocationProvider(pageNode: RootPageNode) = + MultimoduleLocationProvider(pageNode, context) + } +} \ No newline at end of file diff --git a/plugins/all-module-page/src/main/kotlin/MultimodulePageCreator.kt b/plugins/all-module-page/src/main/kotlin/MultimodulePageCreator.kt new file mode 100644 index 00000000..3ad3e0ce --- /dev/null +++ b/plugins/all-module-page/src/main/kotlin/MultimodulePageCreator.kt @@ -0,0 +1,100 @@ +package org.jetbrains.dokka.allModulesPage + +import org.jetbrains.dokka.DokkaConfiguration.DokkaModuleDescription +import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet +import org.jetbrains.dokka.base.DokkaBase +import org.jetbrains.dokka.base.parsers.moduleAndPackage.ModuleAndPackageDocumentation.Classifier.Module +import org.jetbrains.dokka.base.parsers.moduleAndPackage.ModuleAndPackageDocumentationParsingContext +import org.jetbrains.dokka.base.parsers.moduleAndPackage.parseModuleAndPackageDocumentation +import org.jetbrains.dokka.base.parsers.moduleAndPackage.parseModuleAndPackageDocumentationFragments +import org.jetbrains.dokka.base.resolvers.anchors.SymbolAnchorHint +import org.jetbrains.dokka.base.resolvers.local.MultimoduleLocationProvider.Companion.MULTIMODULE_PACKAGE_PLACEHOLDER +import org.jetbrains.dokka.base.transformers.pages.comments.DocTagToContentConverter +import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder +import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.model.doc.DocTag +import org.jetbrains.dokka.model.doc.DocumentationNode +import org.jetbrains.dokka.model.doc.P +import org.jetbrains.dokka.model.properties.PropertyContainer +import org.jetbrains.dokka.pages.* +import org.jetbrains.dokka.plugability.DokkaContext +import org.jetbrains.dokka.plugability.querySingle +import org.jetbrains.dokka.transformers.pages.PageCreator +import org.jetbrains.dokka.utilities.DokkaLogger + +class MultimodulePageCreator( + private val context: DokkaContext, +) : PageCreator { + private val logger: DokkaLogger = context.logger + + override fun invoke(): RootPageNode { + val modules = context.configuration.modules + + val commentsConverter = context.plugin(DokkaBase::class)?.querySingle { commentsToContentConverter } + val signatureProvider = context.plugin(DokkaBase::class)?.querySingle { signatureProvider } + if (commentsConverter == null || signatureProvider == null) + throw IllegalStateException("Both comments converter and signature provider must not be null") + + val sourceSetData = emptySet() + val builder = PageContentBuilder(commentsConverter, signatureProvider, context.logger) + val contentNode = builder.contentFor( + dri = DRI(MULTIMODULE_PACKAGE_PLACEHOLDER), + kind = ContentKind.Cover, + sourceSets = sourceSetData + ) { + header(2, "All modules:") + table(styles = setOf(MultimoduleTable)) { + modules.map { module -> + val displayedModuleDocumentation = getDisplayedModuleDocumentation(module) + val dri = DRI(packageName = MULTIMODULE_PACKAGE_PLACEHOLDER, classNames = module.name) + val dci = DCI(setOf(dri), ContentKind.Comment) + val extraWithAnchor = PropertyContainer.withAll(SymbolAnchorHint(module.name, ContentKind.Main)) + val header = linkNode(module.name, dri, DCI(setOf(dri), ContentKind.Main), extra = extraWithAnchor) + val content = ContentGroup( + children = + if (displayedModuleDocumentation != null) + DocTagToContentConverter().buildContent(displayedModuleDocumentation, dci, emptySet()) + else emptyList(), + dci = dci, + sourceSets = emptySet(), + style = emptySet() + ) + ContentGroup(listOf(header, content), dci, emptySet(), emptySet(), extraWithAnchor) + } + } + } + return MultimoduleRootPageNode( + "Modules", + setOf(DRI(packageName = MULTIMODULE_PACKAGE_PLACEHOLDER, classNames = "allModules")), + contentNode + ) + } + + private fun getDisplayedModuleDocumentation(module: DokkaModuleDescription): P? { + val parsingContext = ModuleAndPackageDocumentationParsingContext(logger) + + val documentationFragment = module.includes + .flatMap { include -> parseModuleAndPackageDocumentationFragments(include) } + .firstOrNull { fragment -> fragment.classifier == Module && fragment.name == module.name } + ?: return null + + val moduleDocumentation = parseModuleAndPackageDocumentation(parsingContext, documentationFragment) + return moduleDocumentation.documentation.firstParagraph() + } + + private fun DocumentationNode.firstParagraph(): P? = + this.children + .map { it.root } + .mapNotNull { it.firstParagraph() } + .firstOrNull() + + /** + * @return The very first, most inner paragraph. If any [P] is wrapped inside another [P], the inner one + * is preferred. + */ + private fun DocTag.firstParagraph(): P? { + val firstChildParagraph = children.mapNotNull { it.firstParagraph() }.firstOrNull() + return if (firstChildParagraph == null && this is P) this + else firstChildParagraph + } +} diff --git a/plugins/all-module-page/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin b/plugins/all-module-page/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin new file mode 100644 index 00000000..3ac59dc6 --- /dev/null +++ b/plugins/all-module-page/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin @@ -0,0 +1 @@ +org.jetbrains.dokka.allModulesPage.AllModulesPagePlugin diff --git a/plugins/base/src/main/kotlin/DokkaBase.kt b/plugins/base/src/main/kotlin/DokkaBase.kt index e92759ff..de7e1e5e 100644 --- a/plugins/base/src/main/kotlin/DokkaBase.kt +++ b/plugins/base/src/main/kotlin/DokkaBase.kt @@ -4,7 +4,6 @@ package org.jetbrains.dokka.base import org.jetbrains.dokka.CoreExtensions import org.jetbrains.dokka.analysis.KotlinAnalysis -import org.jetbrains.dokka.base.allModulePage.MultimodulePageCreator import org.jetbrains.dokka.base.renderers.* import org.jetbrains.dokka.base.renderers.html.* import org.jetbrains.dokka.base.resolvers.external.ExternalLocationProviderFactory @@ -205,12 +204,6 @@ class DokkaBase : DokkaPlugin() { htmlPreprocessors providing ::SourcesetDependencyAppender order { after(rootCreator) } } - val allModulePageCreators by extending { - CoreExtensions.allModulePageCreator providing { - MultimodulePageCreator(it) - } - } - val baseSearchbarDataInstaller by extending { htmlPreprocessors providing ::SearchbarDataInstaller order { after(sourceLinksTransformer) } } diff --git a/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt b/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt deleted file mode 100644 index 3c4f1dea..00000000 --- a/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt +++ /dev/null @@ -1,100 +0,0 @@ -package org.jetbrains.dokka.base.allModulePage - -import org.jetbrains.dokka.DokkaConfiguration.DokkaModuleDescription -import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet -import org.jetbrains.dokka.base.DokkaBase -import org.jetbrains.dokka.base.parsers.moduleAndPackage.ModuleAndPackageDocumentation.Classifier.Module -import org.jetbrains.dokka.base.parsers.moduleAndPackage.ModuleAndPackageDocumentationParsingContext -import org.jetbrains.dokka.base.parsers.moduleAndPackage.parseModuleAndPackageDocumentation -import org.jetbrains.dokka.base.parsers.moduleAndPackage.parseModuleAndPackageDocumentationFragments -import org.jetbrains.dokka.base.resolvers.anchors.SymbolAnchorHint -import org.jetbrains.dokka.base.resolvers.local.MultimoduleLocationProvider.Companion.MULTIMODULE_PACKAGE_PLACEHOLDER -import org.jetbrains.dokka.base.transformers.pages.comments.DocTagToContentConverter -import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder -import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.model.doc.DocTag -import org.jetbrains.dokka.model.doc.DocumentationNode -import org.jetbrains.dokka.model.doc.P -import org.jetbrains.dokka.model.properties.PropertyContainer -import org.jetbrains.dokka.pages.* -import org.jetbrains.dokka.plugability.DokkaContext -import org.jetbrains.dokka.plugability.querySingle -import org.jetbrains.dokka.transformers.pages.PageCreator -import org.jetbrains.dokka.utilities.DokkaLogger - -class MultimodulePageCreator( - private val context: DokkaContext, -) : PageCreator { - private val logger: DokkaLogger = context.logger - - override fun invoke(): RootPageNode { - val modules = context.configuration.modules - - val commentsConverter = context.plugin(DokkaBase::class)?.querySingle { commentsToContentConverter } - val signatureProvider = context.plugin(DokkaBase::class)?.querySingle { signatureProvider } - if (commentsConverter == null || signatureProvider == null) - throw IllegalStateException("Both comments converter and signature provider must not be null") - - val sourceSetData = emptySet() - val builder = PageContentBuilder(commentsConverter, signatureProvider, context.logger) - val contentNode = builder.contentFor( - dri = DRI(MULTIMODULE_PACKAGE_PLACEHOLDER), - kind = ContentKind.Cover, - sourceSets = sourceSetData - ) { - header(2, "All modules:") - table(styles = setOf(MultimoduleTable)) { - modules.map { module -> - val displayedModuleDocumentation = getDisplayedModuleDocumentation(module) - val dri = DRI(packageName = MULTIMODULE_PACKAGE_PLACEHOLDER, classNames = module.name) - val dci = DCI(setOf(dri), ContentKind.Comment) - val extraWithAnchor = PropertyContainer.withAll(SymbolAnchorHint(module.name, ContentKind.Main)) - val header = linkNode(module.name, dri, DCI(setOf(dri), ContentKind.Main), extra = extraWithAnchor) - val content = ContentGroup( - children = - if (displayedModuleDocumentation != null) - DocTagToContentConverter().buildContent(displayedModuleDocumentation, dci, emptySet()) - else emptyList(), - dci = dci, - sourceSets = emptySet(), - style = emptySet() - ) - ContentGroup(listOf(header, content), dci, emptySet(), emptySet(), extraWithAnchor) - } - } - } - return MultimoduleRootPageNode( - "Modules", - setOf(DRI(packageName = MULTIMODULE_PACKAGE_PLACEHOLDER, classNames = "allModules")), - contentNode - ) - } - - private fun getDisplayedModuleDocumentation(module: DokkaModuleDescription): P? { - val parsingContext = ModuleAndPackageDocumentationParsingContext(logger) - - val documentationFragment = module.includes - .flatMap { include -> parseModuleAndPackageDocumentationFragments(include) } - .firstOrNull { fragment -> fragment.classifier == Module && fragment.name == module.name } - ?: return null - - val moduleDocumentation = parseModuleAndPackageDocumentation(parsingContext, documentationFragment) - return moduleDocumentation.documentation.firstParagraph() - } - - private fun DocumentationNode.firstParagraph(): P? = - this.children - .map { it.root } - .mapNotNull { it.firstParagraph() } - .firstOrNull() - - /** - * @return The very first, most inner paragraph. If any [P] is wrapped inside another [P], the inner one - * is preferred. - */ - private fun DocTag.firstParagraph(): P? { - val firstChildParagraph = children.mapNotNull { it.firstParagraph() }.firstOrNull() - return if (firstChildParagraph == null && this is P) this - else firstChildParagraph - } -} diff --git a/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentation.kt b/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentation.kt index 5139c872..ee67fad1 100644 --- a/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentation.kt +++ b/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentation.kt @@ -2,7 +2,7 @@ package org.jetbrains.dokka.base.parsers.moduleAndPackage import org.jetbrains.dokka.model.doc.DocumentationNode -internal data class ModuleAndPackageDocumentation( +data class ModuleAndPackageDocumentation( val name: String, val classifier: Classifier, val documentation: DocumentationNode diff --git a/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentationFragment.kt b/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentationFragment.kt index fa99a8e2..06fef72c 100644 --- a/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentationFragment.kt +++ b/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentationFragment.kt @@ -2,7 +2,7 @@ package org.jetbrains.dokka.base.parsers.moduleAndPackage import org.jetbrains.dokka.base.parsers.moduleAndPackage.ModuleAndPackageDocumentation.* -internal data class ModuleAndPackageDocumentationFragment( +data class ModuleAndPackageDocumentationFragment( val name: String, val classifier: Classifier, val documentation: String, diff --git a/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentationParsingContext.kt b/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentationParsingContext.kt index 64441447..afdcc43f 100644 --- a/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentationParsingContext.kt +++ b/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentationParsingContext.kt @@ -17,7 +17,7 @@ import org.jetbrains.kotlin.idea.kdoc.resolveKDocLink import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -internal fun interface ModuleAndPackageDocumentationParsingContext { +fun interface ModuleAndPackageDocumentationParsingContext { fun markdownParserFor(fragment: ModuleAndPackageDocumentationFragment): MarkdownParser } @@ -27,7 +27,7 @@ internal fun ModuleAndPackageDocumentationParsingContext.parse( return markdownParserFor(fragment).parse(fragment.documentation) } -internal fun ModuleAndPackageDocumentationParsingContext( +fun ModuleAndPackageDocumentationParsingContext( logger: DokkaLogger, facade: DokkaResolutionFacade? = null ) = ModuleAndPackageDocumentationParsingContext { fragment -> diff --git a/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentationSource.kt b/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentationSource.kt index 90dc9ca8..9514adb4 100644 --- a/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentationSource.kt +++ b/plugins/base/src/main/kotlin/parsers/moduleAndPackage/ModuleAndPackageDocumentationSource.kt @@ -2,7 +2,7 @@ package org.jetbrains.dokka.base.parsers.moduleAndPackage import java.io.File -internal abstract class ModuleAndPackageDocumentationSource { +abstract class ModuleAndPackageDocumentationSource { abstract val sourceDescription: String abstract val documentation: String override fun toString(): String = sourceDescription diff --git a/plugins/base/src/main/kotlin/parsers/moduleAndPackage/parseModuleAndPackageDocumentation.kt b/plugins/base/src/main/kotlin/parsers/moduleAndPackage/parseModuleAndPackageDocumentation.kt index a2876308..5ef9d7ef 100644 --- a/plugins/base/src/main/kotlin/parsers/moduleAndPackage/parseModuleAndPackageDocumentation.kt +++ b/plugins/base/src/main/kotlin/parsers/moduleAndPackage/parseModuleAndPackageDocumentation.kt @@ -2,7 +2,7 @@ package org.jetbrains.dokka.base.parsers.moduleAndPackage -internal fun parseModuleAndPackageDocumentation( +fun parseModuleAndPackageDocumentation( context: ModuleAndPackageDocumentationParsingContext, fragment: ModuleAndPackageDocumentationFragment ): ModuleAndPackageDocumentation { diff --git a/plugins/base/src/main/kotlin/parsers/moduleAndPackage/parseModuleAndPackageDocumentationFragments.kt b/plugins/base/src/main/kotlin/parsers/moduleAndPackage/parseModuleAndPackageDocumentationFragments.kt index 7dcaccfa..d193ec0a 100644 --- a/plugins/base/src/main/kotlin/parsers/moduleAndPackage/parseModuleAndPackageDocumentationFragments.kt +++ b/plugins/base/src/main/kotlin/parsers/moduleAndPackage/parseModuleAndPackageDocumentationFragments.kt @@ -4,11 +4,11 @@ import org.jetbrains.dokka.base.parsers.moduleAndPackage.ModuleAndPackageDocumen import java.io.File -internal fun parseModuleAndPackageDocumentationFragments(source: File): List { +fun parseModuleAndPackageDocumentationFragments(source: File): List { return parseModuleAndPackageDocumentationFragments(ModuleAndPackageDocumentationFile(source)) } -internal fun parseModuleAndPackageDocumentationFragments( +fun parseModuleAndPackageDocumentationFragments( source: ModuleAndPackageDocumentationSource ): List { val fragmentStrings = source.documentation.split(Regex("(|^)#\\s*(?=(Module|Package))")) diff --git a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt index 3ef8bcce..030197a5 100644 --- a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt @@ -129,12 +129,12 @@ open class DokkaLocationProvider( protected data class PageWithKind(val page: ContentPage, val kind: Kind) companion object { - internal val reservedFilenames = setOf("index", "con", "aux", "lst", "prn", "nul", "eof", "inp", "out") + val reservedFilenames = setOf("index", "con", "aux", "lst", "prn", "nul", "eof", "inp", "out") //Taken from: https://stackoverflow.com/questions/1976007/what-characters-are-forbidden-in-windows-and-linux-directory-names internal val reservedCharacters = setOf('|', '>', '<', '*', ':', '"', '?', '%') - internal fun identifierToFilename(name: String): String { + fun identifierToFilename(name: String): String { if (name.isEmpty()) return "--root--" return sanitizeFileName(name, reservedFilenames, reservedCharacters) } -- cgit