yaml-rust icon indicating copy to clipboard operation
yaml-rust copied to clipboard

provide a way to customize the output of the emitter

Open softprops opened this issue 8 years ago • 8 comments

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.

softprops avatar Jun 26 '16 16:06 softprops

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.

chyh1990 avatar Jun 27 '16 05:06 chyh1990

Thanks @chyh1990. Maybe I'll try to see what I I do myself. You're library has been working great so far

softprops avatar Jun 27 '16 12:06 softprops

I think we can close this issue since pull request #39 has been merged.

antoyo avatar Nov 06 '16 22:11 antoyo

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.

softprops avatar Nov 06 '16 23:11 softprops

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 avatar May 30 '17 16:05 radix

@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.

hoodie avatar May 30 '17 17:05 hoodie

Just bumping, would be great to have the option to force adding quotes for strings

Sytten avatar Mar 01 '22 18:03 Sytten