Fixed anchor/tag in seq > map

This commit is contained in:
Jesse Beder
2012-05-21 23:23:53 -05:00
parent 3cae26a75e
commit b0dd0f862a
2 changed files with 7 additions and 2 deletions

View File

@@ -337,6 +337,8 @@ namespace YAML
m_stream << "\n"; m_stream << "\n";
break; break;
case EmitterNodeType::BlockMap: case EmitterNodeType::BlockMap:
if(m_pState->HasBegunNode())
m_stream << "\n";
break; break;
} }
} }

View File

@@ -4,13 +4,16 @@
int main() int main()
{ {
YAML::Emitter out; YAML::Emitter out;
out << YAML::Anchor("monkey"); out << YAML::Anchor("monkey") << YAML::LocalTag("a");
out << YAML::BeginSeq; out << YAML::BeginSeq;
out << "foo"; out << "foo";
out << YAML::LocalTag("hi") << "bar"; out << YAML::LocalTag("hi") << "bar";
out << YAML::BeginMap; out << YAML::Anchor("asdf") << YAML::BeginMap;
out << "a" << "b" << "c" << "d"; out << "a" << "b" << "c" << "d";
out << YAML::EndMap; out << YAML::EndMap;
out << YAML::LocalTag("hi") << YAML::BeginSeq;
out << "a" << "b";
out << YAML::EndSeq;
out << YAML::EndSeq; out << YAML::EndSeq;
std::cout << out.c_str() << "\n"; std::cout << out.c_str() << "\n";