diff --git a/themes/kendall/kendall.go b/themes/kendall/kendall.go
index 7b25853..f0b976b 100644
--- a/themes/kendall/kendall.go
+++ b/themes/kendall/kendall.go
@@ -27,26 +27,48 @@ package kendall
import (
"fmt"
+ "io/ioutil"
"jsonresume/model"
"jsonresume/themes"
+ "path"
"strings"
"text/template"
)
+const (
+ packageDirectory = "themes/kendall"
+ fileCSS = "style.css"
+ fileCSSPrint = "print.css"
+ fileTemplate = "resume.template"
+)
+
var Theme = themes.Theme{
- Name: "kendall",
+ Name: "kendall",
+ Directory: packageDirectory,
Functions: template.FuncMap{
"iconClass": iconClass,
"formatDateWork": formatDateWork,
"formatDateEdu": formatDateEdu,
"formatDatePub": formatDatePub,
+ "css": getCSS,
+ "printcss": getPrintCSS,
},
- Template: "themes/kendall/resume.template",
+ Template: fileTemplate,
}
func init() {
(&Theme).Register()
}
+func getCSS() string {
+ r, _ := ioutil.ReadFile(path.Join(packageDirectory, fileCSS))
+ return string(r)
+}
+
+func getPrintCSS() string {
+ r, _ := ioutil.ReadFile(path.Join(packageDirectory, fileCSSPrint))
+ return string(r)
+}
+
func iconClass(network string) string {
network = strings.ToLower(network)
switch network {
diff --git a/themes/kendall/resume.template b/themes/kendall/resume.template
index 8ba7b81..7f5fa4d 100644
--- a/themes/kendall/resume.template
+++ b/themes/kendall/resume.template
@@ -8,8 +8,8 @@
Resume of {{.Basic.Name}}
-
-
+
+
@@ -21,9 +21,9 @@
- {{end -}}
-
@@ -36,7 +36,7 @@
About
{{.Basic.Summary}}
- {{end -}}
+ {{- end}}
{{if .Work -}}
@@ -50,7 +50,7 @@
- {{end -}}
+ {{- end}}
{{formatDateWork .StartDate}} – {{formatDateWork .EndDate}}
@@ -64,16 +64,16 @@
{{range .Highlights -}}
- {{.}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
{{if .Awards -}}
@@ -88,10 +88,10 @@
{{.Summary}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
{{if .Volunteer -}}
@@ -105,7 +105,7 @@
- {{end -}}
+ {{- end}}
{{formatDateWork .StartDate}} – {{formatDateWork .EndDate}}
@@ -119,16 +119,16 @@
{{range .Highlights -}}
- {{.}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
@@ -137,35 +137,35 @@
{{if .Basic.ResumeLocation.City -}}
- {{end -}}
+ {{- end}}
{{if .Basic.Phone -}}
- {{end -}}
+ {{- end}}
{{if .Basic.Email -}}
- {{end -}}
+ {{- end}}
{{if .Basic.URL -}}
- {{end -}}
+ {{- end}}
{{range .Basic.Profiles -}}
- {{end -}}
+ {{- end}}
{{if .Education -}}
@@ -183,21 +183,21 @@
GPA: {{.GPA}}
- {{end -}}
+ {{- end}}
{{if .Courses -}}
Courses
{{range .Courses -}}
- {{.}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
{{if .Skills -}}
@@ -206,17 +206,17 @@
{{.Name}}
- {{if .Level}}{{.Level}}{{end -}}
+ {{if .Level}}{{.Level}}{{- end}}
{{range .Keywords -}}
{{.}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
{{if .Publications -}}
@@ -229,21 +229,21 @@
{{if .Publisher -}}
{{.Publisher}}
- {{end -}}
+ {{- end}}
{{formatDatePub .ReleaseDate}}
{{if .URL -}}
- {{end -}}
+ {{- end}}
{{if .Summary -}}
{{.Summary}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
{{if .Languages -}}
@@ -251,10 +251,10 @@
{{range .Languages -}}
- {{.Language}}{{.Fluency}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
{{if .Interests -}}
@@ -267,12 +267,12 @@
{{range .Keywords -}}
{{.}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
{{if .References -}}
References
@@ -281,9 +281,9 @@
{{.Reference}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
diff --git a/themes/kendallfr/kendallfr.go b/themes/kendallfr/kendallfr.go
index 114bd5f..4158fdb 100644
--- a/themes/kendallfr/kendallfr.go
+++ b/themes/kendallfr/kendallfr.go
@@ -27,21 +27,43 @@ package kendallfr
import (
"fmt"
+ "io/ioutil"
"jsonresume/model"
"jsonresume/themes"
+ "path"
"strings"
"text/template"
)
+const (
+ packageDirectory = "themes/kendallfr"
+ fileCSS = "style.css"
+ fileCSSPrint = "print.css"
+ fileTemplate = "resume.template"
+)
+
var Theme = themes.Theme{
- Name: "kendallfr",
+ Name: "kendallfr",
+ Directory: packageDirectory,
Functions: template.FuncMap{
"iconClass": iconClass,
"formatDateWork": formatDateWork,
"formatDateEdu": formatDateEdu,
"formatDatePub": formatDatePub,
+ "css": getCSS,
+ "printcss": getPrintCSS,
},
- Template: "themes/kendallfr/resume.template",
+ Template: fileTemplate,
+}
+
+func getCSS() string {
+ r, _ := ioutil.ReadFile(path.Join(packageDirectory, fileCSS))
+ return string(r)
+}
+
+func getPrintCSS() string {
+ r, _ := ioutil.ReadFile(path.Join(packageDirectory, fileCSSPrint))
+ return string(r)
}
func init() {
diff --git a/themes/kendallfr/resume.template b/themes/kendallfr/resume.template
index 8dad9f3..fde864a 100644
--- a/themes/kendallfr/resume.template
+++ b/themes/kendallfr/resume.template
@@ -8,8 +8,8 @@
CV de {{.Basic.Name}}
-
-
+
+
@@ -21,9 +21,9 @@
- {{end -}}
-
@@ -36,7 +36,7 @@
À propos
{{.Basic.Summary}}
- {{end -}}
+ {{- end}}
{{if .Work -}}
@@ -50,7 +50,7 @@
- {{end -}}
+ {{- end}}
{{formatDateWork .StartDate}} – {{formatDateWork .EndDate}}
@@ -64,16 +64,16 @@
{{range .Highlights -}}
- {{.}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
{{if .Awards -}}
@@ -88,10 +88,10 @@
{{.Summary}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
{{if .Volunteer -}}
@@ -105,7 +105,7 @@
- {{end -}}
+ {{- end}}
{{formatDateWork .StartDate}} – {{formatDateWork .EndDate}}
@@ -119,16 +119,16 @@
{{range .Highlights -}}
- {{.}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
@@ -137,35 +137,35 @@
{{if .Basic.ResumeLocation.City -}}
- {{end -}}
+ {{- end}}
{{if .Basic.Phone -}}
- {{end -}}
+ {{- end}}
{{if .Basic.Email -}}
- {{end -}}
+ {{- end}}
{{if .Basic.URL -}}
- {{end -}}
+ {{- end}}
{{range .Basic.Profiles -}}
- {{end -}}
+ {{- end}}
{{if .Education -}}
@@ -183,21 +183,21 @@
GPA: {{.GPA}}
- {{end -}}
+ {{- end}}
{{if .Courses -}}
Courses
{{range .Courses -}}
- {{.}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
{{if .Skills -}}
@@ -206,17 +206,17 @@
{{.Name}}
- {{if .Level}}{{.Level}}{{end -}}
+ {{if .Level}}{{.Level}}{{- end}}
{{range .Keywords -}}
{{.}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
{{if .Publications -}}
@@ -229,21 +229,21 @@
{{if .Publisher -}}
{{.Publisher}}
- {{end -}}
+ {{- end}}
{{formatDatePub .ReleaseDate}}
{{if .URL -}}
- {{end -}}
+ {{- end}}
{{if .Summary -}}
{{.Summary}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
{{if .Languages -}}
@@ -251,10 +251,10 @@
{{range .Languages -}}
- {{.Language}}{{.Fluency}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
{{if .Interests -}}
@@ -267,12 +267,12 @@
{{range .Keywords -}}
{{.}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
{{if .References -}}
Références
@@ -281,9 +281,9 @@
{{.Reference}}
- {{end -}}
+ {{- end}}
- {{end -}}
+ {{- end}}
diff --git a/themes/theme.go b/themes/theme.go
index f3344c5..f3d66b9 100644
--- a/themes/theme.go
+++ b/themes/theme.go
@@ -35,6 +35,7 @@ import (
type Theme struct {
Name string
+ Directory string
Functions template.FuncMap
Template string
}
@@ -46,7 +47,7 @@ func init() {
}
func (t *Theme) Render(r *model.Resume, w io.Writer) error {
- tmpl := template.Must(template.New(path.Base(t.Template)).Funcs(t.Functions).ParseFiles(t.Template))
+ tmpl := template.Must(template.New(t.Template).Funcs(t.Functions).ParseFiles(path.Join(t.Directory, t.Template)))
return tmpl.Execute(w, r)
}