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:
Dan Anglin 2023-02-23 20:36:51 +00:00
parent 38218f5811
commit 76fbe5c704
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
4 changed files with 21 additions and 30 deletions

9
cv.go
View file

@ -4,8 +4,8 @@ type Cv struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
JobTitle string `json:"jobTitle"`
Contact Contact `json:"contact"`
Links Links `json:"links"`
Contact map[string]string `json:"contact"`
Links map[string]string `json:"links"`
Summary []string `json:"summary"`
Skills []Skills `json:"skills"`
Employment []Experience `json:"employment"`
@ -19,11 +19,6 @@ type Contact struct {
Location string `json:"location"`
}
type Links struct {
LinkedIn string `json:"linkedin"`
GitHub string `json:"github"`
}
type Skills struct {
Category string `json:"category"`
Values []string `json:"values"`

View file

@ -3,12 +3,13 @@
"lastName": "Smith",
"jobTitle": "Software Engineer",
"contact": {
"email": "john.smith@example.io",
"location": "England, UK"
"Email": "john.smith@example.io",
"Phone": "07123 456 789",
"Location": "England, UK"
},
"links": {
"linkedin": "https://www.linkedin.com/in/john-smith-2YASMKJMP",
"github": "https://github.com/johnsmaith-example-gh"
"LinkedIn": "https://www.linkedin.com/in/john-smith-2YASMKJMP",
"GitHub": "https://github.com/johnsmith-example-gh"
},
"summary": [
"Rem quia eveniet sit, quis asperiores ea sed repellat non molestias aut accusamus aliquid et dolorem.",

View file

@ -57,12 +57,6 @@ func tex(input, tempDir string) (string, error) {
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")
file, err := os.Create(output)

View file

@ -5,12 +5,13 @@
\starttitleAndContact
\cvtitle{<<.FirstName>> <<.LastName>>}{<<.JobTitle>>}
\titleAndContact
{\bf Email:} <<.Contact.Email>>\blank[none]
<<if .Contact.Phone>>{\bf Phone:} <<.Contact.Phone>>\blank[none]<<end>>
{\bf Location:} <<.Contact.Location>>\blank[medium]
<<range $k, $v := .Contact>>
{\bf <<$k>>:} <<$v>>\blank[none]
<<end>>\blank[medium]
<<if .Links.LinkedIn>>{\bf LinkedIn:} <<.Links.LinkedIn>>\blank[none]<<end>>
<<if .Links.GitHub>>{\bf GitHub:} <<.Links.GitHub>>\blank[none]<<end>>
<<range $k, $v := .Links>>
{\bf <<$k>>:} <<$v>>\blank[none]
<<end>>
\stoptitleAndContact
\section{SUMMARY}