Coder Social home page Coder Social logo

How can i stringify toml comment? about iarna-toml HOT 5 OPEN

iarna avatar iarna commented on August 29, 2024 1
How can i stringify toml comment?

from iarna-toml.

Comments (5)

scriptcoded avatar scriptcoded commented on August 29, 2024 2

@iarna Perhaps. In my head the hard thing with comments is that they don't have an unique identifier, which means that they can not be easily represented in a POJO. The first solution that came to me was to use random identifiers for comments. The issues with that are pretty obvious though, as there is a risk for collisions between comments and actual keys. Also, it's not a very friendly interface for developers.

Another idea might be to tie comment to properties, and return a separate object containing comments. For example:

# names contains a list of usernames and their IRL names.
# Multiline?
[names]
"foo" = "Mr. Foo"
# Nested comment?
"bar" = "The big Bar"
// Return value from `toml.parse`
{
  "data": { /* The normal output */ },
  "comments": {
    "names": "names contains a list of usernames and their IRL names.\\nMultiline?",
    "names.bar": "Nested comment?"
  }
}

from iarna-toml.

iarna avatar iarna commented on August 29, 2024 1

At this time, comments are not supported. The biggest limitation is just figuring out how this would be represented. It would be useful for someone interested to spend some time working up examples of how this might work... what the source object versus resulting TOML would look like, and vice-versa.

from iarna-toml.

scriptcoded avatar scriptcoded commented on August 29, 2024

@iarna What would the primary use case for comments in the output be? Just preserving them for doing machine edits of config files, or writing new comments?

from iarna-toml.

iarna avatar iarna commented on August 29, 2024

@scriptcoded Probably both, certainly if it can do the first, then the second should be straightforward.

from iarna-toml.

jjeejj avatar jjeejj commented on August 29, 2024

comment is support now?

from iarna-toml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.