-
Notifications
You must be signed in to change notification settings - Fork 14
DSL Support #42
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
Comments
I don't what DSL you're referring to here. The code generator creates Kotlin and Java output, and it also produces Typescript interfaces (although with much more limited feature coverage). But the output is all controlled by Mustache templates, so if you want to generate some other form of code you can provide your own templates. This is not well documented, but if you create a template and parse it using the above-linked Mustache processor, you can then supply it to the code generator:
The "context object" for the template is a I'm sorry if this is not very helpful, but your requirement is not what I had considered a primary use case for the code generator. |
https://kotlinlang.org/docs/type-safe-builders.html This is what I meant. html {
head {
title {+"XML encoding with Kotlin"}
}
body {
h1 {+"XML encoding with Kotlin"}
p {+"this format can be used as an alternative markup to XML"}
// an element with attributes and text content
a(href = "https://kotlinlang.org") {+"Kotlin"}
// mixed content
p {
+"This is some"
b {+"mixed"}
+"text. For more see the"
a(href = "https://kotlinlang.org") {+"Kotlin"}
+"project"
}
p {+"some text"}
// content generated by
p {
for (arg in args)
+arg
}
}
} |
I think it makes sense to optionally generate DSLs as well. I was thinking about storing my k8s configuration on kotlin DSL, found about this codegen however it only generates kotlin, halfway there.
The text was updated successfully, but these errors were encountered: