aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt2
-rw-r--r--plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt28
2 files changed, 15 insertions, 15 deletions
diff --git a/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt b/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt
index 9e6ed965..63699585 100644
--- a/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt
+++ b/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt
@@ -15,7 +15,7 @@ class MathjaxPlugin : DokkaPlugin() {
}
private const val ANNOTATION = "usesMathJax"
-private const val LIB_PATH = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS_SVG&latest"
+internal const val LIB_PATH = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS_SVG&latest"
object MathjaxTransformer : PageTransformer {
override fun invoke(input: RootPageNode) = input.transformContentPagesTree {
diff --git a/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt b/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt
index 33269ce7..4a4ada23 100644
--- a/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt
+++ b/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt
@@ -1,5 +1,6 @@
package mathjaxTest
+import org.jetbrains.dokka.mathjax.LIB_PATH
import org.jetbrains.dokka.mathjax.MathjaxPlugin
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
import org.jsoup.Jsoup
@@ -8,7 +9,7 @@ import utils.TestOutputWriterPlugin
class MathjaxPluginTest : AbstractCoreTest() {
@Test
- fun basicMathjaxTest() {
+ fun noMathjaxTest() {
val configuration = dokkaConfiguration {
sourceSets {
sourceSet {
@@ -21,11 +22,9 @@ class MathjaxPluginTest : AbstractCoreTest() {
|/src/main/kotlin/test/Test.kt
|package example
| /**
- | * {@usesMathJax}
- | *
- | * <p>\(\alpha_{out} = \alpha_{dst}\)</p>
- | * <p>\(C_{out} = C_{dst}\)</p>
+ | * Just a regular kdoc
| */
+ | fun test(): String = ""
""".trimIndent()
val writerPlugin = TestOutputWriterPlugin()
testInline(
@@ -35,19 +34,18 @@ class MathjaxPluginTest : AbstractCoreTest() {
) {
renderingStage = {
_, _ -> Jsoup
- .parse(writerPlugin.writer.contents["root/example.html"])
+ .parse(writerPlugin.writer.contents["root/example/test.html"])
.head()
.select("link, script")
.let {
- val link = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS_SVG&latest"
- assert(it.`is`("[href=$link], [src=$link]"))
+ assert(!it.`is`("[href=$LIB_PATH], [src=$LIB_PATH]"))
}
}
}
}
@Test
- fun basicNoMathjaxTest() {
+ fun usingMathjaxTest() {
val configuration = dokkaConfiguration {
sourceSets {
sourceSet {
@@ -60,9 +58,12 @@ class MathjaxPluginTest : AbstractCoreTest() {
|/src/main/kotlin/test/Test.kt
|package example
| /**
- | * <p>\(\alpha_{out} = \alpha_{dst}\)</p>
- | * <p>\(C_{out} = C_{dst}\)</p>
+ | * @usesMathJax
+ | *
+ | * \(\alpha_{out} = \alpha_{dst}\)
+ | * \(C_{out} = C_{dst}\)
| */
+ | fun test(): String = ""
""".trimIndent()
val writerPlugin = TestOutputWriterPlugin()
testInline(
@@ -72,12 +73,11 @@ class MathjaxPluginTest : AbstractCoreTest() {
) {
renderingStage = {
_, _ -> Jsoup
- .parse(writerPlugin.writer.contents["root/example.html"])
+ .parse(writerPlugin.writer.contents["root/example/test.html"])
.head()
.select("link, script")
.let {
- val link = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS_SVG&latest"
- assert(!it.`is`("[href=$link], [src=$link]"))
+ assert(it.`is`("[href=$LIB_PATH], [src=$LIB_PATH]"))
}
}
}