aboutsummaryrefslogtreecommitdiff
path: root/src/Formats
diff options
context:
space:
mode:
Diffstat (limited to 'src/Formats')
-rw-r--r--src/Formats/FormatDescriptor.kt11
-rw-r--r--src/Formats/HtmlFormatService.kt6
-rw-r--r--src/Formats/JekyllFormatService.kt4
-rw-r--r--src/Formats/KotlinWebsiteFormatService.kt5
-rw-r--r--src/Formats/MarkdownFormatService.kt4
-rw-r--r--src/Formats/StandardFormats.kt47
-rw-r--r--src/Formats/YamlOutlineService.kt3
7 files changed, 74 insertions, 6 deletions
diff --git a/src/Formats/FormatDescriptor.kt b/src/Formats/FormatDescriptor.kt
new file mode 100644
index 00000000..beff730f
--- /dev/null
+++ b/src/Formats/FormatDescriptor.kt
@@ -0,0 +1,11 @@
+package org.jetbrains.dokka.Formats
+
+import org.jetbrains.dokka.FormatService
+import org.jetbrains.dokka.Generator
+import org.jetbrains.dokka.OutlineFormatService
+
+public interface FormatDescriptor {
+ val formatServiceClass: Class<out FormatService>?
+ val outlineServiceClass: Class<out OutlineFormatService>?
+ val generatorServiceClass: Class<out Generator>
+} \ No newline at end of file
diff --git a/src/Formats/HtmlFormatService.kt b/src/Formats/HtmlFormatService.kt
index 78d3cff2..5dcd432b 100644
--- a/src/Formats/HtmlFormatService.kt
+++ b/src/Formats/HtmlFormatService.kt
@@ -1,10 +1,12 @@
package org.jetbrains.dokka
+import com.google.inject.Inject
+import com.google.inject.name.Named
import java.io.File
-public open class HtmlFormatService(locationService: LocationService,
+public open class HtmlFormatService @Inject constructor(@Named("folders") locationService: LocationService,
signatureGenerator: LanguageService,
- val templateService: HtmlTemplateService = HtmlTemplateService.default())
+ val templateService: HtmlTemplateService)
: StructuredFormatService(locationService, signatureGenerator, "html"), OutlineFormatService {
override public fun formatText(text: String): String {
return text.htmlEscape()
diff --git a/src/Formats/JekyllFormatService.kt b/src/Formats/JekyllFormatService.kt
index e4c3ccd5..113f229f 100644
--- a/src/Formats/JekyllFormatService.kt
+++ b/src/Formats/JekyllFormatService.kt
@@ -1,6 +1,8 @@
package org.jetbrains.dokka
-public open class JekyllFormatService(locationService: LocationService,
+import com.google.inject.Inject
+
+public open class JekyllFormatService @Inject constructor(locationService: LocationService,
signatureGenerator: LanguageService)
: MarkdownFormatService(locationService, signatureGenerator) {
diff --git a/src/Formats/KotlinWebsiteFormatService.kt b/src/Formats/KotlinWebsiteFormatService.kt
index 21fc9dae..8fbebaae 100644
--- a/src/Formats/KotlinWebsiteFormatService.kt
+++ b/src/Formats/KotlinWebsiteFormatService.kt
@@ -1,8 +1,11 @@
package org.jetbrains.dokka
-public class KotlinWebsiteFormatService(locationService: LocationService,
+import com.google.inject.Inject
+
+public class KotlinWebsiteFormatService @Inject constructor(locationService: LocationService,
signatureGenerator: LanguageService)
: JekyllFormatService(locationService, signatureGenerator) {
+
override fun appendFrontMatter(nodes: Iterable<DocumentationNode>, to: StringBuilder) {
super.appendFrontMatter(nodes, to)
to.appendln("layout: api")
diff --git a/src/Formats/MarkdownFormatService.kt b/src/Formats/MarkdownFormatService.kt
index ba7d8f7b..29a9f5c4 100644
--- a/src/Formats/MarkdownFormatService.kt
+++ b/src/Formats/MarkdownFormatService.kt
@@ -1,7 +1,9 @@
package org.jetbrains.dokka
+import com.google.inject.Inject
-public open class MarkdownFormatService(locationService: LocationService,
+
+public open class MarkdownFormatService @Inject constructor(locationService: LocationService,
signatureGenerator: LanguageService)
: StructuredFormatService(locationService, signatureGenerator, "md") {
override public fun formatBreadcrumbs(items: Iterable<FormatLink>): String {
diff --git a/src/Formats/StandardFormats.kt b/src/Formats/StandardFormats.kt
new file mode 100644
index 00000000..1d5ffe13
--- /dev/null
+++ b/src/Formats/StandardFormats.kt
@@ -0,0 +1,47 @@
+package org.jetbrains.dokka.Formats
+
+import org.jetbrains.dokka.*
+
+class HtmlFormatDescriptor : FormatDescriptor {
+ override val formatServiceClass: Class<out FormatService>
+ get() = javaClass<HtmlFormatService>()
+
+ override val outlineServiceClass: Class<out OutlineFormatService>
+ get() = javaClass<HtmlFormatService>()
+
+ override val generatorServiceClass: Class<out Generator>
+ get() = javaClass<FileGenerator>()
+}
+
+class KotlinWebsiteFormatDescriptor : FormatDescriptor {
+ override val formatServiceClass: Class<out FormatService>
+ get() = javaClass<KotlinWebsiteFormatService>()
+
+ override val outlineServiceClass: Class<out OutlineFormatService>
+ get() = javaClass<YamlOutlineService>()
+
+ override val generatorServiceClass: Class<out Generator>
+ get() = javaClass<FileGenerator>()
+}
+
+class JekyllFormatDescriptor : FormatDescriptor {
+ override val formatServiceClass: Class<out FormatService>
+ get() = javaClass<JekyllFormatService>()
+
+ override val outlineServiceClass: Class<out OutlineFormatService>?
+ get() = null
+
+ override val generatorServiceClass: Class<out Generator>
+ get() = javaClass<FileGenerator>()
+}
+
+class MarkdownFormatDescriptor : FormatDescriptor {
+ override val formatServiceClass: Class<out FormatService>
+ get() = javaClass<MarkdownFormatService>()
+
+ override val outlineServiceClass: Class<out OutlineFormatService>?
+ get() = null
+
+ override val generatorServiceClass: Class<out Generator>
+ get() = javaClass<FileGenerator>()
+}
diff --git a/src/Formats/YamlOutlineService.kt b/src/Formats/YamlOutlineService.kt
index cdab4eeb..7968824c 100644
--- a/src/Formats/YamlOutlineService.kt
+++ b/src/Formats/YamlOutlineService.kt
@@ -1,8 +1,9 @@
package org.jetbrains.dokka
+import com.google.inject.Inject
import java.io.File
-class YamlOutlineService(val locationService: LocationService,
+class YamlOutlineService @Inject constructor(val locationService: LocationService,
val languageService: LanguageService) : OutlineFormatService {
override fun getOutlineFileName(location: Location): File = File("${location.path}.yml")