Replies: 6 comments 4 replies
-
Thank you for your attention! ❤️ In fact, we are working hard to complete the relevant We will further support Json, YAML, Terraform Provider Schema, etc., and we will abstract them out a native templating system. Stay tuned. |
Beta Was this translation helpful? Give feedback.
-
Yes, some built-in templating for plain text generation, this is what I miss the most. We have many configs which aren't yaml/JSON structured e.g. Apache httpd configs, lot of ini files, XML. |
Beta Was this translation helpful? Give feedback.
-
Hi there @MirKml . Thank you for your attention. If you have any needs, please feel free to contact me. ❤️ I would like to further understand whether we can use KCL to render or template these non JSON/YAML formats, and what are your requirements? |
Beta Was this translation helpful? Give feedback.
-
OK, I see. At present, KCL has specific structured representations implemented internally, and we can serialize it into JSON/YAML. We will support the format parameter in the future to configure more formats such as using KCL to output |
Beta Was this translation helpful? Give feedback.
-
What will be the best for us - as I said - universal built-in templating like razor, go-templates, even PHP ... but with native KCL sample.k
Output after compilation will be result of computed, printed Currently it can be done with multiline string with parameters I think. But it's like workaround, not really native templates, with helpers etc. |
Beta Was this translation helpful? Give feedback.
-
OK. I see. Perhaps the following content is the best form? We can use the kcl plugin or builtin module to impl this template render features? import math
import kcl_plugin.go_template # Can be other built-in/plugin template libraries, such as Jinja2, Go template, Vercel, PHP, etc etc.
_calc_result = math.log10(100) # 2
templ = go_template.exec("/path/to/go_template", {"_calc_result": _calc_result}) |
Beta Was this translation helpful? Give feedback.
-
Hello
I'm currently relying heavily on CUE and Hof (https://github.com/hofstadter-io/hof) for generating source code.
I've recently discovered kcl-lang, and am very impressed by the project for many reasons.
I'd like to suggest that, while there is obvious value in applying kcl to configuration, it can also be used to generate source code. Consider it like uml - it can describe ever aspect of source code - and then, when combined with a text generator, be used to generate source code and artifacts.
For example, generating:
To achieve this it would be good if there was ability to generate kcl models from existing models, for example, import json, jsonschema, yaml, and ideally cue.
Similarly, export structs in Rust, Go, Java etc, for use in existing templating.
But also a native templating system would also be good.
Beta Was this translation helpful? Give feedback.
All reactions