-
Notifications
You must be signed in to change notification settings - Fork 5
Description
yaml example:
'# comment' + sLineBreak +
'name: John Doe' + sLineBreak +
'age: 30'
after loading this document and writing it back - comment is gone
As far as I can see in the following code, this is intended behavior:
`
procedure TYAMLParser.AssignPendingCommentsToCollection(const collection : IYAMLCollection);
var
index : integer;
begin
// Skip assignment if this is the document-level root collection
// Document-level comments should go to the first content structure, not the root container
if FIsDocumentLevel and (collection.Parent = nil) then
Exit;
if FPendingComments.Count > 0 then
begin
for index := 0 to FPendingComments.Count - 1 do
collection.AddComment(FPendingComments[index]);
FPendingComments.Clear;
FIsDocumentLevel := False; // No longer at document level once we've assigned comments
end;
end;
But at the same time I can can create a new document and write:
doc.AsMapping.AddComment('comment');
`
In this case comment will appear at first line after writeToString.