Skip to content

Commit

Permalink
Merge pull request #56 from ysim/update-default-new-recipe-template
Browse files Browse the repository at this point in the history
Update default new recipe template
  • Loading branch information
ysim committed Apr 14, 2022
2 parents d8a1a13 + 3c4d206 commit 8088b61
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ concoct

*.tar.gz

vendor/
release/
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v0.5.0 (xxxx-xx-xx)

* Update default new recipe template to have source field in the front matter. (#50)

v0.4.0 (2022-04-11)

* Improve error handling for front matter parsing. (#47)
Expand Down
19 changes: 10 additions & 9 deletions create.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@ package main

import (
"fmt"
log "github.com/sirupsen/logrus"
"os"
"strings"
"text/template"

log "github.com/sirupsen/logrus"
)

const (
keyValueDelimiter = "="
openBracket = "["
closeBracket = "]"
newRecipeTemplate = "---\nname: {{.Name}}{{range .Fields}}\n{{.Key}}: {{.Value}}{{end}}\n---\n# {{.Name}}\n\n## INGREDIENTS\n\n## INSTRUCTIONS\n\n---\nSource:\n"
openBracket = "["
closeBracket = "]"
newRecipeTemplate = "---\nname: {{.Name}}{{range .Fields}}\n{{.Key}}: {{.Value}}{{end}}\nsource: [\"\"]\n---\n# {{.Name}}\n\n## INGREDIENTS\n\n## INSTRUCTIONS\n"
)

type RecipeField struct {
Key string
Value string
Key string
Value string
}

type RecipeSkeleton struct {
Name string
Fields []RecipeField
Name string
Fields []RecipeField
}

func validateFieldValue(value string) string {
Expand Down Expand Up @@ -84,7 +85,7 @@ func writeNewRecipeFile(filepath string, name string, fields map[string]interfac
}

recipeVariables := RecipeSkeleton{
Name: name,
Name: name,
Fields: recipeFields,
}

Expand Down

0 comments on commit 8088b61

Please sign in to comment.