Skip to content

Commit

Permalink
T.scholze/28 config file (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
tscholze authored Oct 22, 2022
2 parents c5f7ef7 + 0bceea6 commit 7a7e12f
Show file tree
Hide file tree
Showing 8 changed files with 164 additions and 219 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ Clone the [kotlog-template repository](https://github.com/tscholze/kotlin-kotlog
-g : Generates HTML output
-p : Publish aka pushes changes to remote
-co : Clears the output
-cc : To create a new configuration file
```

## Configuration

### Using configuration instance
A Kotlog-generated blog ist configurated using the `BlogConfiguration` parameter of the `Kotlog` invocation.
See `Main.kt` for a working example:

Expand All @@ -54,8 +56,20 @@ fun main(args: Array<String>) {
}
```

### Using configuration file
Otherwise, Kotlog will try to load the configuration file (`~/.kotlog`) from the file system. Run `./kotlog -cc` to create a new file.

```json
{
"baseUrl": "https://tscholze.github.io/blog",
"titleText": "Tobias Scholze | The Stuttering Nerd",
"footerText": "Made with ❤️ without JavaScript| Kotlog | Tobias Scholze",
"outputDirectoryName": "www"
}
```

## How it looks
![](https://github.com/tscholze/kotlin-kotlog-cli/blob/main/docs/kotlog-markdown2html.png?raw=true)
![Flow](https://github.com/tscholze/kotlin-kotlog-cli/blob/main/docs/kotlog-markdown2html.png?raw=true)
(Design, look and feel and other ui elements my differ from version to version)

## Features
Expand Down
59 changes: 0 additions & 59 deletions __output/2022-09-16-hi-i-m-kotlog-.html

This file was deleted.

120 changes: 0 additions & 120 deletions __output/index.html

This file was deleted.

1 change: 0 additions & 1 deletion __output/posts.json

This file was deleted.

24 changes: 18 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

// MARK: - Properties -

group = "io.github.tscholze"
version = "1.0.5"

// MARK: - Plugins -

plugins {
kotlin("jvm") version "1.7.10"
kotlin("plugin.serialization") version "1.7.10"
application
}

group = "io.github.tscholze"
version = "1.0.5"
// MARK: - Repositories -

repositories {
mavenCentral()
}

// MARK: - Dependencies -

dependencies {
// Markdown
implementation("org.commonmark:commonmark:0.19.0")
Expand All @@ -34,6 +42,14 @@ dependencies {
testImplementation(kotlin("test"))
}

// MARK: - Application settings -

application {
mainClass.set("MainKt")
}

// MARK: - Gradle tasks -

tasks.jar {
manifest {
attributes["Main-Class"] = "MainKt"
Expand All @@ -50,8 +66,4 @@ tasks.test {

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}

application {
mainClass.set("MainKt")
}
21 changes: 12 additions & 9 deletions src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import io.github.tscholze.kotlog.Kotlog
import io.github.tscholze.kotlog.models.BlogConfiguration

fun main(args: Array<String>) {

// 1. Create a configuration for the blog
val configuration = BlogConfiguration(
baseUrl = "https://tscholze.github.io/blog",
titleText = "Tobias Scholze | The Stuttering Nerd",
footerText = "Made with ❤️ without JavaScript| Kotlog | Tobias Scholze",
outputDirectoryName = "www"
)
// 1. Create a configuration for the blog,
// or it will be fetched from `~/.kotlog file`
//
// Sample:

// val configuration = BlogConfiguration(
// baseUrl = "https://tscholze.github.io/blog",
// titleText = "Tobias Scholze | The Stuttering Nerd",
// footerText = "Made with ❤️ without JavaScript| Kotlog | Tobias Scholze",
// outputDirectoryName = "www"
//)

// 2. Call and run Kotlog with command line arguments and configuration.
Kotlog(args, configuration)
Kotlog(args)
}

Loading

0 comments on commit 7a7e12f

Please sign in to comment.