Originally created by @moritztim on GitHub (Feb 13, 2024).
I know your bandwidth is limited, just putting it out there. I would love to see support for INI-like formats, such as systemd configuration files or even just plain ini files.
Feel free to suggest more and I'll add them to the list
Originally created by @moritztim on GitHub (Feb 13, 2024).
I know your bandwidth is limited, just putting it out there. I would love to see support for INI-like formats, such as systemd configuration files or even just plain ini files.
Here are the INI-style formats I can think of:
- [x] [Microsoft INI](https://en.wikipedia.org/wiki/INI_file), implemented in #149
- [ ] [Freedesktop desktop entry](https://specifications.freedesktop.org/desktop-entry-spec/latest/)
- [ ] [Freedesktop systemd config](https://www.freedesktop.org/software/systemd/man/latest/systemd.syntax.html)
- [ ] [Editorconfig](https://spec.editorconfig.org)
Feel free to suggest more and I'll add them to the list
Since bandwidth is indeed limited, you might want to have a go at it that way yourself; we're more than happy to support / review / etc. and since this can be written in Pkl itself, it doesn't require expertise about Pkl internals.
@holzensp commented on GitHub (Feb 13, 2024):
It's a totally legit ask. For other output formats, especially "simpler" ones, we recommend implementing them in Pkl itself. We did this with the TOML renderer, for example: https://github.com/apple/pkl-pantry/tree/main/packages/pkl.toml
Since bandwidth is indeed limited, you might want to have a go at it that way yourself; we're more than happy to support / review / etc. and since this can be written in Pkl itself, it doesn't require expertise about Pkl internals.
since this can be written in Pkl itself, it doesn't require expertise about Pkl internals.
I love that
Unfortunately my bandwith is also limited 💀 but I might get into making some other renderers at a later point, sounds like a fun challenge
@moritztim commented on GitHub (Feb 13, 2024):
> since this can be written in Pkl itself, it doesn't require expertise about Pkl internals.
I love that
Unfortunately my bandwith is also limited :skull: but I might get into making some other renderers at a later point, sounds like a fun challenge
Its looking good so far the IniRenderer renders ini files in the correct structure just need to handle escape codes and correctly formatting (breakline after each nest) the ini file. Here is a look at what the test outputted.
int=123float=1.23bool=truestring=PigeonunicodeString=abc😀abc😎abcmultiLineString=have agreatday[map]one=123two=1.23three=truefour=Pigeonfive=abc😀abc😎abcsix=have agreatday[map.seven]name=Pigeon[mapping]one=123two=1.23three=truefour=Pigeonfive=abc😀abc😎abcsix=have agreatday[mapping.seven]name=Pigeon[typedObject]name=Pigeonage=30[typedObject.address]street=Folsom St.[container]name=Pigeonage=30[container.address]street=Folsom St.
@Madmegsox1 commented on GitHub (Feb 13, 2024):
Its looking good so far the `IniRenderer` renders ini files in the correct structure just need to handle escape codes and correctly formatting (breakline after each nest) the ini file. Here is a look at what the test outputted.
```ini
int = 123
float = 1.23
bool = true
string = Pigeon
unicodeString = abc😀abc😎abc
multiLineString = have a
great
day
[map]
one = 123
two = 1.23
three = true
four = Pigeon
five = abc😀abc😎abc
six = have a
great
day
[map.seven]
name = Pigeon
[mapping]
one = 123
two = 1.23
three = true
four = Pigeon
five = abc😀abc😎abc
six = have a
great
day
[mapping.seven]
name = Pigeon
[typedObject]
name = Pigeon
age = 30
[typedObject.address]
street = Folsom St.
[container]
name = Pigeon
age = 30
[container.address]
street = Folsom St.
```
Its now outputting correctly and handles escape chars. Is there anywhere else i need to add the IniRenderer to?
@Madmegsox1 commented on GitHub (Feb 14, 2024):
Its now outputting correctly and handles escape chars. Is there anywhere else i need to add the `IniRenderer` to?
Nice! Do you want to PR this? That will make it a little easier to iterate.
To add a new in-language renderer, you will need to create a new standard library module. To do that:
Create the stdlib module itself; stdlib/ini.pkl
Create a new class in org.pkl.core.runtime that extends StdlibModule, and add it to org.pkl.core.runtime.ModuleCache#getOrLoad (see the existing source code to look at what's currently already there).
Create a class RendererNodes in new package org.pkl.core.stdlib.ini (see the other stdlib packages that are in there for reference)
You will also need to add language snippet tests for this renderer, in pkl-core/src/test/files/LanguageSnippetTests/input/api/
@bioball commented on GitHub (Feb 14, 2024):
Nice! Do you want to PR this? That will make it a little easier to iterate.
To add a new in-language renderer, you will need to create a new standard library module. To do that:
1. Create the stdlib module itself; `stdlib/ini.pkl`
2. Create a new class in `org.pkl.core.runtime` that extends `StdlibModule`, and add it to `org.pkl.core.runtime.ModuleCache#getOrLoad` (see the existing source code to look at what's currently already there).
3. Create a `class RendererNodes` in new package `org.pkl.core.stdlib.ini` (see the other stdlib packages that are in there for reference)
You will also need to add language snippet tests for this renderer, in pkl-core/src/test/files/LanguageSnippetTests/input/api/
@moritztim commented on GitHub (Feb 14, 2024):
Also make sure that you follow the [contribution guidelines](https://github.com/apple/pkl/blob/main/CONTRIBUTING.adoc)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @moritztim on GitHub (Feb 13, 2024).
I know your bandwidth is limited, just putting it out there. I would love to see support for INI-like formats, such as systemd configuration files or even just plain ini files.
Here are the INI-style formats I can think of:
Feel free to suggest more and I'll add them to the list
@holzensp commented on GitHub (Feb 13, 2024):
It's a totally legit ask. For other output formats, especially "simpler" ones, we recommend implementing them in Pkl itself. We did this with the TOML renderer, for example: https://github.com/apple/pkl-pantry/tree/main/packages/pkl.toml
Since bandwidth is indeed limited, you might want to have a go at it that way yourself; we're more than happy to support / review / etc. and since this can be written in Pkl itself, it doesn't require expertise about Pkl internals.
@Madmegsox1 commented on GitHub (Feb 13, 2024):
Hi, ill have a look at starting to create a
INIRenderer.@moritztim commented on GitHub (Feb 13, 2024):
I love that
Unfortunately my bandwith is also limited 💀 but I might get into making some other renderers at a later point, sounds like a fun challenge
@Madmegsox1 commented on GitHub (Feb 13, 2024):
Its looking good so far the
IniRendererrenders ini files in the correct structure just need to handle escape codes and correctly formatting (breakline after each nest) the ini file. Here is a look at what the test outputted.@Madmegsox1 commented on GitHub (Feb 14, 2024):
Its now outputting correctly and handles escape chars. Is there anywhere else i need to add the
IniRendererto?@bioball commented on GitHub (Feb 14, 2024):
Nice! Do you want to PR this? That will make it a little easier to iterate.
To add a new in-language renderer, you will need to create a new standard library module. To do that:
stdlib/ini.pklorg.pkl.core.runtimethat extendsStdlibModule, and add it toorg.pkl.core.runtime.ModuleCache#getOrLoad(see the existing source code to look at what's currently already there).class RendererNodesin new packageorg.pkl.core.stdlib.ini(see the other stdlib packages that are in there for reference)You will also need to add language snippet tests for this renderer, in pkl-core/src/test/files/LanguageSnippetTests/input/api/
@moritztim commented on GitHub (Feb 14, 2024):
Also make sure that you follow the contribution guidelines
@Madmegsox1 commented on GitHub (Feb 14, 2024):
Created PR. Ill create the new in-language renderer soon and open another PR.
Thank you for the help.