Using yaml-cpp, version 0.2.5 ...
I would like to emit a blank line between entries in a list (for readability purposes). Is this possible?
I 开发者_StackOverflow社区have tried experimentation with the Verbatim, and Null manipulators, but have not had success.
As of revision 420, this is possible:
YAML::Emitter emitter;
emitter << YAML::BeginSeq;
emitter << "a" << YAML::Newline << "b" << "c";
emitter << YAML::EndSeq;
produces
---
- a
- b
- c
I decided to go with YAML::Newline
instead of YAML::Newline(n)
since I found
- I usually just wanted a single newline.
- I kept accidentally typing
YAML::Newline
, which implicitly cast the function to abool
(specifically,true
), so I figured other people would probably make the same mistake.
If you just want to patch your copy (and not sync with the trunk), use revisions 418-420. (Note: it's slightly trickier than the patch in the link you posted, since you have to be careful about a newline after an implicit key. See the comment on the (now closed) Issue 77 for more details.)
精彩评论