Fix a few bugs with encoding / decoding strings

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
Danila Fedorin 2023-12-01 18:15:17 -08:00
parent a1ae15d84c
commit 905b760dd7

View File

@ -18,7 +18,7 @@ encodeStr s =
let
go l =
case l of
'\\' :: xs -> '\\' :: go xs
'\\' :: xs -> '\\' :: '\\' :: go xs
'"' :: xs -> '\\' :: '"' :: go xs
x :: xs -> x :: go xs
[] -> []
@ -31,6 +31,8 @@ encodeLatex s =
go l =
case l of
'\\' :: xs -> String.toList "\\textbackslash " ++ go xs
'{' :: xs -> '\\' :: '{' :: go xs
'}' :: xs -> '\\' :: '}' :: go xs
x :: xs -> x :: go xs
[] -> []
in