diff options
author | Paweł Marks <pmarks@virtuslab.com> | 2020-02-17 11:27:37 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-02-18 13:28:23 +0100 |
commit | ba769f0695aaa9719b62ca32028fd3d24442f5ec (patch) | |
tree | 5f7ed51c2eaae6988648d5132ff8d5aa258c5bc5 /core/src/main/kotlin/pages | |
parent | 2bfb7733dfef8da0271a01a7275ea42ecb69d93a (diff) | |
download | dokka-ba769f0695aaa9719b62ca32028fd3d24442f5ec.tar.gz dokka-ba769f0695aaa9719b62ca32028fd3d24442f5ec.tar.bz2 dokka-ba769f0695aaa9719b62ca32028fd3d24442f5ec.zip |
Moves comments to content conversion to base plugin
Diffstat (limited to 'core/src/main/kotlin/pages')
-rw-r--r-- | core/src/main/kotlin/pages/CommentsToContentConverter.kt | 13 | ||||
-rw-r--r-- | core/src/main/kotlin/pages/DocTagToContentConverter.kt | 97 |
2 files changed, 0 insertions, 110 deletions
diff --git a/core/src/main/kotlin/pages/CommentsToContentConverter.kt b/core/src/main/kotlin/pages/CommentsToContentConverter.kt deleted file mode 100644 index 78c7ff4c..00000000 --- a/core/src/main/kotlin/pages/CommentsToContentConverter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.jetbrains.dokka.pages - -import org.jetbrains.dokka.model.doc.DocTag - -interface CommentsToContentConverter { - fun buildContent( - docTag: DocTag, - dci: DCI, - platforms: Set<PlatformData>, - styles: Set<Style> = emptySet(), - extras: Set<Extra> = emptySet() - ): List<ContentNode> -} diff --git a/core/src/main/kotlin/pages/DocTagToContentConverter.kt b/core/src/main/kotlin/pages/DocTagToContentConverter.kt deleted file mode 100644 index 08a579a8..00000000 --- a/core/src/main/kotlin/pages/DocTagToContentConverter.kt +++ /dev/null @@ -1,97 +0,0 @@ -package org.jetbrains.dokka.pages - -import org.jetbrains.dokka.model.doc.* -import org.jetbrains.dokka.plugability.DokkaContext - -class DocTagToContentConverter( - private val context: DokkaContext -) : CommentsToContentConverter { - override fun buildContent( - docTag: DocTag, - dci: DCI, - platforms: Set<PlatformData>, - styles: Set<Style>, - extras: Set<Extra> - - ): List<ContentNode> { - - fun buildChildren(docTag: DocTag, newStyles: Set<Style> = emptySet(), newExtras: Set<Extra> = emptySet()) = - docTag.children.flatMap { - buildContent(it, dci, platforms, styles + newStyles, extras + newExtras) - } - - fun buildHeader(level: Int) = - listOf(ContentHeader(buildChildren(docTag), level, dci, platforms, styles, extras)) - - fun buildList(ordered: Boolean) = - listOf(ContentList(buildChildren(docTag), ordered, dci, platforms, styles, extras)) - - return when (docTag) { - is H1 -> buildHeader(1) - is H2 -> buildHeader(2) - is H3 -> buildHeader(3) - is H4 -> buildHeader(4) - is H5 -> buildHeader(5) - is H6 -> buildHeader(6) - is Ul -> buildList(false) - is Ol -> buildList(true) - is Li -> buildChildren(docTag) - is B -> buildChildren(docTag, setOf(TextStyle.Strong)) - is I -> buildChildren(docTag, setOf(TextStyle.Italic)) - is P -> buildChildren(docTag, newStyles = setOf(TextStyle.Paragraph)) - is A -> listOf( - ContentResolvedLink( - buildChildren(docTag), - docTag.params.get("href")!!, - dci, - platforms, - styles, - extras - ) - ) - is DocumentationLink -> listOf( - ContentDRILink( - buildChildren(docTag), - docTag.dri, - DCI(setOf(docTag.dri), ContentKind.Symbol), - platforms, - styles, - extras - ) - ) - is BlockQuote -> listOf( - ContentCode( - buildChildren(docTag), - "", - dci, - platforms, - styles, - extras - ) - ) - is Code -> listOf( - ContentCode( - buildChildren(docTag), - "", - dci, - platforms, - styles, - extras - ) - ) - is Img -> listOf( - ContentEmbeddedResource( - address = docTag.params.get("href")!!, - altText = docTag.params.get("alt"), - dci = dci, - platforms = platforms, - style = styles, - extras = extras - ) - ) - is HorizontalRule -> listOf(ContentText("", dci, platforms, setOf())) - is Text -> listOf(ContentText(docTag.body, dci, platforms, styles, extras)) - else -> buildChildren(docTag) - } - } -} |