majintao0131 / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

No automatic newline after initial comment #107

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
By using the following code:

    YAML::Emitter out;
    out << YAML::Comment("A comment describing the purpose of the file.");
    out << YAML::BeginMap;
    out << YAML::Key << "key1" << YAML::Value << "value1";
    out << YAML::Comment("First comment");
    out << YAML::Key << "key2" << YAML::Value << "value2";
    out << YAML::Comment("Second comment");
    out << YAML::EndMap;

What is the expected output? What do you see instead?
The result is:

  # A comment describing the purpose of the file.key1: value1  # First comment
key2: value2  # Second comment

The first key of the map gets written along with the initial comment.
It should instead get written to the next line.

What version of the product are you using? On what operating system?

I am using the latest 0.2.6 on Archlinux.

Please provide any additional information below.

I can get around this by using a YAML::Newline, but this sounds like a bug ;)

Original issue reported on code.google.com by zorun...@gmail.com on 30 May 2011 at 1:39

GoogleCodeExporter commented 9 years ago
Thanks, I must have missed the email about this case. Fixed, r488.

Original comment by jbe...@gmail.com on 4 Aug 2011 at 9:50