Giter Club home page Giter Club logo

anymarkup's People

Contributors

bkabrda avatar nightwatchcyber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

anymarkup's Issues

PyPI package doesn't include test/__init__.py

When I download the tarball on PyPI, the tests won't run:

test/test_parse.py:13: in <module>
    class TestParse(object):
test/test_parse.py:34: in TestParse
    (example_ini, example_as_dict),
E   NameError: name 'example_ini' is not defined

RFE: HCL Support

Hashicorp developed HCL as an alternative to JSON and YAML and allows its use with some of their tools. As some of our tools use anymarkup and interact with some Hashicorp tools, I would like anymarkup to support HCL.

When force_types=None used, strings with numeric values are changed to ints

IIUC this code should provide basically the same input regarding value types.

import anymarkup

data = anymarkup.parse_file("file.json", force_types=None)
anymarkup.serialize_file(data, "output.json")

But if you feed this file into it:
http://pastebin.centos.org/27686/
you'll get this:
http://pastebin.centos.org/27691/

The change can be seen in env object:

"env":[
                { "name": "SERVER_ID", "value": "1" }
              ],

which changes to

"env": [
                {
                  "name": "SERVER_ID",
                  "value": 1
                }
              ],

Which then fails to load by openshift/kubernetes parser as it expects value to be a string. I tried to do the same with plain json.load/json.dump and it preserves types correctly.

Long key names result in odd line wrapping behavior when serializing to yaml

This might be part of the yaml spec, I am not sure. When I have a long key name it can end up wrapping like so:

- ? Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod 
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, 
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  : 

Is there any way to keep that as a single line with standard formatting?

Also, is it possible to select the alternate list format?

Currently, A list will serialize into the format:

attributes:
  - itemA
  - itemB
  - itemC

I would like to be able to have it output in the format:

attributes: [itemA, itemB, itemC]

if possible.

Another weird case:
If my key in python is "3'b000 : 0", in the yaml serial it is '3''b000 : 0':The single quoting seems to be a bit odd to me. I am not sure if this is valid or not.

Able to detect what format?

Is there a function / command to be able to actually detect what format the file is in?

Ex.

print anymarkup.format(content)
"json"

EDIT: Just found _guess_fmt_from_bytes ๐Ÿ’ƒ nvm!

Consider tomlkit to support TOML markup

Description

Hi there, first of all thanks much for anymarkup. It's a great module and I'm using it for quite some time in the KIWI
appliance builder project. Recently there was the request to also support the TOML markup for describing an image description. I added a pull request to support this using anymarkup and its toml backend. You can see the open PR here:

As you can see it would add a new python module dependency to the toml module because that's how anymarkup
implements support for it. It all works nicely but a review comment was made stating that support for TOML has been
split into tomllib in the Python 3.11+ standard library for reading, and tomlib-w for writing.

From that perspective I'd like to ask if you would consider to support the new tomllib implementation as
alternative backend to support TOML with python 3.11+ ?

For us from the KIWI side this would be great as we don't need to add a dependency to the old toml module
and benefit from features of the new tomllib e.g style and comment preserving

Thanks much

Idea: Provide a command line tool

First of all, i don't need this, I'm just proposing this on the "nice to have" level.
I think it could help anymarkup to gain more glory.

The ultimate /usr/bin/anymarkup

Reads from stdin or file, outputs to stdout or file. Has --from and --to optional format switches, guesses the format otherwise based on file extension and/or provided content. (Actually when writing to stdout, --to needs to be mandatory).

All the logic is already there, all this needs is a nice entry point and click.

Imagine the glory of this tool, you could do:

curl http://fedora.portingdb.xyz/stats.json | anymarkup --to yaml | anymarkup --to json

I might provide pull request if you approve the idea.

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.