aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2014-12-29 15:40:21 +0100
committerDmitry Jemerov <yole@jetbrains.com>2014-12-29 15:40:21 +0100
commit2dbd849c7c603a25607bcc66025138dee3c30458 (patch)
tree8430c82c6898c8015b18ec7bdbc43e3df0eaa986
parent8f3802672c6a07e9f5f949ef0b5482383b467cb6 (diff)
downloaddokka-2dbd849c7c603a25607bcc66025138dee3c30458.tar.gz
dokka-2dbd849c7c603a25607bcc66025138dee3c30458.tar.bz2
dokka-2dbd849c7c603a25607bcc66025138dee3c30458.zip
add command line argument for specifying output format
-rw-r--r--src/main.kt21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/main.kt b/src/main.kt
index 4e627376..bc7cefd7 100644
--- a/src/main.kt
+++ b/src/main.kt
@@ -22,10 +22,14 @@ class DokkaArguments {
ValueDescription("<path>")
public var samples: String = ""
- Argument(value = "output", description = "Output directory path for .md files")
+ Argument(value = "output", description = "Output directory path")
ValueDescription("<path>")
public var outputDir: String = "out/doc/"
+ Argument(value = "format", description = "Output format (text, html, markdown, jekyll, kotlin-website)")
+ ValueDescription("<name>")
+ public var outputFormat: String = "html"
+
Argument(value = "module", description = "Name of the documentation module")
ValueDescription("<name>")
public var moduleName: String = ""
@@ -118,8 +122,19 @@ public fun main(args: Array<String>) {
val locationService = FoldersLocationService(arguments.outputDir)
val templateService = HtmlTemplateService.default("/dokka/styles/style.css")
-// val formatter = HtmlFormatService(locationService, signatureGenerator, templateService)
- val formatter = KotlinWebsiteFormatService(locationService, signatureGenerator)
+ val formatter = when (arguments.outputFormat) {
+ "text" -> TextFormatService(signatureGenerator)
+ "html" -> HtmlFormatService(locationService, signatureGenerator, templateService)
+ "markdown" -> MarkdownFormatService(locationService, signatureGenerator)
+ "jekyll" -> JekyllFormatService(locationService, signatureGenerator)
+ "kotlin-website" -> KotlinWebsiteFormatService(locationService, signatureGenerator)
+ else -> null
+ }
+ if (formatter == null) {
+ print("Unrecognized output format ${arguments.outputFormat}")
+ return
+ }
+
val generator = FileGenerator(signatureGenerator, locationService, formatter)
print("Generating pages... ")
generator.buildPage(documentation)