aboutsummaryrefslogtreecommitdiff
path: root/plugins/templating
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2021-08-04 17:02:31 +0200
committerMarcin Aman <marcin.aman@gmail.com>2021-08-12 13:21:40 +0200
commit0fe8352ab057dfbbf690a723b2ccfc15b9977f4a (patch)
tree7017e7169950f907206832c862dce5e711e3cae8 /plugins/templating
parent42c0320e0c5f2d79a5438558bb87d4668aa4c3cc (diff)
downloaddokka-0fe8352ab057dfbbf690a723b2ccfc15b9977f4a.tar.gz
dokka-0fe8352ab057dfbbf690a723b2ccfc15b9977f4a.tar.bz2
dokka-0fe8352ab057dfbbf690a723b2ccfc15b9977f4a.zip
Webhelp-like frontend
Diffstat (limited to 'plugins/templating')
-rw-r--r--plugins/templating/api/templating.api6
-rw-r--r--plugins/templating/src/main/kotlin/templates/ProjectNameSubstitutor.kt13
-rw-r--r--plugins/templating/src/main/kotlin/templates/TemplatingPlugin.kt5
3 files changed, 24 insertions, 0 deletions
diff --git a/plugins/templating/api/templating.api b/plugins/templating/api/templating.api
index ecf4a0b6..83b8e945 100644
--- a/plugins/templating/api/templating.api
+++ b/plugins/templating/api/templating.api
@@ -137,6 +137,7 @@ public final class org/jetbrains/dokka/templates/TemplatingPlugin : org/jetbrain
public final fun getPackageListProcessingStrategy ()Lorg/jetbrains/dokka/plugability/Extension;
public final fun getPagesSearchTemplateStrategy ()Lorg/jetbrains/dokka/plugability/Extension;
public final fun getPathToRootSubstitutor ()Lorg/jetbrains/dokka/plugability/Extension;
+ public final fun getProjectNameSubstitutor ()Lorg/jetbrains/dokka/plugability/Extension;
public final fun getSourcesetDependencyProcessingStrategy ()Lorg/jetbrains/dokka/plugability/Extension;
public final fun getSubmoduleTemplateProcessor ()Lorg/jetbrains/dokka/plugability/ExtensionPoint;
public final fun getSubstitutionCommandHandler ()Lorg/jetbrains/dokka/plugability/Extension;
@@ -158,6 +159,11 @@ public final class org/jetbrains/dokka/templates/TemplatingResult {
public fun toString ()Ljava/lang/String;
}
+public final class templates/ProjectNameSubstitutor : org/jetbrains/dokka/templates/Substitutor {
+ public fun <init> (Lorg/jetbrains/dokka/plugability/DokkaContext;)V
+ public fun trySubstitute (Lorg/jetbrains/dokka/templates/TemplatingContext;Lkotlin/text/MatchResult;)Ljava/lang/String;
+}
+
public final class templates/SourcesetDependencyProcessingStrategy : org/jetbrains/dokka/templates/TemplateProcessingStrategy {
public fun <init> (Lorg/jetbrains/dokka/plugability/DokkaContext;)V
public fun finish (Ljava/io/File;)V
diff --git a/plugins/templating/src/main/kotlin/templates/ProjectNameSubstitutor.kt b/plugins/templating/src/main/kotlin/templates/ProjectNameSubstitutor.kt
new file mode 100644
index 00000000..8fc12b6c
--- /dev/null
+++ b/plugins/templating/src/main/kotlin/templates/ProjectNameSubstitutor.kt
@@ -0,0 +1,13 @@
+package templates
+
+import org.jetbrains.dokka.base.templating.ProjectNameSubstitutionCommand
+import org.jetbrains.dokka.base.templating.SubstitutionCommand
+import org.jetbrains.dokka.plugability.DokkaContext
+import org.jetbrains.dokka.templates.Substitutor
+import org.jetbrains.dokka.templates.TemplatingContext
+
+class ProjectNameSubstitutor(private val dokkaContext: DokkaContext) : Substitutor {
+
+ override fun trySubstitute(context: TemplatingContext<SubstitutionCommand>, match: MatchResult): String? =
+ dokkaContext.configuration.moduleName.takeIf { context.command is ProjectNameSubstitutionCommand }
+} \ No newline at end of file
diff --git a/plugins/templating/src/main/kotlin/templates/TemplatingPlugin.kt b/plugins/templating/src/main/kotlin/templates/TemplatingPlugin.kt
index 0842bb2b..418edcbf 100644
--- a/plugins/templating/src/main/kotlin/templates/TemplatingPlugin.kt
+++ b/plugins/templating/src/main/kotlin/templates/TemplatingPlugin.kt
@@ -4,6 +4,7 @@ import org.jetbrains.dokka.allModulesPage.templates.NavigationSearchTemplateStra
import org.jetbrains.dokka.allModulesPage.templates.PackageListProcessingStrategy
import org.jetbrains.dokka.allModulesPage.templates.PagesSearchTemplateStrategy
import org.jetbrains.dokka.plugability.DokkaPlugin
+import templates.ProjectNameSubstitutor
import templates.SourcesetDependencyProcessingStrategy
class TemplatingPlugin : DokkaPlugin() {
@@ -60,6 +61,10 @@ class TemplatingPlugin : DokkaPlugin() {
substitutor providing ::PathToRootSubstitutor
}
+ val projectNameSubstitutor by extending {
+ substitutor providing ::ProjectNameSubstitutor
+ }
+
val addToNavigationCommandHandler by extending {
directiveBasedCommandHandlers providing ::AddToNavigationCommandHandler
}