Skip to content
This repository has been archived by the owner on Dec 30, 2021. It is now read-only.

Commit

Permalink
fix: Hashtag in linked header
Browse files Browse the repository at this point in the history
  • Loading branch information
Mara-Li committed Nov 18, 2021
1 parent 2b11703 commit 071ac60
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions YAFPA/common/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ def file_convert(file, folder, option=0):
lines = adm.admonition_trad(lines)
for ln in lines:
final_text = ln.replace(" \n", "\n")
if not final_text.strip().endswith("%%") or not final_text.strip().startswith("%%"):
if not final_text.strip().endswith("%%") and not final_text.strip().startswith("%%"):
#skip comment
final_text = final_text.replace("\n", " \n")
final_text = links.link_image_conversion(final_text, meta)
final_text = links.link_image_conversion(final_text, meta, os.path.basename(file))

if not '`' in final_text:
final_text = re.sub("\%{2}(.*)\%{2}", "", final_text)
Expand All @@ -147,7 +147,7 @@ def file_convert(file, folder, option=0):
# Admonition space
final_text = final_text.replace(" \n", "\n")

if re.search("#\w+", final_text) and not re.search("(`|\[{2})(.*)#(.*)(`|\]{2})", final_text):
if re.search("#\w+", final_text) and not re.search("(`|\[{2}|\()(.*)#(.*)(`|\]{2}|\))", final_text):
# Hashtags
final_text = convert_hashtags(final_text)

Expand Down

0 comments on commit 071ac60

Please sign in to comment.