AutoYADM commit: 2025-03-25 01:30:07
This commit is contained in:
parent
46c4cf25ad
commit
e5c0898f10
1 changed files with 22 additions and 5 deletions
|
@ -3,20 +3,37 @@
|
|||
import textwrap
|
||||
import sys
|
||||
|
||||
with open(sys.argv[1], 'r') as f:
|
||||
lines = f.read().splitlines()
|
||||
# with open(sys.argv[1], 'r') as f:
|
||||
# lines = f.read().splitlines()
|
||||
# print(lines)
|
||||
|
||||
# first pass: reflow paragraphs
|
||||
# paragraph = []
|
||||
# lines = []
|
||||
# for line in sys.stdin:
|
||||
# line = line.rstrip()
|
||||
# if line:
|
||||
# paragraph.append(line)
|
||||
# else:
|
||||
# if paragraph:
|
||||
# lines.append(' '.join(paragraph))
|
||||
# lines.append("\n")
|
||||
# if paragraph:
|
||||
# lines.append(' '.join(paragraph))
|
||||
|
||||
|
||||
skipping = False
|
||||
for line in lines:
|
||||
for line in sys.stdin:
|
||||
if line.startswith(">"):
|
||||
# ignore quoted line
|
||||
print(line)
|
||||
print(line, end = "")
|
||||
elif line.startswith("```"):
|
||||
# ignore code block
|
||||
skipping = not skipping
|
||||
print(line, end = "")
|
||||
elif line.startswith("--"):
|
||||
skipping = True
|
||||
print(line, end = "")
|
||||
else:
|
||||
# wrap the line
|
||||
if not skipping:
|
||||
|
@ -24,4 +41,4 @@ for line in lines:
|
|||
|
||||
print("\n".join(wrapped))
|
||||
else:
|
||||
print(line)
|
||||
print(line, end = "")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue