Skip to content

Kotlin Support#27

Merged
AndiDittrich merged 1 commit intoEnlighterJS:masterfrom
kevcodez:master
May 21, 2017
Merged

Kotlin Support#27
AndiDittrich merged 1 commit intoEnlighterJS:masterfrom
kevcodez:master

Conversation

@kevcodez
Copy link
Copy Markdown
Contributor

No description provided.

@kevcodez
Copy link
Copy Markdown
Contributor Author

kevcodez commented May 21, 2017

If there is anything to improve, please let me know ;)

Kotlin Grammar https://kotlinlang.org/docs/reference/grammar.html

Example Code https://learnxinyminutes.com/docs/kotlin/

@AndiDittrich AndiDittrich merged commit 034db5f into EnlighterJS:master May 21, 2017
@kevcodez
Copy link
Copy Markdown
Contributor Author

@AndiDittrich would love to see a new plugin release for wordpress, if possible :)

@AndiDittrich
Copy link
Copy Markdown
Member

Do you have any kotlin example code owned by yours ? the example codes license is not compatible

@kevcodez
Copy link
Copy Markdown
Contributor Author

kevcodez commented May 22, 2017

What about this one https://try.kotlinlang.org/#/Examples/Longer%20examples/HTML%20Builder/HTML%20Builder.kt ? From the official Kotlin page

If this is not sufficient, I am going to write some code

@AndiDittrich
Copy link
Copy Markdown
Member

need something with MIT license or similar .. a small testcase will be sufficient.

@kevcodez
Copy link
Copy Markdown
Contributor Author

kevcodez commented Jun 5, 2017

Just wrote some sample code, free to use.

package com.example

import java.time.LocalDate

data class Person(var firstName: String, var lastName: String, var birthdate: LocalDate) {

    fun getAge(): Int {
        return LocalDate.now().year - birthdate.year;
    }

}

fun main(args: Array<String>) {
    val person1 = Person("Samuel", "Jackson", LocalDate.of(1948, 12, 21));
    val person2 = Person("Quentin", "Tarantino", LocalDate.of(1963, 3, 27))

    val persons = listOf<Person>(person1, person2)

    val personsAbove50 = persons.filter { it.getAge() > 50 }

    println(personsAbove50)

    println("First Name: ${person1.firstName}")

    val jsonString = """[
      {"firstName":"Samuel", "lastName": "Jackson"},
      {"firstName":"Quentin", "lastName": "Tarantino"}
    ]"""

    println(jsonString)
}

@AndiDittrich
Copy link
Copy Markdown
Member

Dear kevcodez,

i've just release EnlighterJS v2.11.0 including your Kotlin language support. https://enlighterjs.org/Language.Kotlin.html

it will be added to the next Enlighter WordPress Release

br, Andi

@AndiDittrich
Copy link
Copy Markdown
Member

https://github.com/AndiDittrich/WordPress.Enlighter

Added to v3.5-BETA1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants