AutoYADM commit: 2025-03-25 01:15:07
This commit is contained in:
parent
f73c297c0d
commit
46c4cf25ad
2 changed files with 25 additions and 11 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue