diff options
author | Andrzej Ratajczak <andrzej.ratajczak98@gmail.com> | 2020-03-13 10:46:33 +0100 |
---|---|---|
committer | Błażej Kardyś <bkardys@virtuslab.com> | 2020-03-23 13:57:07 +0100 |
commit | c09bde34ff729ef9b1f3bea602fb53cd4e6dca42 (patch) | |
tree | 3a744a16c133b813ab1849761aef1ec3544f401f /plugins/base/src/main/kotlin/transformers | |
parent | cedf8b7594deef2cd26e981865daa8aae0155520 (diff) | |
download | dokka-c09bde34ff729ef9b1f3bea602fb53cd4e6dca42.tar.gz dokka-c09bde34ff729ef9b1f3bea602fb53cd4e6dca42.tar.bz2 dokka-c09bde34ff729ef9b1f3bea602fb53cd4e6dca42.zip |
Gradle Task supporting multimodular projects
Diffstat (limited to 'plugins/base/src/main/kotlin/transformers')
3 files changed, 11 insertions, 9 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt index bb7dbaaf..48be8ae7 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt @@ -12,17 +12,17 @@ import org.jetbrains.dokka.transformers.documentation.DocumentableMerger import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult internal object DefaultDocumentableMerger : DocumentableMerger { + override fun invoke(modules: Collection<DModule>, context: DokkaContext): DModule { - val name = modules.map { it.name }.distinct().singleOrNull() ?: run { - context.logger.error("All module names need to be the same") - modules.first().name - } + + val projectName = + modules.fold(modules.first().name) { acc, module -> acc.commonPrefixWith(module.name) }.takeIf { it.isNotEmpty() } + ?: "project" return modules.reduce { left, right -> val list = listOf(left, right) - DModule( - name = name, + name = projectName, packages = merge( list.flatMap { it.packages }, DPackage::mergeWith diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilter.kt b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilter.kt index 150df302..9f86c82a 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilter.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilter.kt @@ -15,6 +15,7 @@ internal object DocumentableVisibilityFilter : PreMergeDocumentableTransformer { val packageOptions = context.configuration.passesConfigurations.first { original.platformData.contains(it.platformData) } .perPackageOptions + DocumentableFilter(packageOptions).processModule(original) } diff --git a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt index 885fbfee..2eb63504 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt +++ b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt @@ -30,14 +30,15 @@ object DocTagToContentConverter : CommentsToContentConverter { ) ) - fun buildList(ordered: Boolean) = + fun buildList(ordered: Boolean, start: Int = 1) = listOf( ContentList( buildChildren(docTag), ordered, dci, platforms, - styles + styles, + ((PropertyContainer.empty<ContentNode>()) + SimpleAttr("start", start.toString())) ) ) @@ -53,7 +54,7 @@ object DocTagToContentConverter : CommentsToContentConverter { is H5 -> buildHeader(5) is H6 -> buildHeader(6) is Ul -> buildList(false) - is Ol -> buildList(true) + is Ol -> buildList(true, docTag.params["start"]?.toInt() ?: 1) is Li -> buildChildren(docTag) is Br -> buildNewLine() is B -> buildChildren(docTag, setOf(TextStyle.Strong)) |