re #566: fix emit regression in top level container anchors

This commit is contained in:
Joao Paulo Magalhaes
2026-01-07 09:18:33 +00:00
parent cceb52f1e9
commit 57e5affb0d
2 changed files with 2 additions and 1 deletions

View File

@@ -7,6 +7,7 @@
- The emit implementation logic was refactored, and is now significantly cleaner
- Emitted YAML will now have anchors emitted before tags, as is customary ([see example](https://play.yaml.io/main/parser?input=LSAhdGFnICZhbmNob3IgfAogIG5vdGUgaG93IHRoZSBhbmNob3IgY29tZXMKICBmaXJzdCBpbiB0aGUgZXZlbnRz)).
- Added `ParserOptions` defaulted argument to temp-parser overloads of `parse_{yaml,json}_in_{place,arena}()`
- [PR#567](https://github.com/biojppm/rapidyaml/pull/567) (fixes [#566](https://github.com/biojppm/rapidyaml/issues/566)) fixes a regression from this refactor where top-level container anchors were wrongly emitted in the same line if no style was set on the container.
### API changes

View File

@@ -314,7 +314,7 @@ void Emitter<Writer>::_top_open_entry(id_type node)
else
{
_RYML_ASSERT_VISIT_(m_tree->callbacks(), ty.is_container(), m_tree, node);
if(ty.is_block())
if(!ty.is_flow())
_pend_newl();
}
}