aboutsummaryrefslogtreecommitdiff
path: root/plugins/templating/src/main/kotlin/templates/ProjectNameSubstitutor.kt
blob: 8fc12b6c3f9c67fc9d7ccce82af04285bffa9156 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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 }
}