feat: write company, role, fit, verdict, location and posting as note properties
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
@@ -43,11 +44,22 @@ func bullets(b *strings.Builder, heading string, items []string) {
|
||||
b.WriteString("\n")
|
||||
}
|
||||
|
||||
// renderNote writes the package as a vault note: small frontmatter, plain
|
||||
// title, a Related section at the end.
|
||||
// yamlString quotes a value for the frontmatter. A JSON string is also a
|
||||
// valid YAML double-quoted string, whatever the posting put in it.
|
||||
func yamlString(s string) string {
|
||||
b, _ := json.Marshal(strings.Join(strings.Fields(s), " "))
|
||||
return string(b)
|
||||
}
|
||||
|
||||
// renderNote writes the package as a vault note: frontmatter, plain title, a
|
||||
// Related section at the end. The properties after `created` are the columns
|
||||
// of the vault's "Job Hunt" base (the table of all postings).
|
||||
func renderNote(pkg *Package, url string, now time.Time) string {
|
||||
var b strings.Builder
|
||||
fmt.Fprintf(&b, "---\nmoc: \"[[00-Job Hunt]]\"\ncreated: %s\n---\n\n", now.Format("2006-01-02"))
|
||||
fmt.Fprintf(&b, "---\nmoc: \"[[00-Job Hunt]]\"\ncreated: %s\n", now.Format("2006-01-02"))
|
||||
fmt.Fprintf(&b, "company: %s\nrole: %s\nfit: %d\nverdict: %s\nlocation: %s\nposting: %s\n---\n\n",
|
||||
yamlString(pkg.Company), yamlString(pkg.Title), pkg.FitScore, yamlString(strings.ToLower(pkg.Verdict)),
|
||||
yamlString(pkg.Location), yamlString(url))
|
||||
fmt.Fprintf(&b, "# %s\n\n", noteName(pkg))
|
||||
fmt.Fprintf(&b, "- [ ] Review and decide: **%s**, fit %d/100\n\n", strings.ToLower(pkg.Verdict), pkg.FitScore)
|
||||
if pkg.VerdictReason != "" {
|
||||
|
||||
Reference in New Issue
Block a user