asciidoctor / atom-language-asciidoc

⚛ AsciiDoc language package for the Atom editor.
https://atom.io/packages/language-asciidoc
MIT License
42 stars 20 forks source link

Enable embedded Kotlin language support #165

Closed bentolor closed 7 years ago

bentolor commented 7 years ago

Description

This pull requests enables to embed/write Kotlin code within AsciiDoc files. To get it working one must have the plugin atom-kotlin-language with the patch mentioned below installed:

Important Pre-Requisite

This feature requires https://github.com/alexmt/atom-kotlin-language/pull/7 to be merged, released and installed.

Syntax example

```kotlin
import java.util.*

with(helloWorldTextView) {
    text = "Hello World!"
    visibility = View.VISIBLE
}

fun main(args: Array<String>) {
    val name = if (args.size > 0) args[0] else "Publikum"
    val zuschauer = Gast(name, title = Title.wertes)

    println(zuschauer)
    println("Hallo ${zuschauer.title} ${zuschauer.name}")
}

data class Gast(val name: String, var zeit: Date = Date(),
                val title: Title?)
enum class Title { Herr, Frau, wertes }

[source,kt]

open class HelloWorld { inline fun Activity.find(id: Int): T = findViewById(id) as T }


## Screenshots

will render as_

![kotlin-support](https://cloud.githubusercontent.com/assets/588260/19593922/0e30adf2-9783-11e6-82c0-edc21ae1c7fa.png)
ldez commented 7 years ago

Thank you for your contribution!