mirror of https://github.com/eyhc1/rendercv.git
add is_markdown filter to jinja
This commit is contained in:
parent
547cffefe6
commit
2493d2fb15
|
@ -31,8 +31,11 @@ if __name__ == "__main__":
|
||||||
"""
|
"""
|
||||||
To be continued...
|
To be continued...
|
||||||
"""
|
"""
|
||||||
|
if value is None:
|
||||||
|
raise ValueError("markdown_to_latex should only be used on strings!")
|
||||||
|
|
||||||
# convert links
|
# convert links
|
||||||
link = re.search("\[(.*)\]\((.*?)\)", value)
|
link = re.search(r"\[(.*)\]\((.*?)\)", value)
|
||||||
if link is not None:
|
if link is not None:
|
||||||
link = link.groups()
|
link = link.groups()
|
||||||
oldLinkString = "[" + link[0] + "](" + link[1] + ")"
|
oldLinkString = "[" + link[0] + "](" + link[1] + ")"
|
||||||
|
@ -42,7 +45,17 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
def is_markdown(value: str) -> bool:
|
||||||
|
"""
|
||||||
|
To be continued...
|
||||||
|
"""
|
||||||
|
if re.search(r"\[(.*)\]\((.*?)\)", value) is not None:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
environment.filters["markdown_to_latex"] = markdown_to_latex
|
environment.filters["markdown_to_latex"] = markdown_to_latex
|
||||||
|
environment.filters["is_markdown"] = is_markdown
|
||||||
|
|
||||||
environment.block_start_string = "((*"
|
environment.block_start_string = "((*"
|
||||||
environment.block_end_string = "*))"
|
environment.block_end_string = "*))"
|
||||||
|
|
Loading…
Reference in New Issue