Skip to content

T.scholze/28 config file #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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