From 9c0cded9e328ba1c44b745655082d4e78d6b5fd0 Mon Sep 17 00:00:00 2001 From: Arnaud Ysmal Date: Thu, 10 May 2018 17:23:38 +0200 Subject: [PATCH] Add initial latex theme --- cli/resume.go | 1 + generate.sh | 5 + model/json.go | 3 + themes/kendall/kendall.go | 6 + themes/kendall/resume.template | 4 +- themes/stackoverflow/resume.template | 4 +- themes/stackoverflow/stackoverflow.go | 6 + themes/tex/resume_template.tex | 93 ++++++++++++++++ themes/tex/tex.go | 152 ++++++++++++++++++++++++++ themes/theme.go | 6 + 10 files changed, 276 insertions(+), 4 deletions(-) create mode 100755 generate.sh create mode 100644 themes/tex/resume_template.tex create mode 100644 themes/tex/tex.go diff --git a/cli/resume.go b/cli/resume.go index e214e88..42efcca 100644 --- a/cli/resume.go +++ b/cli/resume.go @@ -35,6 +35,7 @@ import ( "jsonresume/themes" _ "jsonresume/themes/kendall" _ "jsonresume/themes/stackoverflow" + _ "jsonresume/themes/tex" ) func main() { diff --git a/generate.sh b/generate.sh new file mode 100755 index 0000000..9413e58 --- /dev/null +++ b/generate.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +go-bindata -pkg kendall -o themes/kendall/kendall-assets.go themes/kendall/{resume.template,style.css,print.css} +go-bindata -pkg stackoverflow -o themes/stackoverflow/stackoverflow-assets.go themes/stackoverflow/{resume.template,style.css} +go-bindata -pkg tex -o themes/tex/tex-assets.go themes/tex/resume_template.tex diff --git a/model/json.go b/model/json.go index 1661b0d..7c86efe 100644 --- a/model/json.go +++ b/model/json.go @@ -28,12 +28,15 @@ package model import ( "encoding/json" "io/ioutil" + "regexp" "strings" "time" ) const ISO8601DateLayout = "2006-01-02" +var MarkdownURLRegexp = regexp.MustCompile(`\[([^]]*)\]\((http[^)]*)\)`) + type ResumeDate struct { time.Time } diff --git a/themes/kendall/kendall.go b/themes/kendall/kendall.go index 77459c0..40d09a6 100644 --- a/themes/kendall/kendall.go +++ b/themes/kendall/kendall.go @@ -26,6 +26,7 @@ package kendall import ( + "jsonresume/model" "jsonresume/themes" "path" "text/template" @@ -44,6 +45,7 @@ var Theme = themes.Theme{ Functions: template.FuncMap{ "css": getCSS, "printcss": getPrintCSS, + "md2html": md2html, }, } @@ -62,3 +64,7 @@ func getPrintCSS() string { r, _ := Asset(path.Join(packageDirectory, fileCSSPrint)) return string(r) } + +func md2html(s string) string { + return model.MarkdownURLRegexp.ReplaceAllString(s, `$1`) +} diff --git a/themes/kendall/resume.template b/themes/kendall/resume.template index 1be4a9b..20b0928 100644 --- a/themes/kendall/resume.template +++ b/themes/kendall/resume.template @@ -125,10 +125,10 @@