AutoYADM commit: 2025-03-25 01:15:07

This commit is contained in:
Daniel Fichtinger 2025-03-25 01:15:07 -04:00
parent f73c297c0d
commit 46c4cf25ad
2 changed files with 25 additions and 11 deletions

View file

@ -9,15 +9,19 @@ with open(sys.argv[1], 'r') as f:
skipping = False
for line in lines:
prefix = line.strip()[0]
match prefix:
case ">":
# ignore quoted line
print(line)
case "```":
# ignore code block
skipping = not skipping
case _:
# wrap the line
if line.startswith(">"):
# ignore quoted line
print(line)
elif line.startswith("```"):
# ignore code block
skipping = not skipping
elif line.startswith("--"):
skipping = True
else:
# wrap the line
if not skipping:
wrapped = textwrap.wrap(line, width=74, break_long_words=False, replace_whitespace=True)
print("\n".join(wrapped))
else:
print(line)