Fixes quotes in progress and episode fields
This commit is contained in:
parent
9ba5647ddc
commit
bd4b1c3059
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user