From bd4b1c30591beadf01f4394bf6ab191e5f0f419e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=81scar=20M=2E=20Lage?= Date: Thu, 12 Dec 2024 13:19:38 +0100 Subject: [PATCH] Fixes quotes in progress and episode fields --- utils/markdown.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils/markdown.go b/utils/markdown.go index 7d3a40f..a6cd671 100644 --- a/utils/markdown.go +++ b/utils/markdown.go @@ -106,16 +106,16 @@ func SaveUpdatedMarkdown(filepath string, frontmatter FrontMatter, content strin fileContent := string(fileBytes) fieldPatterns := map[string]string{ - "progress": `(?m)^progress: "(.*)%"$`, - "episode": `(?m)^episode: "(.*)"$`, + "progress": `(?m)^progress: (.*)%$`, + "episode": `(?m)^episode: (.*)$`, "date": `(?m)^date: (.*)$`, "rate": `(?m)^rate: (\d+\.?\d*)$`, } // Fields replacement - fileContent = updateFieldInFrontmatter(fileContent, "progress", fmt.Sprintf("\"%s\"", frontmatter.Progress), fieldPatterns["progress"]) - fileContent = updateFieldInFrontmatter(fileContent, "episode", fmt.Sprintf("\"%s\"", frontmatter.Episode), fieldPatterns["episode"]) - fileContent = updateFieldInFrontmatter(fileContent, "date", fmt.Sprintf("\"%s\"", frontmatter.Date), fieldPatterns["date"]) + fileContent = updateFieldInFrontmatter(fileContent, "progress", fmt.Sprintf("%s", frontmatter.Progress), fieldPatterns["progress"]) + fileContent = updateFieldInFrontmatter(fileContent, "episode", fmt.Sprintf("%s", frontmatter.Episode), fieldPatterns["episode"]) + fileContent = updateFieldInFrontmatter(fileContent, "date", fmt.Sprintf("%s", frontmatter.Date), fieldPatterns["date"]) fileContent = updateFieldInFrontmatterFloat(fileContent, "rate", frontmatter.Rate, fieldPatterns["rate"]) // Write the updated content back to the file