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)
|
fileContent := string(fileBytes)
|
||||||
|
|
||||||
fieldPatterns := map[string]string{
|
fieldPatterns := map[string]string{
|
||||||
"progress": `(?m)^progress: "(.*)%"$`,
|
"progress": `(?m)^progress: (.*)%$`,
|
||||||
"episode": `(?m)^episode: "(.*)"$`,
|
"episode": `(?m)^episode: (.*)$`,
|
||||||
"date": `(?m)^date: (.*)$`,
|
"date": `(?m)^date: (.*)$`,
|
||||||
"rate": `(?m)^rate: (\d+\.?\d*)$`,
|
"rate": `(?m)^rate: (\d+\.?\d*)$`,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fields replacement
|
// Fields replacement
|
||||||
fileContent = updateFieldInFrontmatter(fileContent, "progress", fmt.Sprintf("\"%s\"", frontmatter.Progress), fieldPatterns["progress"])
|
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, "episode", fmt.Sprintf("%s", frontmatter.Episode), fieldPatterns["episode"])
|
||||||
fileContent = updateFieldInFrontmatter(fileContent, "date", fmt.Sprintf("\"%s\"", frontmatter.Date), fieldPatterns["date"])
|
fileContent = updateFieldInFrontmatter(fileContent, "date", fmt.Sprintf("%s", frontmatter.Date), fieldPatterns["date"])
|
||||||
fileContent = updateFieldInFrontmatterFloat(fileContent, "rate", frontmatter.Rate, fieldPatterns["rate"])
|
fileContent = updateFieldInFrontmatterFloat(fileContent, "rate", frontmatter.Rate, fieldPatterns["rate"])
|
||||||
|
|
||||||
// Write the updated content back to the file
|
// Write the updated content back to the file
|
||||||
|
Loading…
Reference in New Issue
Block a user