diff options
author | KrystianUjma <kujma@virtuslab.com> | 2019-04-18 14:46:01 +0200 |
---|---|---|
committer | KrystianUjma <kujma@virtuslab.com> | 2019-04-18 14:46:01 +0200 |
commit | b11052baa306585f0dc41427444be986574dc644 (patch) | |
tree | 19668bd30fc5826a23d14737a8582d9ade70d808 /core | |
parent | 7c187836602392972bbcd48c8836e5a4a603e0fc (diff) | |
download | dokka-b11052baa306585f0dc41427444be986574dc644.tar.gz dokka-b11052baa306585f0dc41427444be986574dc644.tar.bz2 dokka-b11052baa306585f0dc41427444be986574dc644.zip |
remove kotlin-website
Diffstat (limited to 'core')
6 files changed, 0 insertions, 371 deletions
diff --git a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt b/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt deleted file mode 100644 index 51ceb47e..00000000 --- a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt +++ /dev/null @@ -1,224 +0,0 @@ -package org.jetbrains.dokka - -import com.google.inject.Inject -import com.google.inject.name.Named -import org.jetbrains.dokka.Utilities.impliedPlatformsName -import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty - - -open class KotlinWebsiteOutputBuilder( - to: StringBuilder, - location: Location, - generator: NodeLocationAwareGenerator, - languageService: LanguageService, - extension: String, - impliedPlatforms: List<String> -) : JekyllOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) { - private var needHardLineBreaks = false - private var insideDiv = 0 - - override fun appendFrontMatter(nodes: Iterable<DocumentationNode>, to: StringBuilder) { - super.appendFrontMatter(nodes, to) - to.appendln("layout: api") - } - - override fun appendBreadcrumbs(path: Iterable<FormatLink>) { - if (path.count() > 1) { - to.append("<div class='api-docs-breadcrumbs'>") - super.appendBreadcrumbs(path) - to.append("</div>") - } - } - - override fun appendCode(body: () -> Unit) = wrapIfNotEmpty("<code>", "</code>", body) - - override fun appendStrikethrough(body: () -> Unit) = wrapInTag("s", body) - - protected fun div(to: StringBuilder, cssClass: String, otherAttributes: String = "", markdown: Boolean = false, block: () -> Unit) { - to.append("<div class=\"$cssClass\"$otherAttributes") - if (markdown) to.append(" markdown=\"1\"") - to.append(">") - if (!markdown) insideDiv++ - block() - if (!markdown) insideDiv-- - to.append("</div>\n") - } - - override fun appendAsSignature(node: ContentNode, block: () -> Unit) { - val contentLength = node.textLength - if (contentLength == 0) return - div(to, "signature") { - needHardLineBreaks = contentLength >= 62 - try { - block() - } finally { - needHardLineBreaks = false - } - } - } - - override fun appendAsOverloadGroup(to: StringBuilder, platforms: PlatformsData, block: () -> Unit) { - div(to, "overload-group", calculateDataAttributes(platforms.keys), true) { - ensureParagraph() - block() - ensureParagraph() - } - } - - override fun appendLink(href: String, body: () -> Unit) = wrap("<a href=\"$href\">", "</a>", body) - - override fun appendHeader(level: Int, body: () -> Unit) { - if (insideDiv > 0) { - wrapInTag("p", body, newlineAfterClose = true) - } else { - super.appendHeader(level, body) - } - } - - override fun appendLine() { - if (insideDiv > 0) { - to.appendln("<br/>") - } else { - super.appendLine() - } - } - - override fun appendTable(vararg columns: String, body: () -> Unit) { - to.appendln("<table class=\"api-docs-table\">") - body() - to.appendln("</table>") - } - - override fun appendTableBody(body: () -> Unit) { - to.appendln("<tbody>") - body() - to.appendln("</tbody>") - } - - override fun appendTableRow(body: () -> Unit) { - to.appendln("<tr>") - body() - to.appendln("</tr>") - } - - override fun appendTableCell(body: () -> Unit) { - to.appendln("<td markdown=\"1\">") - body() - to.appendln("\n</td>") - } - - override fun appendBlockCode(language: String, body: () -> Unit) { - if (language.isNotEmpty()) { - super.appendBlockCode(language, body) - } else { - wrap("<pre markdown=\"1\">", "</pre>", body) - } - } - - override fun appendSymbol(text: String) { - to.append("<span class=\"symbol\">${text.htmlEscape()}</span>") - } - - override fun appendKeyword(text: String) { - to.append("<span class=\"keyword\">${text.htmlEscape()}</span>") - } - - override fun appendIdentifier(text: String, kind: IdentifierKind, signature: String?) { - val id = signature?.let { " id=\"$it\"" }.orEmpty() - to.append("<span class=\"${identifierClassName(kind)}\"$id>${text.htmlEscape()}</span>") - } - - override fun appendSoftLineBreak() { - if (needHardLineBreaks) - to.append("<br/>") - - } - - override fun appendIndentedSoftLineBreak() { - if (needHardLineBreaks) { - to.append("<br/> ") - } - } - - private fun identifierClassName(kind: IdentifierKind) = when (kind) { - IdentifierKind.ParameterName -> "parameterName" - IdentifierKind.SummarizedTypeName -> "summarizedTypeName" - else -> "identifier" - } - - fun calculateDataAttributes(platforms: Set<String>): String { - fun String.isKotlinVersion() = this.startsWith("Kotlin") - fun String.isJREVersion() = this.startsWith("JRE") - val kotlinVersion = platforms.singleOrNull(String::isKotlinVersion) - val jreVersion = platforms.singleOrNull(String::isJREVersion) - val targetPlatforms = platforms.filterNot { it.isKotlinVersion() || it.isJREVersion() } - - val kotlinVersionAttr = kotlinVersion?.let { " data-kotlin-version=\"$it\"" } ?: "" - val jreVersionAttr = jreVersion?.let { " data-jre-version=\"$it\"" } ?: "" - val platformsAttr = targetPlatforms.ifNotEmpty { " data-platform=\"${targetPlatforms.joinToString()}\"" } ?: "" - return "$platformsAttr$kotlinVersionAttr$jreVersionAttr" - } - - override fun appendIndexRow(platforms: PlatformsData, block: () -> Unit) { - if (platforms.isNotEmpty()) - wrap("<tr${calculateDataAttributes(platforms.keys)}>", "</tr>", block) - else - appendTableRow(block) - } - - override fun appendPlatforms(platforms: PlatformsData) { - - } -} - -class KotlinWebsiteFormatService @Inject constructor( - generator: NodeLocationAwareGenerator, - signatureGenerator: LanguageService, - @Named(impliedPlatformsName) impliedPlatforms: List<String>, - logger: DokkaLogger -) : JekyllFormatService(generator, signatureGenerator, "html", impliedPlatforms) { - init { - logger.warn("Format kotlin-website deprecated and will be removed in next release") - } - - override fun createOutputBuilder(to: StringBuilder, location: Location) = - KotlinWebsiteOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) -} - - -class KotlinWebsiteRunnableSamplesOutputBuilder( - to: StringBuilder, - location: Location, - generator: NodeLocationAwareGenerator, - languageService: LanguageService, - extension: String, - impliedPlatforms: List<String> -) : KotlinWebsiteOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) { - - override fun appendSampleBlockCode(language: String, imports: () -> Unit, body: () -> Unit) { - div(to, "sample", markdown = true) { - appendBlockCode(language) { - imports() - wrap("\n\nfun main(args: Array<String>) {", "}") { - wrap("\n//sampleStart\n", "\n//sampleEnd\n", body) - } - } - } - } -} - -class KotlinWebsiteRunnableSamplesFormatService @Inject constructor( - generator: NodeLocationAwareGenerator, - signatureGenerator: LanguageService, - @Named(impliedPlatformsName) impliedPlatforms: List<String>, - logger: DokkaLogger -) : JekyllFormatService(generator, signatureGenerator, "html", impliedPlatforms) { - - init { - logger.warn("Format kotlin-website-samples deprecated and will be removed in next release") - } - - override fun createOutputBuilder(to: StringBuilder, location: Location) = - KotlinWebsiteRunnableSamplesOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) -} - diff --git a/core/src/main/kotlin/Formats/StandardFormats.kt b/core/src/main/kotlin/Formats/StandardFormats.kt index dd67ac97..86f70a37 100644 --- a/core/src/main/kotlin/Formats/StandardFormats.kt +++ b/core/src/main/kotlin/Formats/StandardFormats.kt @@ -31,17 +31,6 @@ class HtmlFormatDescriptor : HtmlFormatDescriptorBase(), DefaultAnalysisComponen class HtmlAsJavaFormatDescriptor : HtmlFormatDescriptorBase(), DefaultAnalysisComponentServices by KotlinAsJava -class KotlinWebsiteFormatDescriptor : KotlinFormatDescriptorBase() { - override val formatServiceClass = KotlinWebsiteFormatService::class - override val outlineServiceClass = YamlOutlineService::class -} - -class KotlinWebsiteFormatRunnableSamplesDescriptor : KotlinFormatDescriptorBase() { - override val formatServiceClass = KotlinWebsiteRunnableSamplesFormatService::class - override val sampleProcessingService = KotlinWebsiteSampleProcessingService::class - override val outlineServiceClass = YamlOutlineService::class -} - class KotlinWebsiteHtmlFormatDescriptor : KotlinFormatDescriptorBase() { override val formatServiceClass = KotlinWebsiteHtmlFormatService::class override val sampleProcessingService = KotlinWebsiteSampleProcessingService::class diff --git a/core/src/main/resources/dokka/format/kotlin-website-samples.properties b/core/src/main/resources/dokka/format/kotlin-website-samples.properties deleted file mode 100644 index bda616a4..00000000 --- a/core/src/main/resources/dokka/format/kotlin-website-samples.properties +++ /dev/null @@ -1,2 +0,0 @@ -class=org.jetbrains.dokka.Formats.KotlinWebsiteFormatRunnableSamplesDescriptor -description=Generates Kotlin website documentation
\ No newline at end of file diff --git a/core/src/main/resources/dokka/format/kotlin-website.properties b/core/src/main/resources/dokka/format/kotlin-website.properties deleted file mode 100644 index c13e7675..00000000 --- a/core/src/main/resources/dokka/format/kotlin-website.properties +++ /dev/null @@ -1,2 +0,0 @@ -class=org.jetbrains.dokka.Formats.KotlinWebsiteFormatDescriptor -description=Generates Kotlin website documentation
\ No newline at end of file diff --git a/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt b/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt deleted file mode 100644 index 4f292e37..00000000 --- a/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt +++ /dev/null @@ -1,93 +0,0 @@ -package org.jetbrains.dokka.tests - -import org.jetbrains.dokka.* -import org.junit.Ignore -import org.junit.Test - -@Ignore -class KotlinWebSiteFormatTest: FileGeneratorTestCase() { - override val formatService = KotlinWebsiteFormatService(fileGenerator, KotlinLanguageService(), listOf(), DokkaConsoleLogger) - - @Test fun sample() { - verifyKWSNodeByName("sample", "foo") - } - - @Test fun returnTag() { - verifyKWSNodeByName("returnTag", "indexOf") - } - - @Test fun overloadGroup() { - verifyKWSNodeByName("overloadGroup", "magic") - } - - @Test fun dataTags() { - val module = buildMultiplePlatforms("dataTags") - verifyMultiplatformPackage(module, "dataTags") - } - - @Test fun dataTagsInGroupNode() { - val path = "dataTagsInGroupNode" - val module = buildMultiplePlatforms(path) - verifyModelOutput(module, ".md", "testdata/format/website/$path/multiplatform.kt") { model, output -> - buildPagesAndReadInto( - listOfNotNull(model.members.single().members.find { it.kind == NodeKind.GroupNode }), - output - ) - } - verifyMultiplatformPackage(module, path) - } - - private fun verifyKWSNodeByName(fileName: String, name: String) { - verifyOutput("testdata/format/website/$fileName.kt", ".md", ModelConfig(format = "kotlin-website")) { model, output -> - buildPagesAndReadInto( - model.members.single().members.filter { it.name == name }, - output - ) - } - } - - private fun buildMultiplePlatforms(path: String): DocumentationModule { - val module = DocumentationModule("test") - val passConfiguration = PassConfigurationImpl(noStdlibLink = true, - noJdkLink = true, - languageVersion = null, - apiVersion = null - ) - val configuration = DokkaConfigurationImpl( - outputDir = "", - format = "html", - generateIndexPages = false, - passesConfigurations = listOf(passConfiguration) - ) - - appendDocumentation( - module, configuration, passConfiguration, ModelConfig( - roots = arrayOf(contentRootFromPath("testdata/format/website/$path/jvm.kt")), - defaultPlatforms = listOf("JVM") - ) - - ) - - - appendDocumentation( - module, configuration, passConfiguration, ModelConfig( - roots = arrayOf(contentRootFromPath("testdata/format/website/$path/jre7.kt")), - defaultPlatforms = listOf("JVM", "JRE7") - ) - ) - appendDocumentation( - module, configuration, passConfiguration, ModelConfig( - roots = arrayOf(contentRootFromPath("testdata/format/website/$path/js.kt")), - defaultPlatforms = listOf("JS") - ) - ) - return module - } - - private fun verifyMultiplatformPackage(module: DocumentationModule, path: String) { - verifyModelOutput(module, ".package.md", "testdata/format/website/$path/multiplatform.kt") { model, output -> - buildPagesAndReadInto(model.members, output) - } - } - -} diff --git a/core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt b/core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt deleted file mode 100644 index 453b1de8..00000000 --- a/core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt +++ /dev/null @@ -1,39 +0,0 @@ -package org.jetbrains.dokka.tests - -import org.jetbrains.dokka.DokkaConsoleLogger -import org.jetbrains.dokka.KotlinLanguageService -import org.jetbrains.dokka.KotlinWebsiteRunnableSamplesFormatService -import org.junit.Ignore -import org.junit.Test - -@Ignore -class KotlinWebSiteRunnableSamplesFormatTest { -// private val kwsService = KotlinWebsiteRunnableSamplesFormatService(InMemoryLocationService, KotlinLanguageService(), listOf(), DokkaConsoleLogger) -// -// -// @Test fun dropImport() { -// verifyKWSNodeByName("dropImport", "foo") -// } -// -// @Test fun sample() { -// verifyKWSNodeByName("sample", "foo") -// } -// -// @Test fun sampleWithAsserts() { -// verifyKWSNodeByName("sampleWithAsserts", "a") -// } -// -// @Test fun newLinesInSamples() { -// verifyKWSNodeByName("newLinesInSamples", "foo") -// } -// -// @Test fun newLinesInImportList() { -// verifyKWSNodeByName("newLinesInImportList", "foo") -// } -// -// private fun verifyKWSNodeByName(fileName: String, name: String) { -// verifyOutput("testdata/format/website-samples/$fileName.kt", ".md", format = "kotlin-website-samples") { model, output -> -// kwsService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members.filter { it.name == name }) -// } -// } -} |