Update functions.py
All checks were successful
Publish Docker image / Push Docker image to Docker Hub (push) Successful in -3s
All checks were successful
Publish Docker image / Push Docker image to Docker Hub (push) Successful in -3s
This commit is contained in:
@@ -50,7 +50,12 @@ def convert_text(text: str, format_indents: bool = True):
|
||||
for line in seperate(text):
|
||||
# add anki field into line and count the number of changes
|
||||
if as_indent and re.search(r"^\W+.+", line) is not None:
|
||||
newLine, _ = re.subn(r"(^\W+)(.+)", r"\1 {{{{c1::\2}}}}", line)
|
||||
if re.search(r"^\t+", line) is not None:
|
||||
newLine = match_and_replace(line, format_indents)
|
||||
else:
|
||||
newLine, _ = re.subn(
|
||||
r"(?!^\t|^.+:$)^(\W+)(.+)$", r"\1 {{c1::\2}}", line
|
||||
)
|
||||
else:
|
||||
as_indent = False
|
||||
newLine = match_and_replace(line, format_indents)
|
||||
@@ -66,10 +71,10 @@ def match_and_replace(line: str, format_indents: bool = True):
|
||||
if re.search(":$", line) is not None:
|
||||
return True
|
||||
if format_indents:
|
||||
line, num = re.subn("(\t+.)(..*)", r"\1 {{{{c1::\2}}}}", line)
|
||||
line, num = re.subn("(\t+.)(..*)", r"\1 {{c1::\2}}", line)
|
||||
if num > 0:
|
||||
return line
|
||||
line, num = re.subn("(:)(..+)", r"\1 {{{{c1::\2}}}}", line)
|
||||
line, num = re.subn("(:)(..+)", r"\1 {{c1::\2}}", line)
|
||||
return line
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user