diff --git a/cli/resume.go b/cli/resume.go index 656b697..e214e88 100644 --- a/cli/resume.go +++ b/cli/resume.go @@ -34,9 +34,7 @@ import ( "jsonresume/model" "jsonresume/themes" _ "jsonresume/themes/kendall" - _ "jsonresume/themes/kendallfr" _ "jsonresume/themes/stackoverflow" - _ "jsonresume/themes/stackoverflowfr" ) func main() { @@ -45,6 +43,7 @@ func main() { var theme string var err error var outf string + var lang string var f *os.File flag.StringVar(&resume, "resume", "resume.json", "JSON of resume") @@ -53,6 +52,8 @@ func main() { flag.StringVar(&theme, "t", "", "Theme of resume") flag.StringVar(&outf, "out", "-", "Output file") flag.StringVar(&outf, "o", "-", "Output file") + flag.StringVar(&lang, "lang", "", "Force lang") + flag.StringVar(&lang, "l", "", "Force lang") flag.Parse() if outf == "-" { @@ -65,6 +66,9 @@ func main() { if r, err = model.Parse(resume); err != nil { log.Fatal(err) } + if lang != "" { + r.Language = lang + } if t, exists := themes.Themes[theme]; exists { if err = t.Render(r, f); err != nil { diff --git a/model/json.go b/model/json.go index 0f21cd5..1661b0d 100644 --- a/model/json.go +++ b/model/json.go @@ -51,6 +51,7 @@ func (ct *ResumeDate) UnmarshalJSON(b []byte) (err error) { // Resume represent Curriculum Vitae type Resume struct { Title string `json:"title"` + Language string `json:"lang"` Basic Basic `json:"basics"` Work []Work `json:"work"` Volunteer []Volunteer `json:"volunteer"` @@ -66,19 +67,19 @@ type Resume struct { // Basic is the basic information for a resume type Basic struct { - Name string `json:"name"` - Label string `json:"label"` - Image string `json:"image"` - Email string `json:"email"` - Phone string `json:"phone"` - URL string `json:"url"` - Summary string `json:"summary"` - ResumeLocation Location `json:"location"` - Profiles []SocialProfile `json:"profiles"` + Name string `json:"name"` + Label string `json:"label"` + Image string `json:"image"` + Email string `json:"email"` + Phone string `json:"phone"` + URL string `json:"url"` + Summary string `json:"summary"` + Location UserLocation `json:"location"` + Profiles []SocialProfile `json:"profiles"` } // Location is the location details of a resume owner. -type Location struct { +type UserLocation struct { Address string `json:"address"` PostalCode string `json:"postalCode"` City string `json:"city"` @@ -93,35 +94,35 @@ type SocialProfile struct { URL string `json:"url"` } -type JobHighlight struct { +type Highlight struct { Title string `json:"title"` Items []string `json:"items"` } // Work is the work details of the resume owner. type Work struct { - Name string `json:"name"` - WorkLocation string `json:"location"` - Description string `json:"description"` - Position string `json:"position"` - URL string `json:"url"` - StartDate ResumeDate `json:"startDate"` - EndDate ResumeDate `json:"endDate"` - Summary string `json:"summary"` - Highlights []JobHighlight `json:"highlights"` - Keywords []string `json:"keywords"` + Name string `json:"name"` + Location string `json:"location"` + Description string `json:"description"` + Position string `json:"position"` + URL string `json:"url"` + StartDate ResumeDate `json:"startDate"` + EndDate ResumeDate `json:"endDate"` + Summary string `json:"summary"` + Highlights []Highlight `json:"highlights"` + Keywords []string `json:"keywords"` } // Volunteer is the volunteer details of the resume owner. type Volunteer struct { - Organization string `json:"organization"` - Position string `json:"position"` - URL string `json:"url"` - StartDate ResumeDate `json:"startDate"` - EndDate ResumeDate `json:"endDate"` - Summary string `json:"summary"` - Highlights []string `json:"highlights"` - Keywords []string `json:"keywords"` + Organization string `json:"organization"` + Position string `json:"position"` + URL string `json:"url"` + StartDate ResumeDate `json:"startDate"` + EndDate ResumeDate `json:"endDate"` + Summary string `json:"summary"` + Highlights []Highlight `json:"highlights"` + Keywords []string `json:"keywords"` } // Education is the education details of the resume owner. @@ -179,16 +180,16 @@ type Reference struct { // Volunteer is the volunteer details of the resume owner. type Project struct { - Name string `json:"name"` - Description string `json:"description"` - Highlights []string `json:"highlights"` - Keywords []string `json:"keywords"` - StartDate ResumeDate `json:"startDate"` - EndDate ResumeDate `json:"endDate"` - URL string `json:"url"` - Roles []string `json:"roles"` - Entity string `json:"entity"` - Type string `json:"type"` + Name string `json:"name"` + Description string `json:"description"` + Highlights []Highlight `json:"highlights"` + Keywords []string `json:"keywords"` + StartDate ResumeDate `json:"startDate"` + EndDate ResumeDate `json:"endDate"` + URL string `json:"url"` + Roles []string `json:"roles"` + Entity string `json:"entity"` + Type string `json:"type"` } func Parse(f string) (*Resume, error) { diff --git a/themes/kendall/kendall.go b/themes/kendall/kendall.go index ba5b8a5..77459c0 100644 --- a/themes/kendall/kendall.go +++ b/themes/kendall/kendall.go @@ -26,7 +26,6 @@ package kendall import ( - "io/ioutil" "jsonresume/themes" "path" "text/template" @@ -43,25 +42,23 @@ var Theme = themes.Theme{ Name: "kendall", Directory: packageDirectory, Functions: template.FuncMap{ - "iconClass": themes.IconClass, - "formatDateWork": themes.FormatDateWork, - "formatDateEdu": themes.FormatDateEdu, - "formatDatePub": themes.FormatDatePub, - "css": getCSS, - "printcss": getPrintCSS, + "css": getCSS, + "printcss": getPrintCSS, }, - Template: fileTemplate, } func init() { + t, _ := Asset(path.Join(packageDirectory, fileTemplate)) + Theme.Template = string(t) (&Theme).Register() } + func getCSS() string { - r, _ := ioutil.ReadFile(path.Join(packageDirectory, fileCSS)) + r, _ := Asset(path.Join(packageDirectory, fileCSS)) return string(r) } func getPrintCSS() string { - r, _ := ioutil.ReadFile(path.Join(packageDirectory, fileCSSPrint)) + r, _ := Asset(path.Join(packageDirectory, fileCSSPrint)) return string(r) } diff --git a/themes/kendall/resume.template b/themes/kendall/resume.template index 5e1b272..1be4a9b 100644 --- a/themes/kendall/resume.template +++ b/themes/kendall/resume.template @@ -1,10 +1,10 @@ - + - Resume of {{.Basic.Name}} + {{.Lang.TitlePrefix}} {{.Basic.Name}} @@ -32,14 +32,14 @@ {{if .Basic.Summary -}}
-

About

+

{{.Lang.About}}

{{.Basic.Summary}}

{{- end}} {{if .Work -}}
-

Work Experience

+

{{.Lang.WorkExperience}}

{{range .Work -}}
@@ -50,7 +50,7 @@ {{.URL}}
{{- end}} -
{{formatDateWork .StartDate}} – {{formatDateWork .EndDate}}
+
{{formatDateMY .StartDate}} – {{formatDateMY .EndDate}}
@@ -83,11 +83,11 @@ {{if .Awards -}}
-

Awards

+

{{.Lang.Awards}}