Import css into html

This commit is contained in:
Arnaud Ysmal 2018-05-07 22:24:43 +02:00
parent a5c24c4e46
commit 63df11b783
5 changed files with 144 additions and 99 deletions

View File

@ -27,26 +27,48 @@ package kendall
import ( import (
"fmt" "fmt"
"io/ioutil"
"jsonresume/model" "jsonresume/model"
"jsonresume/themes" "jsonresume/themes"
"path"
"strings" "strings"
"text/template" "text/template"
) )
const (
packageDirectory = "themes/kendall"
fileCSS = "style.css"
fileCSSPrint = "print.css"
fileTemplate = "resume.template"
)
var Theme = themes.Theme{ var Theme = themes.Theme{
Name: "kendall", Name: "kendall",
Directory: packageDirectory,
Functions: template.FuncMap{ Functions: template.FuncMap{
"iconClass": iconClass, "iconClass": iconClass,
"formatDateWork": formatDateWork, "formatDateWork": formatDateWork,
"formatDateEdu": formatDateEdu, "formatDateEdu": formatDateEdu,
"formatDatePub": formatDatePub, "formatDatePub": formatDatePub,
"css": getCSS,
"printcss": getPrintCSS,
}, },
Template: "themes/kendall/resume.template", Template: fileTemplate,
} }
func init() { func init() {
(&Theme).Register() (&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 { func iconClass(network string) string {
network = strings.ToLower(network) network = strings.ToLower(network)
switch network { switch network {

View File

@ -8,8 +8,8 @@
<title>Resume of {{.Basic.Name}}</title> <title>Resume of {{.Basic.Name}}</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="style.css" media="screen"> <style type="text/css">{{css}}</style>
<link rel="stylesheet" type="text/css" href="print.css" media="print"> <style type="text/css" media="print">{{printcss}}</style>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
@ -21,9 +21,9 @@
<div id="photo"> <div id="photo">
<img src="{{.Basic.Image}}" alt="avatar"> <img src="{{.Basic.Image}}" alt="avatar">
</div> </div>
{{end -}} {{- end}}
<div id="text-header" {{if not .Basic.Image}}style="margin-top: 90px;"{{end -}}> <div id="text-header" {{if not .Basic.Image}}style="margin-top: 90px;"{{- end}}>
<h1>{{.Basic.Name}}<br>{{if .Basic.Label}}<span>{{.Basic.Label}}</span>{{end -}}</h1> <h1>{{.Basic.Name}}<br>{{if .Basic.Label}}<span>{{.Basic.Label}}</span>{{- end}}</h1>
</div> </div>
</div> </div>
</div> </div>
@ -36,7 +36,7 @@
<h2><i class="fa fa-user ico"></i> About</h2> <h2><i class="fa fa-user ico"></i> About</h2>
<p>{{.Basic.Summary}}</p> <p>{{.Basic.Summary}}</p>
</div> </div>
{{end -}} {{- end}}
{{if .Work -}} {{if .Work -}}
<!-- WORK EXPERIENCE --> <!-- WORK EXPERIENCE -->
<div class="box"> <div class="box">
@ -50,7 +50,7 @@
<div class="address"> <div class="address">
<a href="{{.URL}}" target= "_blank"><i class="fa fa-globe ico"></i> {{.URL}}</a> <a href="{{.URL}}" target= "_blank"><i class="fa fa-globe ico"></i> {{.URL}}</a>
</div> </div>
{{end -}} {{- end}}
<div class="year">{{formatDateWork .StartDate}} {{formatDateWork .EndDate}}</div> <div class="year">{{formatDateWork .StartDate}} {{formatDateWork .EndDate}}</div>
</div> </div>
</div> </div>
@ -64,16 +64,16 @@
<ul class="list-group"> <ul class="list-group">
{{range .Highlights -}} {{range .Highlights -}}
<li class="list-group-item">{{.}}</li> <li class="list-group-item">{{.}}</li>
{{end -}} {{- end}}
</ul> </ul>
{{end -}} {{- end}}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{{end -}} {{- end}}
</div> </div>
{{end -}} {{- end}}
{{if .Awards -}} {{if .Awards -}}
<!-- AWARDS --> <!-- AWARDS -->
<div class="box"> <div class="box">
@ -88,10 +88,10 @@
<p>{{.Summary}}</p> <p>{{.Summary}}</p>
</div> </div>
</li> </li>
{{end -}} {{- end}}
</ul> </ul>
</div> </div>
{{end -}} {{- end}}
{{if .Volunteer -}} {{if .Volunteer -}}
<!-- VOLUNTEER --> <!-- VOLUNTEER -->
<div class="box"> <div class="box">
@ -105,7 +105,7 @@
<div class="address"> <div class="address">
<a href="{{.URL}}" target= "_blank"><i class="fa fa-globe ico"></i> {{.URL}}</a> <a href="{{.URL}}" target= "_blank"><i class="fa fa-globe ico"></i> {{.URL}}</a>
</div> </div>
{{end -}} {{- end}}
<div class="year">{{formatDateWork .StartDate}} {{formatDateWork .EndDate}}</div> <div class="year">{{formatDateWork .StartDate}} {{formatDateWork .EndDate}}</div>
</div> </div>
</div> </div>
@ -119,16 +119,16 @@
<ul class="list-group"> <ul class="list-group">
{{range .Highlights -}} {{range .Highlights -}}
<li class="list-group-item">{{.}}</li> <li class="list-group-item">{{.}}</li>
{{end -}} {{- end}}
</ul> </ul>
{{end -}} {{- end}}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{{end -}} {{- end}}
</div> </div>
{{end -}} {{- end}}
</div> </div>
<div class="col-xs-12 col-sm-5"> <div class="col-xs-12 col-sm-5">
<!-- CONTACT --> <!-- CONTACT -->
@ -137,35 +137,35 @@
{{if .Basic.ResumeLocation.City -}} {{if .Basic.ResumeLocation.City -}}
<div class="contact-item"> <div class="contact-item">
<div class="icon pull-left text-center"><span class="fa fa-map-marker fa-fw"></span></div> <div class="icon pull-left text-center"><span class="fa fa-map-marker fa-fw"></span></div>
{{if .Basic.ResumeLocation.Address}}<div class="title pull-right">{{.Basic.ResumeLocation.Address}}</div>{{end -}} {{if .Basic.ResumeLocation.Address}}<div class="title pull-right">{{.Basic.ResumeLocation.Address}}</div>{{- end}}
<div class="title {{if not .Basic.ResumeLocation.Address}}only {{end -}} pull-right">{{.Basic.ResumeLocation.City}}{{if .Basic.ResumeLocation.Region}}, {{.Basic.ResumeLocation.Region}}{{end -}}{{if .Basic.ResumeLocation.PostalCode}} {{.Basic.ResumeLocation.PostalCode}}{{end -}}{{if .Basic.ResumeLocation.CountryCode}} {{.Basic.ResumeLocation.CountryCode}}{{end -}}</div> <div class="title {{if not .Basic.ResumeLocation.Address}}only {{- end}} pull-right">{{.Basic.ResumeLocation.City}}{{if .Basic.ResumeLocation.Region}}, {{.Basic.ResumeLocation.Region}}{{- end}}{{if .Basic.ResumeLocation.PostalCode}} {{.Basic.ResumeLocation.PostalCode}}{{- end}}{{if .Basic.ResumeLocation.CountryCode}} {{.Basic.ResumeLocation.CountryCode}}{{- end}}</div>
</div> </div>
{{end -}} {{- end}}
{{if .Basic.Phone -}} {{if .Basic.Phone -}}
<div class="contact-item"> <div class="contact-item">
<div class="icon pull-left text-center"><span class="fa fa-phone fa-fw"></span></div> <div class="icon pull-left text-center"><span class="fa fa-phone fa-fw"></span></div>
<div class="title only pull-right">{{.Basic.Phone}}</div> <div class="title only pull-right">{{.Basic.Phone}}</div>
</div> </div>
{{end -}} {{- end}}
{{if .Basic.Email -}} {{if .Basic.Email -}}
<div class="contact-item"> <div class="contact-item">
<div class="icon pull-left text-center"><span class="fa fa-envelope fa-fw"></span></div> <div class="icon pull-left text-center"><span class="fa fa-envelope fa-fw"></span></div>
<div class="title only pull-right"><a href="mailto:{{.Basic.Email}}" target="_blank">{{.Basic.Email}}</a></div> <div class="title only pull-right"><a href="mailto:{{.Basic.Email}}" target="_blank">{{.Basic.Email}}</a></div>
</div> </div>
{{end -}} {{- end}}
{{if .Basic.URL -}} {{if .Basic.URL -}}
<div class="contact-item"> <div class="contact-item">
<div class="icon pull-left text-center"><span class="fa fa-globe fa-fw"></span></div> <div class="icon pull-left text-center"><span class="fa fa-globe fa-fw"></span></div>
<div class="title only pull-right"><a href="{{.Basic.URL}}" target="_blank">{{.Basic.URL}}</a></div> <div class="title only pull-right"><a href="{{.Basic.URL}}" target="_blank">{{.Basic.URL}}</a></div>
</div> </div>
{{end -}} {{- end}}
{{range .Basic.Profiles -}} {{range .Basic.Profiles -}}
<div class="contact-item"> <div class="contact-item">
<div class="icon pull-left text-center"><span class="{{iconClass .Network}} fa-fw"></span></div> <div class="icon pull-left text-center"><span class="{{iconClass .Network}} fa-fw"></span></div>
<div class="title pull-right">{{.Network}}</div> <div class="title pull-right">{{.Network}}</div>
<div class="description pull-right"><a href="{{.URL}}" target="_blank">{{if .UserName}}{{.UserName}}{{end -}}{{if not .UserName}}{{.URL}}{{end -}}</a></div> <div class="description pull-right"><a href="{{.URL}}" target="_blank">{{if .UserName}}{{.UserName}}{{- end}}{{if not .UserName}}{{.URL}}{{- end}}</a></div>
</div> </div>
{{end -}} {{- end}}
</div> </div>
{{if .Education -}} {{if .Education -}}
<!-- EDUCATION --> <!-- EDUCATION -->
@ -183,21 +183,21 @@
<p> <p>
GPA: {{.GPA}} GPA: {{.GPA}}
</p> </p>
{{end -}} {{- end}}
{{if .Courses -}} {{if .Courses -}}
<div>Courses</div> <div>Courses</div>
<ul class="list-group"> <ul class="list-group">
{{range .Courses -}} {{range .Courses -}}
<li class="list-group-item">{{.}}</li> <li class="list-group-item">{{.}}</li>
{{end -}} {{- end}}
</ul> </ul>
{{end -}} {{- end}}
</div> </div>
</li> </li>
{{end -}} {{- end}}
</ul> </ul>
</div> </div>
{{end -}} {{- end}}
{{if .Skills -}} {{if .Skills -}}
<!-- SKILLS --> <!-- SKILLS -->
<div class="box"> <div class="box">
@ -206,17 +206,17 @@
<div class="skills clearfix"> <div class="skills clearfix">
<div class="item-skills"> <div class="item-skills">
{{.Name}} {{.Name}}
{{if .Level}}<span class="skill-level">{{.Level}}</span>{{end -}} {{if .Level}}<span class="skill-level">{{.Level}}</span>{{- end}}
</div> </div>
<div class="col-sm-offset-1 col-sm-12 clearfix"> <div class="col-sm-offset-1 col-sm-12 clearfix">
{{range .Keywords -}} {{range .Keywords -}}
<span class= "skill badge">{{.}}</span> <span class= "skill badge">{{.}}</span>
{{end -}} {{- end}}
</div> </div>
</div> </div>
{{end -}} {{- end}}
</div> </div>
{{end -}} {{- end}}
{{if .Publications -}} {{if .Publications -}}
<!-- PUBLICATIONS --> <!-- PUBLICATIONS -->
<div class="box"> <div class="box">
@ -229,21 +229,21 @@
<div class="panel-body"> <div class="panel-body">
{{if .Publisher -}} {{if .Publisher -}}
<div class="publisher"><i class= "fa fa-bookmark ico"></i> {{.Publisher}}</div> <div class="publisher"><i class= "fa fa-bookmark ico"></i> {{.Publisher}}</div>
{{end -}} {{- end}}
<div class="year">{{formatDatePub .ReleaseDate}}</div> <div class="year">{{formatDatePub .ReleaseDate}}</div>
{{if .URL -}} {{if .URL -}}
<div class="address"> <div class="address">
<a href="{{.URL}}" target= "_blank"><i class="fa fa-globe ico"></i> {{.URL}}</a> <a href="{{.URL}}" target= "_blank"><i class="fa fa-globe ico"></i> {{.URL}}</a>
</div> </div>
{{end -}} {{- end}}
{{if .Summary -}} {{if .Summary -}}
<p>{{.Summary}}</p> <p>{{.Summary}}</p>
{{end -}} {{- end}}
</div> </div>
</div> </div>
{{end -}} {{- end}}
</div> </div>
{{end -}} {{- end}}
{{if .Languages -}} {{if .Languages -}}
<!-- LANGUAGES --> <!-- LANGUAGES -->
<div class="box"> <div class="box">
@ -251,10 +251,10 @@
<ul class="list-group"> <ul class="list-group">
{{range .Languages -}} {{range .Languages -}}
<li class=" list-group-item">{{.Language}}<span class="skill badge pull-right">{{.Fluency}}</span></li> <li class=" list-group-item">{{.Language}}<span class="skill badge pull-right">{{.Fluency}}</span></li>
{{end -}} {{- end}}
</ul> </ul>
</div> </div>
{{end -}} {{- end}}
{{if .Interests -}} {{if .Interests -}}
<!-- HOBBIES --> <!-- HOBBIES -->
<div class="box"> <div class="box">
@ -267,12 +267,12 @@
<div class="col-sm-offset-1 col-sm-12 clearfix"> <div class="col-sm-offset-1 col-sm-12 clearfix">
{{range .Keywords -}} {{range .Keywords -}}
<span class= "interest badge">{{.}}</span> <span class= "interest badge">{{.}}</span>
{{end -}} {{- end}}
</div> </div>
</div> </div>
{{end -}} {{- end}}
</div> </div>
{{end -}} {{- end}}
{{if .References -}} {{if .References -}}
<div class="box"> <div class="box">
<h2><i class= "fa fa-check-square ico"></i> References</h2> <h2><i class= "fa fa-check-square ico"></i> References</h2>
@ -281,9 +281,9 @@
<div>{{.Reference}}</div> <div>{{.Reference}}</div>
<footer>{{.Name}}</footer> <footer>{{.Name}}</footer>
</blockquote><br> </blockquote><br>
{{end -}} {{- end}}
</div> </div>
{{end -}} {{- end}}
</div> </div>
</div> </div>
</div> </div>

View File

@ -27,21 +27,43 @@ package kendallfr
import ( import (
"fmt" "fmt"
"io/ioutil"
"jsonresume/model" "jsonresume/model"
"jsonresume/themes" "jsonresume/themes"
"path"
"strings" "strings"
"text/template" "text/template"
) )
const (
packageDirectory = "themes/kendallfr"
fileCSS = "style.css"
fileCSSPrint = "print.css"
fileTemplate = "resume.template"
)
var Theme = themes.Theme{ var Theme = themes.Theme{
Name: "kendallfr", Name: "kendallfr",
Directory: packageDirectory,
Functions: template.FuncMap{ Functions: template.FuncMap{
"iconClass": iconClass, "iconClass": iconClass,
"formatDateWork": formatDateWork, "formatDateWork": formatDateWork,
"formatDateEdu": formatDateEdu, "formatDateEdu": formatDateEdu,
"formatDatePub": formatDatePub, "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() { func init() {

View File

@ -8,8 +8,8 @@
<title>CV de {{.Basic.Name}}</title> <title>CV de {{.Basic.Name}}</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="style.css" media="screen"> <style type="text/css">{{css}}</style>
<link rel="stylesheet" type="text/css" href="print.css" media="print"> <style type="text/css" media="print">{{printcss}}</style>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
@ -21,9 +21,9 @@
<div id="photo"> <div id="photo">
<img src="{{.Basic.Image}}" alt="avatar"> <img src="{{.Basic.Image}}" alt="avatar">
</div> </div>
{{end -}} {{- end}}
<div id="text-header" {{if not .Basic.Image}}style="margin-top: 90px;"{{end -}}> <div id="text-header" {{if not .Basic.Image}}style="margin-top: 90px;"{{- end}}>
<h1>{{.Basic.Name}}<br>{{if .Basic.Label}}<span>{{.Basic.Label}}</span>{{end -}}</h1> <h1>{{.Basic.Name}}<br>{{if .Basic.Label}}<span>{{.Basic.Label}}</span>{{- end}}</h1>
</div> </div>
</div> </div>
</div> </div>
@ -36,7 +36,7 @@
<h2><i class="fa fa-user ico"></i> À propos</h2> <h2><i class="fa fa-user ico"></i> À propos</h2>
<p>{{.Basic.Summary}}</p> <p>{{.Basic.Summary}}</p>
</div> </div>
{{end -}} {{- end}}
{{if .Work -}} {{if .Work -}}
<!-- WORK EXPERIENCE --> <!-- WORK EXPERIENCE -->
<div class="box"> <div class="box">
@ -50,7 +50,7 @@
<div class="address"> <div class="address">
<a href="{{.URL}}" target= "_blank"><i class="fa fa-globe ico"></i> {{.URL}}</a> <a href="{{.URL}}" target= "_blank"><i class="fa fa-globe ico"></i> {{.URL}}</a>
</div> </div>
{{end -}} {{- end}}
<div class="year">{{formatDateWork .StartDate}} {{formatDateWork .EndDate}}</div> <div class="year">{{formatDateWork .StartDate}} {{formatDateWork .EndDate}}</div>
</div> </div>
</div> </div>
@ -64,16 +64,16 @@
<ul class="list-group"> <ul class="list-group">
{{range .Highlights -}} {{range .Highlights -}}
<li class="list-group-item">{{.}}</li> <li class="list-group-item">{{.}}</li>
{{end -}} {{- end}}
</ul> </ul>
{{end -}} {{- end}}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{{end -}} {{- end}}
</div> </div>
{{end -}} {{- end}}
{{if .Awards -}} {{if .Awards -}}
<!-- AWARDS --> <!-- AWARDS -->
<div class="box"> <div class="box">
@ -88,10 +88,10 @@
<p>{{.Summary}}</p> <p>{{.Summary}}</p>
</div> </div>
</li> </li>
{{end -}} {{- end}}
</ul> </ul>
</div> </div>
{{end -}} {{- end}}
{{if .Volunteer -}} {{if .Volunteer -}}
<!-- VOLUNTEER --> <!-- VOLUNTEER -->
<div class="box"> <div class="box">
@ -105,7 +105,7 @@
<div class="address"> <div class="address">
<a href="{{.URL}}" target= "_blank"><i class="fa fa-globe ico"></i> {{.URL}}</a> <a href="{{.URL}}" target= "_blank"><i class="fa fa-globe ico"></i> {{.URL}}</a>
</div> </div>
{{end -}} {{- end}}
<div class="year">{{formatDateWork .StartDate}} {{formatDateWork .EndDate}}</div> <div class="year">{{formatDateWork .StartDate}} {{formatDateWork .EndDate}}</div>
</div> </div>
</div> </div>
@ -119,16 +119,16 @@
<ul class="list-group"> <ul class="list-group">
{{range .Highlights -}} {{range .Highlights -}}
<li class="list-group-item">{{.}}</li> <li class="list-group-item">{{.}}</li>
{{end -}} {{- end}}
</ul> </ul>
{{end -}} {{- end}}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{{end -}} {{- end}}
</div> </div>
{{end -}} {{- end}}
</div> </div>
<div class="col-xs-12 col-sm-5"> <div class="col-xs-12 col-sm-5">
<!-- CONTACT --> <!-- CONTACT -->
@ -137,35 +137,35 @@
{{if .Basic.ResumeLocation.City -}} {{if .Basic.ResumeLocation.City -}}
<div class="contact-item"> <div class="contact-item">
<div class="icon pull-left text-center"><span class="fa fa-map-marker fa-fw"></span></div> <div class="icon pull-left text-center"><span class="fa fa-map-marker fa-fw"></span></div>
{{if .Basic.ResumeLocation.Address}}<div class="title pull-right">{{.Basic.ResumeLocation.Address}}</div>{{end -}} {{if .Basic.ResumeLocation.Address}}<div class="title pull-right">{{.Basic.ResumeLocation.Address}}</div>{{- end}}
<div class="title {{if not .Basic.ResumeLocation.Address}}only {{end -}} pull-right">{{.Basic.ResumeLocation.City}}{{if .Basic.ResumeLocation.Region}}, {{.Basic.ResumeLocation.Region}}{{end -}}{{if .Basic.ResumeLocation.PostalCode}} {{.Basic.ResumeLocation.PostalCode}}{{end -}}{{if .Basic.ResumeLocation.CountryCode}} {{.Basic.ResumeLocation.CountryCode}}{{end -}}</div> <div class="title {{if not .Basic.ResumeLocation.Address}}only {{- end}} pull-right">{{.Basic.ResumeLocation.City}}{{if .Basic.ResumeLocation.Region}}, {{.Basic.ResumeLocation.Region}}{{- end}}{{if .Basic.ResumeLocation.PostalCode}} {{.Basic.ResumeLocation.PostalCode}}{{- end}}{{if .Basic.ResumeLocation.CountryCode}} {{.Basic.ResumeLocation.CountryCode}}{{- end}}</div>
</div> </div>
{{end -}} {{- end}}
{{if .Basic.Phone -}} {{if .Basic.Phone -}}
<div class="contact-item"> <div class="contact-item">
<div class="icon pull-left text-center"><span class="fa fa-phone fa-fw"></span></div> <div class="icon pull-left text-center"><span class="fa fa-phone fa-fw"></span></div>
<div class="title only pull-right">{{.Basic.Phone}}</div> <div class="title only pull-right">{{.Basic.Phone}}</div>
</div> </div>
{{end -}} {{- end}}
{{if .Basic.Email -}} {{if .Basic.Email -}}
<div class="contact-item"> <div class="contact-item">
<div class="icon pull-left text-center"><span class="fa fa-envelope fa-fw"></span></div> <div class="icon pull-left text-center"><span class="fa fa-envelope fa-fw"></span></div>
<div class="title only pull-right"><a href="mailto:{{.Basic.Email}}" target="_blank">{{.Basic.Email}}</a></div> <div class="title only pull-right"><a href="mailto:{{.Basic.Email}}" target="_blank">{{.Basic.Email}}</a></div>
</div> </div>
{{end -}} {{- end}}
{{if .Basic.URL -}} {{if .Basic.URL -}}
<div class="contact-item"> <div class="contact-item">
<div class="icon pull-left text-center"><span class="fa fa-globe fa-fw"></span></div> <div class="icon pull-left text-center"><span class="fa fa-globe fa-fw"></span></div>
<div class="title only pull-right"><a href="{{.Basic.URL}}" target="_blank">{{.Basic.URL}}</a></div> <div class="title only pull-right"><a href="{{.Basic.URL}}" target="_blank">{{.Basic.URL}}</a></div>
</div> </div>
{{end -}} {{- end}}
{{range .Basic.Profiles -}} {{range .Basic.Profiles -}}
<div class="contact-item"> <div class="contact-item">
<div class="icon pull-left text-center"><span class="{{iconClass .Network}} fa-fw"></span></div> <div class="icon pull-left text-center"><span class="{{iconClass .Network}} fa-fw"></span></div>
<div class="title pull-right">{{.Network}}</div> <div class="title pull-right">{{.Network}}</div>
<div class="description pull-right"><a href="{{.URL}}" target="_blank">{{if .UserName}}{{.UserName}}{{end -}}{{if not .UserName}}{{.URL}}{{end -}}</a></div> <div class="description pull-right"><a href="{{.URL}}" target="_blank">{{if .UserName}}{{.UserName}}{{- end}}{{if not .UserName}}{{.URL}}{{- end}}</a></div>
</div> </div>
{{end -}} {{- end}}
</div> </div>
{{if .Education -}} {{if .Education -}}
<!-- EDUCATION --> <!-- EDUCATION -->
@ -183,21 +183,21 @@
<p> <p>
GPA: {{.GPA}} GPA: {{.GPA}}
</p> </p>
{{end -}} {{- end}}
{{if .Courses -}} {{if .Courses -}}
<div>Courses</div> <div>Courses</div>
<ul class="list-group"> <ul class="list-group">
{{range .Courses -}} {{range .Courses -}}
<li class="list-group-item">{{.}}</li> <li class="list-group-item">{{.}}</li>
{{end -}} {{- end}}
</ul> </ul>
{{end -}} {{- end}}
</div> </div>
</li> </li>
{{end -}} {{- end}}
</ul> </ul>
</div> </div>
{{end -}} {{- end}}
{{if .Skills -}} {{if .Skills -}}
<!-- SKILLS --> <!-- SKILLS -->
<div class="box"> <div class="box">
@ -206,17 +206,17 @@
<div class="skills clearfix"> <div class="skills clearfix">
<div class="item-skills"> <div class="item-skills">
{{.Name}} {{.Name}}
{{if .Level}}<span class="skill-level">{{.Level}}</span>{{end -}} {{if .Level}}<span class="skill-level">{{.Level}}</span>{{- end}}
</div> </div>
<div class="col-sm-offset-1 col-sm-12 clearfix"> <div class="col-sm-offset-1 col-sm-12 clearfix">
{{range .Keywords -}} {{range .Keywords -}}
<span class= "skill badge">{{.}}</span> <span class= "skill badge">{{.}}</span>
{{end -}} {{- end}}
</div> </div>
</div> </div>
{{end -}} {{- end}}
</div> </div>
{{end -}} {{- end}}
{{if .Publications -}} {{if .Publications -}}
<!-- PUBLICATIONS --> <!-- PUBLICATIONS -->
<div class="box"> <div class="box">
@ -229,21 +229,21 @@
<div class="panel-body"> <div class="panel-body">
{{if .Publisher -}} {{if .Publisher -}}
<div class="publisher"><i class= "fa fa-bookmark ico"></i> {{.Publisher}}</div> <div class="publisher"><i class= "fa fa-bookmark ico"></i> {{.Publisher}}</div>
{{end -}} {{- end}}
<div class="year">{{formatDatePub .ReleaseDate}}</div> <div class="year">{{formatDatePub .ReleaseDate}}</div>
{{if .URL -}} {{if .URL -}}
<div class="address"> <div class="address">
<a href="{{.URL}}" target= "_blank"><i class="fa fa-globe ico"></i> {{.URL}}</a> <a href="{{.URL}}" target= "_blank"><i class="fa fa-globe ico"></i> {{.URL}}</a>
</div> </div>
{{end -}} {{- end}}
{{if .Summary -}} {{if .Summary -}}
<p>{{.Summary}}</p> <p>{{.Summary}}</p>
{{end -}} {{- end}}
</div> </div>
</div> </div>
{{end -}} {{- end}}
</div> </div>
{{end -}} {{- end}}
{{if .Languages -}} {{if .Languages -}}
<!-- LANGUAGES --> <!-- LANGUAGES -->
<div class="box"> <div class="box">
@ -251,10 +251,10 @@
<ul class="list-group"> <ul class="list-group">
{{range .Languages -}} {{range .Languages -}}
<li class=" list-group-item">{{.Language}}<span class="skill badge pull-right">{{.Fluency}}</span></li> <li class=" list-group-item">{{.Language}}<span class="skill badge pull-right">{{.Fluency}}</span></li>
{{end -}} {{- end}}
</ul> </ul>
</div> </div>
{{end -}} {{- end}}
{{if .Interests -}} {{if .Interests -}}
<!-- HOBBIES --> <!-- HOBBIES -->
<div class="box"> <div class="box">
@ -267,12 +267,12 @@
<div class="col-sm-offset-1 col-sm-12 clearfix"> <div class="col-sm-offset-1 col-sm-12 clearfix">
{{range .Keywords -}} {{range .Keywords -}}
<span class= "interest badge">{{.}}</span> <span class= "interest badge">{{.}}</span>
{{end -}} {{- end}}
</div> </div>
</div> </div>
{{end -}} {{- end}}
</div> </div>
{{end -}} {{- end}}
{{if .References -}} {{if .References -}}
<div class="box"> <div class="box">
<h2><i class= "fa fa-check-square ico"></i> Références</h2> <h2><i class= "fa fa-check-square ico"></i> Références</h2>
@ -281,9 +281,9 @@
<div>{{.Reference}}</div> <div>{{.Reference}}</div>
<footer>{{.Name}}</footer> <footer>{{.Name}}</footer>
</blockquote><br> </blockquote><br>
{{end -}} {{- end}}
</div> </div>
{{end -}} {{- end}}
</div> </div>
</div> </div>
</div> </div>

View File

@ -35,6 +35,7 @@ import (
type Theme struct { type Theme struct {
Name string Name string
Directory string
Functions template.FuncMap Functions template.FuncMap
Template string Template string
} }
@ -46,7 +47,7 @@ func init() {
} }
func (t *Theme) Render(r *model.Resume, w io.Writer) error { 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) return tmpl.Execute(w, r)
} }