Skip to content

Commit

Permalink
Merge pull request #24 from thomasoca/fix-input-error
Browse files Browse the repository at this point in the history
Fix input error
  • Loading branch information
thomasoca authored May 14, 2023
2 parents 27c32bb + b90c035 commit 828e3a8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions pkg/generator/latex.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ func replaceUnescapedChar(str string) string {
"$", "{\\$}",
"{", "{\\{}",
"}", "{\\}}",
"\\", "{\\textbackslash}",
"^", "{\\textasciicircum}",
"~", "{\\textasciitilde}",
)

return s.Replace(str)
Expand Down
14 changes: 14 additions & 0 deletions pkg/generator/latex_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package generator

import (
"testing"
)

func TestReplaceUnescapeChar(t *testing.T) {
test := `#$%&\_{}^~`
actual := replaceUnescapedChar(test)
expected := `{\#}{\$}{\%}{\&}{\textbackslash}{\_}{\{}{\}}{\textasciicircum}{\textasciitilde}`
if actual != expected {
t.Errorf("failed when replacing escape character, got: %s, expected: %s", actual, expected)
}
}
4 changes: 2 additions & 2 deletions pkg/image/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ func TestIsUrl(t *testing.T) {
}
}

func TestIsDirectory(t *testing.T) {
func TestIsFile(t *testing.T) {
path1 := "/home/thomasoca/Documents/important/foto.jpg"
check := IsImageFileExist(path1)
if check {
if !check {
t.Errorf("directory checking was incorrect, got: true, want: false")
}
}
4 changes: 2 additions & 2 deletions templates/template.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
{{if $i}}
\divider
{{end}}
\cvevent{{"{"}}{{.Position}}{{"}"}}{{"{"}}{{replaceUnescapedChar .Company}}{{"}"}}{{"{"}}{{.StartPeriod}} -- {{.EndPeriod}}{{"}"}}{{"{"}}{{.Location}}{{"}"}}
\cvevent{{"{"}}{{replaceUnescapedChar .Position}}{{"}"}}{{"{"}}{{replaceUnescapedChar .Company}}{{"}"}}{{"{"}}{{.StartPeriod}} -- {{.EndPeriod}}{{"}"}}{{"{"}}{{.Location}}{{"}"}}
{{if $it.Descriptions}}
\begin{itemize}
{{range $it.Descriptions}}
Expand All @@ -145,7 +145,7 @@
{{if $i}}
\divider
{{end}}
\cvevent{{"{"}}{{.Level}}, {{.Major}}{{if .Gpa}}, {{.Gpa}}{{end}}{{"}"}}{{"{"}}{{.Institution}}{{"}"}}{{"{"}}{{.StartPeriod}} -- {{.EndPeriod}}{{"}"}}{{"{"}}{{.Location}}{{"}"}}
\cvevent{{"{"}}{{.Level}}, {{.Major}}{{if .Gpa}}, {{.Gpa}}{{end}}{{"}"}}{{"{"}}{{replaceUnescapedChar .Institution}}{{"}"}}{{"{"}}{{.StartPeriod}} -- {{.EndPeriod}}{{"}"}}{{"{"}}{{.Location}}{{"}"}}
{{if $it.Descriptions}}
\begin{itemize}
{{range $it.Descriptions}}
Expand Down

0 comments on commit 828e3a8

Please sign in to comment.