Fix SerializeTo not quoting scalar values

This commit is contained in:
kayomn 2023-07-06 00:54:36 +01:00
parent 174313fe12
commit c4bd735e59
1 changed files with 4 additions and 1 deletions

View File

@ -360,12 +360,15 @@ void Lml::Document::SerializeTo(std::string & string, size_t indentation) const
if (!scalar.empty()) if (!scalar.empty())
{ {
string.push_back('"');
string.append(scalar[0]); string.append(scalar[0]);
string.push_back('"');
for (std::string const & scalarString : std::span<std::string const>{scalar.begin() + 1, scalar.end()}) for (std::string const & scalarString : std::span<std::string const>{scalar.begin() + 1, scalar.end()})
{ {
string.append(", "); string.append(", \"");
string.append(scalarString); string.append(scalarString);
string.push_back('"');
} }
} }