fix: more flexibility in Links and Contact section
Add more flexibility for the Links and Contact sections by removing the strict types and replacing them with map[string]string.
This commit is contained in:
parent
38218f5811
commit
76fbe5c704
4 changed files with 21 additions and 30 deletions
9
cv.go
9
cv.go
|
@ -4,8 +4,8 @@ type Cv struct {
|
||||||
FirstName string `json:"firstName"`
|
FirstName string `json:"firstName"`
|
||||||
LastName string `json:"lastName"`
|
LastName string `json:"lastName"`
|
||||||
JobTitle string `json:"jobTitle"`
|
JobTitle string `json:"jobTitle"`
|
||||||
Contact Contact `json:"contact"`
|
Contact map[string]string `json:"contact"`
|
||||||
Links Links `json:"links"`
|
Links map[string]string `json:"links"`
|
||||||
Summary []string `json:"summary"`
|
Summary []string `json:"summary"`
|
||||||
Skills []Skills `json:"skills"`
|
Skills []Skills `json:"skills"`
|
||||||
Employment []Experience `json:"employment"`
|
Employment []Experience `json:"employment"`
|
||||||
|
@ -19,11 +19,6 @@ type Contact struct {
|
||||||
Location string `json:"location"`
|
Location string `json:"location"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Links struct {
|
|
||||||
LinkedIn string `json:"linkedin"`
|
|
||||||
GitHub string `json:"github"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Skills struct {
|
type Skills struct {
|
||||||
Category string `json:"category"`
|
Category string `json:"category"`
|
||||||
Values []string `json:"values"`
|
Values []string `json:"values"`
|
||||||
|
|
|
@ -3,12 +3,13 @@
|
||||||
"lastName": "Smith",
|
"lastName": "Smith",
|
||||||
"jobTitle": "Software Engineer",
|
"jobTitle": "Software Engineer",
|
||||||
"contact": {
|
"contact": {
|
||||||
"email": "john.smith@example.io",
|
"Email": "john.smith@example.io",
|
||||||
"location": "England, UK"
|
"Phone": "07123 456 789",
|
||||||
|
"Location": "England, UK"
|
||||||
},
|
},
|
||||||
"links": {
|
"links": {
|
||||||
"linkedin": "https://www.linkedin.com/in/john-smith-2YASMKJMP",
|
"LinkedIn": "https://www.linkedin.com/in/john-smith-2YASMKJMP",
|
||||||
"github": "https://github.com/johnsmaith-example-gh"
|
"GitHub": "https://github.com/johnsmith-example-gh"
|
||||||
},
|
},
|
||||||
"summary": [
|
"summary": [
|
||||||
"Rem quia eveniet sit, quis asperiores ea sed repellat non molestias aut accusamus aliquid et dolorem.",
|
"Rem quia eveniet sit, quis asperiores ea sed repellat non molestias aut accusamus aliquid et dolorem.",
|
||||||
|
|
6
main.go
6
main.go
|
@ -57,12 +57,6 @@ func tex(input, tempDir string) (string, error) {
|
||||||
return "", fmt.Errorf("unable to decode JSON data; %w", err)
|
return "", fmt.Errorf("unable to decode JSON data; %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// if CV_CONTACT_PHONE is set then add it to the CV
|
|
||||||
phone := os.Getenv("CV_CONTACT_PHONE")
|
|
||||||
if len(phone) > 0 {
|
|
||||||
cv.Contact.Phone = phone
|
|
||||||
}
|
|
||||||
|
|
||||||
output := filepath.Join(tempDir, "cv.tex")
|
output := filepath.Join(tempDir, "cv.tex")
|
||||||
|
|
||||||
file, err := os.Create(output)
|
file, err := os.Create(output)
|
||||||
|
|
|
@ -5,12 +5,13 @@
|
||||||
\starttitleAndContact
|
\starttitleAndContact
|
||||||
\cvtitle{<<.FirstName>> <<.LastName>>}{<<.JobTitle>>}
|
\cvtitle{<<.FirstName>> <<.LastName>>}{<<.JobTitle>>}
|
||||||
\titleAndContact
|
\titleAndContact
|
||||||
{\bf Email:} <<.Contact.Email>>\blank[none]
|
<<range $k, $v := .Contact>>
|
||||||
<<if .Contact.Phone>>{\bf Phone:} <<.Contact.Phone>>\blank[none]<<end>>
|
{\bf <<$k>>:} <<$v>>\blank[none]
|
||||||
{\bf Location:} <<.Contact.Location>>\blank[medium]
|
<<end>>\blank[medium]
|
||||||
|
|
||||||
<<if .Links.LinkedIn>>{\bf LinkedIn:} <<.Links.LinkedIn>>\blank[none]<<end>>
|
<<range $k, $v := .Links>>
|
||||||
<<if .Links.GitHub>>{\bf GitHub:} <<.Links.GitHub>>\blank[none]<<end>>
|
{\bf <<$k>>:} <<$v>>\blank[none]
|
||||||
|
<<end>>
|
||||||
\stoptitleAndContact
|
\stoptitleAndContact
|
||||||
|
|
||||||
\section{SUMMARY}
|
\section{SUMMARY}
|
||||||
|
|
Loading…
Reference in a new issue