Skip to content

Commit

Permalink
fix: put escape char inside bracket
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasoca committed May 14, 2023
1 parent 2adb763 commit b90c035
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pkg/generator/latex.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ func replaceUnescapedChar(str string) string {
"$", "{\\$}",
"{", "{\\{}",
"}", "{\\}}",
"\\", "\\textbackslash",
"^", "\\textasciicircum",
"~", "\\textasciitilde",
"\\", "{\\textbackslash}",
"^", "{\\textasciicircum}",
"~", "{\\textasciitilde}",
)

return s.Replace(str)
Expand Down
2 changes: 1 addition & 1 deletion pkg/generator/latex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
func TestReplaceUnescapeChar(t *testing.T) {
test := `#$%&\_{}^~`
actual := replaceUnescapedChar(test)
expected := `{\#}{\$}{\%}{\&}\textbackslash{\_}{\{}{\}}\textasciicircum\textasciitilde`
expected := `{\#}{\$}{\%}{\&}{\textbackslash}{\_}{\{}{\}}{\textasciicircum}{\textasciitilde}`
if actual != expected {
t.Errorf("failed when replacing escape character, got: %s, expected: %s", actual, expected)
}
Expand Down

0 comments on commit b90c035

Please sign in to comment.