yaml-rust
yaml-rust copied to clipboard
provide a way to customize the output of the emitter
currently all yaml strings are being emitted regardless of whether they are actually needed or not. typically you don't need them in yaml. it would be useful to have a way to customize the behavior or to just opt not to quote things by default.
Yeah, the emitter is not polished yet, I just quote every string to make it safely emit valid YAML document (but may not human friendly). PR regarding the emitter is welcome.
Thanks @chyh1990. Maybe I'll try to see what I I do myself. You're library has been working great so far
I think we can close this issue since pull request #39 has been merged.
I think that pull helps with what I wanted out of this issue. There are actually many flavors of string quoting styles defined in the yaml spec that would probably be nice to have in this library. Maybe a separate issue to outline those could be opened in favor of this.
Would this also have scope for customizing things other than strings? For example there are situations where using single-line {}
or []
constructs for small structures would drastically reduce the size of some of my YAML payloads.
@radix there already is emit_node_compact()
, even though this is not public yet. It is currently only used for keys in Yaml::Hash
. Perhaps you could come up with a nice API to use this one instead.
Just bumping, would be great to have the option to force adding quotes for strings