mirror of https://github.com/eyhc1/rendercv.git
fix a bug in escape_latex_characters
This commit is contained in:
parent
b28f26995c
commit
1622a791b2
|
@ -373,8 +373,8 @@ def escape_latex_characters(string: str) -> str:
|
||||||
links = re.findall(r"\[.*?\]\(.*?\)", string)
|
links = re.findall(r"\[.*?\]\(.*?\)", string)
|
||||||
|
|
||||||
# Replace the links with a placeholder:
|
# Replace the links with a placeholder:
|
||||||
for link in links:
|
for i, link in enumerate(links):
|
||||||
string = string.replace(link, "!!-link-!!")
|
string = string.replace(link, f"!!-link{i}-!!")
|
||||||
|
|
||||||
# Loop through the letters of the sentence and if you find an escape character,
|
# Loop through the letters of the sentence and if you find an escape character,
|
||||||
# replace it with its LaTeX equivalent:
|
# replace it with its LaTeX equivalent:
|
||||||
|
@ -386,8 +386,8 @@ def escape_latex_characters(string: str) -> str:
|
||||||
|
|
||||||
string = "".join(copy_of_the_string)
|
string = "".join(copy_of_the_string)
|
||||||
# Replace the links with the original links:
|
# Replace the links with the original links:
|
||||||
for link in links:
|
for i, link in enumerate(links):
|
||||||
string = string.replace("!!-link-!!", link)
|
string = string.replace(f"!!-link{i}-!!", link)
|
||||||
|
|
||||||
return string
|
return string
|
||||||
|
|
||||||
|
@ -444,13 +444,14 @@ def markdown_to_latex(markdown_string: str) -> str:
|
||||||
markdown_string = markdown_string.replace(old_italic_text, new_italic_text)
|
markdown_string = markdown_string.replace(old_italic_text, new_italic_text)
|
||||||
|
|
||||||
# convert code
|
# convert code
|
||||||
codes = re.findall(r"`([^`]*)`", markdown_string)
|
# not supported by rendercv currently
|
||||||
if codes is not None:
|
# codes = re.findall(r"`([^`]*)`", markdown_string)
|
||||||
for code_text in codes:
|
# if codes is not None:
|
||||||
old_code_text = f"`{code_text}`"
|
# for code_text in codes:
|
||||||
new_code_text = "\\texttt{" + code_text + "}"
|
# old_code_text = f"`{code_text}`"
|
||||||
|
# new_code_text = "\\texttt{" + code_text + "}"
|
||||||
|
|
||||||
markdown_string = markdown_string.replace(old_code_text, new_code_text)
|
# markdown_string = markdown_string.replace(old_code_text, new_code_text)
|
||||||
|
|
||||||
latex_string = markdown_string
|
latex_string = markdown_string
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue