aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt2
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt5
-rw-r--r--plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt3
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt4
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt1
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/GfmRenderingOnlyTestBase.kt4
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt1
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt70
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt1
9 files changed, 80 insertions, 11 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt b/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt
index 42422934..9a11c126 100644
--- a/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt
@@ -62,7 +62,7 @@ class SourceLinksTransformer(val context: DokkaContext, val builder: PageContent
emptyList(),
sources.map {
buildGroup(node.dri, setOf(it.first), kind = ContentKind.Source) {
- +link("(source)", it.second)
+ link("(source)", it.second)
}
},
DCI(node.dri, ContentKind.Source),
diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
index 58b384e2..94aa2c5a 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
@@ -244,8 +244,8 @@ open class PageContentBuilder(
sourceSets: Set<DokkaSourceSet> = mainSourcesetData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
- ) =
- ContentResolvedLink(
+ ) {
+ contents += ContentResolvedLink(
children = listOf(createText(text, kind, sourceSets, styles, extra)),
address = address,
extra = PropertyContainer.empty(),
@@ -253,6 +253,7 @@ open class PageContentBuilder(
sourceSets = sourceSets,
style = emptySet()
)
+ }
fun link(
address: DRI,
diff --git a/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt b/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt
index 8e58bbcd..b5523d50 100644
--- a/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt
+++ b/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt
@@ -12,8 +12,9 @@ import org.jetbrains.dokka.testApi.context.MockContext
import org.jetbrains.dokka.utilities.DokkaConsoleLogger
import renderers.html.EmptyCommentConverter
-abstract class RenderingOnlyTestBase {
+abstract class RenderingOnlyTestBase<T> {
abstract val context: MockContext
+ abstract val renderedContent: T
}
class TestPage(callback: PageContentBuilder.DocumentableContentBuilder.() -> Unit) : RootPageNode(), ContentPage {
diff --git a/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt b/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt
index 69025947..4f51a97d 100644
--- a/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt
@@ -19,7 +19,7 @@ import org.jsoup.nodes.TextNode
import renderers.RenderingOnlyTestBase
import utils.TestOutputWriter
-abstract class HtmlRenderingOnlyTestBase : RenderingOnlyTestBase() {
+abstract class HtmlRenderingOnlyTestBase : RenderingOnlyTestBase<Element>() {
val files = TestOutputWriter()
override val context = MockContext(
@@ -33,7 +33,7 @@ abstract class HtmlRenderingOnlyTestBase : RenderingOnlyTestBase() {
)
)
- protected val renderedContent: Element by lazy {
+ override val renderedContent: Element by lazy {
files.contents.getValue("test-page.html").let { Jsoup.parse(it) }.select("#content").single()
}
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt
index 13231c43..64750ec6 100644
--- a/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt
@@ -6,7 +6,6 @@ import org.jetbrains.dokka.gfm.CommonmarkRenderer
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.pages.ContentDivergentGroup
import org.junit.jupiter.api.Test
-import renderers.gfm.GfmRenderingOnlyTestBase
import renderers.defaultSourceSet
import renderers.TestPage
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/GfmRenderingOnlyTestBase.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/GfmRenderingOnlyTestBase.kt
index 3636bf26..64e55f4f 100644
--- a/plugins/gfm/src/test/kotlin/renderers/gfm/GfmRenderingOnlyTestBase.kt
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/GfmRenderingOnlyTestBase.kt
@@ -11,7 +11,7 @@ import org.jetbrains.dokka.base.resolvers.external.JavadocExternalLocationProvid
import renderers.RenderingOnlyTestBase
import utils.TestOutputWriter
-abstract class GfmRenderingOnlyTestBase : RenderingOnlyTestBase() {
+abstract class GfmRenderingOnlyTestBase : RenderingOnlyTestBase<String>() {
val files = TestOutputWriter()
override val context = MockContext(
@@ -26,7 +26,7 @@ abstract class GfmRenderingOnlyTestBase : RenderingOnlyTestBase() {
)
)
- protected val renderedContent: String by lazy {
+ override val renderedContent: String by lazy {
files.contents.getValue("test-page.md")
}
} \ No newline at end of file
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt
index 2e1dc83a..42839282 100644
--- a/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt
@@ -1,7 +1,6 @@
package renderers.gfm
import org.jetbrains.dokka.gfm.CommonmarkRenderer
-import renderers.gfm.GfmRenderingOnlyTestBase
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
new file mode 100644
index 00000000..7464c079
--- /dev/null
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt
@@ -0,0 +1,70 @@
+package renderers.gfm
+
+import org.jetbrains.dokka.gfm.CommonmarkRenderer
+import org.junit.jupiter.api.Test
+import renderers.TestPage
+import org.jetbrains.dokka.base.translators.documentables.*
+import org.jetbrains.dokka.pages.TextStyle
+
+class SimpleElementsTest : GfmRenderingOnlyTestBase() {
+
+ @Test
+ fun header() {
+ val page = TestPage {
+ header(1, "The Hobbit or There and Back Again")
+ }
+ val expect = "//[testPage](test-page.md)\n\n\n\n# The Hobbit or There and Back Again \n"
+ CommonmarkRenderer(context).render(page)
+ assert(renderedContent == expect)
+ }
+
+ @Test
+ fun link() {
+ val page = TestPage {
+ link("They are not all accounted for, the lost Seeing Stones.", "http://www.google.com")
+ }
+ val expect = "//[testPage](test-page.md)\n\n[They are not all accounted for, the lost Seeing Stones.](http://www.google.com)"
+ CommonmarkRenderer(context).render(page)
+ assert(renderedContent == expect)
+ }
+
+ @Test
+ fun bold() {
+ val page = TestPage {
+ text("That there’s some good in this world, Mr. Frodo… and it’s worth fighting for.", styles = setOf(TextStyle.Bold))
+ }
+ val expect = "//[testPage](test-page.md)\n\n**That there’s some good in this world, Mr. Frodo… and it’s worth fighting for.**"
+ CommonmarkRenderer(context).render(page)
+ assert(renderedContent == expect)
+ }
+
+ @Test
+ fun italic() {
+ val page = TestPage {
+ text("Even the smallest person can change the course of the future.", styles = setOf(TextStyle.Italic))
+ }
+ val expect = "//[testPage](test-page.md)\n\n*Even the smallest person can change the course of the future.*"
+ CommonmarkRenderer(context).render(page)
+ assert(renderedContent == expect)
+ }
+
+ @Test
+ fun italicAndBold() {
+ val page = TestPage {
+ text("There is no curse in Elvish, Entish, or the tongues of Men for this treachery.", styles = setOf(TextStyle.Bold, TextStyle.Italic))
+ }
+ val expect = "//[testPage](test-page.md)\n\n***There is no curse in Elvish, Entish, or the tongues of Men for this treachery.***"
+ CommonmarkRenderer(context).render(page)
+ assert(renderedContent == expect)
+ }
+
+ @Test
+ fun strikethrough() {
+ val page = TestPage {
+ text("A day may come when the courage of men fails… but it is not THIS day", styles = setOf(TextStyle.Strikethrough))
+ }
+ val expect = "//[testPage](test-page.md)\n\n~~A day may come when the courage of men fails… but it is not THIS day~~"
+ CommonmarkRenderer(context).render(page)
+ assert(renderedContent == expect)
+ }
+} \ No newline at end of file
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt
index 64664d4a..18260f0e 100644
--- a/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt
@@ -3,7 +3,6 @@ package renderers.gfm
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.SourceRootImpl
import org.jetbrains.dokka.gfm.CommonmarkRenderer
-import renderers.gfm.GfmRenderingOnlyTestBase
import org.jetbrains.dokka.pages.TextStyle
import org.junit.jupiter.api.Test
import renderers.TestPage