mirror of
https://github.com/rendercv/rendercv.git
synced 2025-12-23 21:47:55 -05:00
fix special latex character escaper
This commit is contained in:
@@ -336,6 +336,9 @@ def escape_latex_characters(latex_string: str) -> str:
|
||||
|
||||
# Dictionary of escape characters:
|
||||
escape_characters = {
|
||||
"{": "\\{",
|
||||
"}": "\\}",
|
||||
"\\": "\\textbackslash{}",
|
||||
"#": "\\#",
|
||||
"%": "\\%",
|
||||
"&": "\\&",
|
||||
|
||||
@@ -124,6 +124,10 @@ def test_markdown_file_class(tmp_path, rendercv_data_model, jinja2_environment):
|
||||
"$$a=5_4^3 % & #$$ # $$aaaa ___ &&$$",
|
||||
"$a=5_4^3 % & #$ \\# $aaaa ___ &&$",
|
||||
),
|
||||
(
|
||||
"$\\mathcal{O}(n^2)$ to $\\mathcal{O}(n \\log n)$",
|
||||
"\\$\\textbackslash{}mathcal\\{O\\}(n\\textasciicircum{}2)\\$ to \\$\\textbackslash{}mathcal\\{O\\}(n \\textbackslash{}log n)\\$",
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_escape_latex_characters(string, expected_string):
|
||||
|
||||
Reference in New Issue
Block a user