From fe6d2e852a83e67338e76dc486ea3bd22032bd3e Mon Sep 17 00:00:00 2001 From: Dave Glick Date: Tue, 24 Jan 2023 12:13:16 -0500 Subject: [PATCH] Fixed a bug in `ExtractFrontMatter` to ensure front matter is extracted on the last line of a file --- RELEASE.md | 5 +++++ src/Statiq.Web/Bootstrapper/BootstrapperExtensions.cs | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index e0f0012b..4bef5433 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,8 @@ +# 1.0.0-beta.54 + +- Fixed a bug in front matter regular expressions to ensure front matter is extracted when the delimiter is on the last line of the file. +- Updated Statiq Framework reference to version [1.0.0-beta.66](https://github.com/statiqdev/Statiq.Framework/releases/tag/v1.0.0-beta.66). + # 1.0.0-beta.53 - Added a new `AdditionalInputFiles` setting that can be used to explicitly include input files that would otherwise be excluded by the `InputFiles` setting such as underscore files. diff --git a/src/Statiq.Web/Bootstrapper/BootstrapperExtensions.cs b/src/Statiq.Web/Bootstrapper/BootstrapperExtensions.cs index 1d01aedc..8ce0d42d 100644 --- a/src/Statiq.Web/Bootstrapper/BootstrapperExtensions.cs +++ b/src/Statiq.Web/Bootstrapper/BootstrapperExtensions.cs @@ -179,9 +179,9 @@ private static TBootstrapper AddDefaultWebSettings(this TBootstra WebKeys.FrontMatterRegexes, new string[] { - @"\A(?:^\r*/\*-+[^\S\n]*$\r?\n)(.*?)(?:^\r*-+\*/[^\S\n]*$\r?\n)", // C-style: /*- ... -*/ - @"\A(?:^\r*[^\S\n]*$\r?\n)", // HTML-style: - @"\A(?:^\r*@\*-+[^\S\n]*$\r?\n)(.*?)(?:^\r*-+\*@[^\S\n]*$\r?\n)", // Razor-style: @*- ... -*@ + @"\A(?:^\r*/\*-+[^\S\n]*$\r?\n)(.*?)(?:^\r*-+\*/[^\S\n]*$(\r?\n)?)", // C-style: /*- ... -*/ + @"\A(?:^\r*[^\S\n]*$(\r?\n)?)", // HTML-style: + @"\A(?:^\r*@\*-+[^\S\n]*$\r?\n)(.*?)(?:^\r*-+\*@[^\S\n]*$(\r?\n)?)", // Razor-style: @*- ... -*@ ExtractFrontMatter.GetDelimiterRegex("-", true), // Jekyll-style: --- ... ---, comes last since it's more general and doesn't require a start delimiter } }