ssg: StaticSitePostFrontMatter: fix serialization

This commit is contained in:
Nick Vella 2019-07-13 21:43:25 +10:00
parent d650f0d890
commit 79b801708e
1 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using YamlDotNet.RepresentationModel;
@ -44,7 +45,11 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
root.Add(frontMatterKeys.TagsKey, new YamlSequenceNode(Tags.Select(
tag => new YamlScalarNode(tag))));
return root.ToString();
var stream = new YamlStream(new YamlDocument(root));
var stringWriter = new StringWriter();
stream.Save(stringWriter);
// Trim off end-of-doc
return new Regex("\\.\\.\\.\r\n$").Replace(stringWriter.ToString(), "", 1);
}
public void Deserialize(string yaml)