aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2020-02-11 15:33:37 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-02-12 11:22:46 +0100
commit5a432c9c62ff95779a495fb354c83f5f7c481a1d (patch)
tree7d6742eba4b650777745a838bd27a9c7767404a5 /core
parent0d430649e966454e808874d7555340be5496ca9d (diff)
downloaddokka-5a432c9c62ff95779a495fb354c83f5f7c481a1d.tar.gz
dokka-5a432c9c62ff95779a495fb354c83f5f7c481a1d.tar.bz2
dokka-5a432c9c62ff95779a495fb354c83f5f7c481a1d.zip
Removed default file extension extension point
Diffstat (limited to 'core')
-rw-r--r--core/src/main/kotlin/CoreExtensions.kt1
-rw-r--r--core/src/main/kotlin/plugability/DefaultExtensions.kt1
-rw-r--r--core/src/main/kotlin/renderers/DefaultRenderer.kt4
-rw-r--r--core/src/main/kotlin/renderers/FileWriter.kt2
-rw-r--r--core/src/main/kotlin/renderers/OutputWriter.kt6
-rw-r--r--core/src/main/kotlin/resolvers/DefaultLocationProvider.kt2
6 files changed, 5 insertions, 11 deletions
diff --git a/core/src/main/kotlin/CoreExtensions.kt b/core/src/main/kotlin/CoreExtensions.kt
index 46b241a7..8c66b41e 100644
--- a/core/src/main/kotlin/CoreExtensions.kt
+++ b/core/src/main/kotlin/CoreExtensions.kt
@@ -29,7 +29,6 @@ object CoreExtensions {
val locationProviderFactory by coreExtension<LocationProviderFactory>()
val outputWriter by coreExtension<OutputWriter>()
val renderer by coreExtension<Renderer>()
- val fileExtension by coreExtension<String>()
private fun <T: Any> coreExtension() = object {
operator fun provideDelegate(thisRef: CoreExtensions, property: KProperty<*>): Lazy<ExtensionPoint<T>> =
diff --git a/core/src/main/kotlin/plugability/DefaultExtensions.kt b/core/src/main/kotlin/plugability/DefaultExtensions.kt
index 029d21de..d6331b86 100644
--- a/core/src/main/kotlin/plugability/DefaultExtensions.kt
+++ b/core/src/main/kotlin/plugability/DefaultExtensions.kt
@@ -34,7 +34,6 @@ internal object DefaultExtensions {
CoreExtensions.renderer -> renderer.get(fullContext)
CoreExtensions.locationProviderFactory -> providerFactory.get(fullContext)
CoreExtensions.outputWriter -> outputWriter.get(fullContext)
- CoreExtensions.fileExtension -> ".html"
else -> null
}.let { listOfNotNull( it ) as List<T> }
} \ No newline at end of file
diff --git a/core/src/main/kotlin/renderers/DefaultRenderer.kt b/core/src/main/kotlin/renderers/DefaultRenderer.kt
index 4b4d6fd3..16cdb4c1 100644
--- a/core/src/main/kotlin/renderers/DefaultRenderer.kt
+++ b/core/src/main/kotlin/renderers/DefaultRenderer.kt
@@ -75,11 +75,11 @@ abstract class DefaultRenderer<T>(
open fun renderPage(page: PageNode) {
val path by lazy { locationProvider.resolve(page, skipExtension = true) }
when (page) {
- is ContentPage -> outputWriter.write(path, buildPage(page) { c, p -> buildPageContent(c, p) })
+ is ContentPage -> outputWriter.write(path, buildPage(page) { c, p -> buildPageContent(c, p) }, ".html")
is RendererSpecificPage -> when (val strategy = page.strategy) {
is RenderingStrategy.Copy -> outputWriter.writeResources(strategy.from, path)
is RenderingStrategy.Write -> outputWriter.write(path, strategy.text, "")
- is RenderingStrategy.Callback -> outputWriter.write(path, strategy.instructions(this, page))
+ is RenderingStrategy.Callback -> outputWriter.write(path, strategy.instructions(this, page), ".html")
RenderingStrategy.DoNothing -> Unit
}
else -> throw AssertionError(
diff --git a/core/src/main/kotlin/renderers/FileWriter.kt b/core/src/main/kotlin/renderers/FileWriter.kt
index 83bb9ce3..727a8d21 100644
--- a/core/src/main/kotlin/renderers/FileWriter.kt
+++ b/core/src/main/kotlin/renderers/FileWriter.kt
@@ -6,7 +6,7 @@ import java.io.IOException
import java.net.URI
import java.nio.file.*
-class FileWriter(override val context: DokkaContext): OutputWriter {
+class FileWriter(val context: DokkaContext): OutputWriter {
private val createdFiles: MutableSet<String> = mutableSetOf()
private val jarUriPrefix = "jar:file:"
private val root = context.configuration.outputDir
diff --git a/core/src/main/kotlin/renderers/OutputWriter.kt b/core/src/main/kotlin/renderers/OutputWriter.kt
index b2059aa3..30b2b0b6 100644
--- a/core/src/main/kotlin/renderers/OutputWriter.kt
+++ b/core/src/main/kotlin/renderers/OutputWriter.kt
@@ -6,10 +6,6 @@ import org.jetbrains.dokka.plugability.single
interface OutputWriter {
- val context: DokkaContext
- val extension: String
- get() = context.single(CoreExtensions.fileExtension)
-
- fun write(path: String, text: String, ext: String = extension)
+ fun write(path: String, text: String, ext: String)
fun writeResources(pathFrom: String, pathTo: String)
} \ No newline at end of file
diff --git a/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt b/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt
index cac7b740..d30264bb 100644
--- a/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt
+++ b/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt
@@ -14,7 +14,7 @@ open class DefaultLocationProvider(
protected val pageGraphRoot: RootPageNode,
protected val dokkaContext: DokkaContext
) : LocationProvider {
- protected val extension = dokkaContext.single(CoreExtensions.fileExtension)
+ protected val extension = ".html"
protected val pagesIndex: Map<DRI, ContentPage> = pageGraphRoot.asSequence().filterIsInstance<ContentPage>()
.map { it.dri.map { dri -> dri to it } }.flatten()