AutoYADM commit: 2025-03-25 01:45:07
This commit is contained in:
parent
e5c0898f10
commit
bb6e941e14
1 changed files with 17 additions and 1 deletions
|
@ -23,6 +23,7 @@ import sys
|
||||||
|
|
||||||
|
|
||||||
skipping = False
|
skipping = False
|
||||||
|
in_par = False
|
||||||
for line in sys.stdin:
|
for line in sys.stdin:
|
||||||
if line.startswith(">"):
|
if line.startswith(">"):
|
||||||
# ignore quoted line
|
# ignore quoted line
|
||||||
|
@ -34,8 +35,23 @@ for line in sys.stdin:
|
||||||
elif line.startswith("--"):
|
elif line.startswith("--"):
|
||||||
skipping = True
|
skipping = True
|
||||||
print(line, end = "")
|
print(line, end = "")
|
||||||
|
elif not line.rstrip():
|
||||||
|
in_par = not in_par
|
||||||
|
print()
|
||||||
|
# print(line, end="")
|
||||||
else:
|
else:
|
||||||
# wrap the line
|
if not skipping and in_par:
|
||||||
|
par = []
|
||||||
|
for next_line in sys.stdin:
|
||||||
|
# if not line.startswith((">", "```", "--")):
|
||||||
|
stripped = next_line.rstrip()
|
||||||
|
if stripped:
|
||||||
|
par.append(stripped)
|
||||||
|
else:
|
||||||
|
in_par = False
|
||||||
|
line = " ".join(par)
|
||||||
|
# empty line, treat next section as paragraph
|
||||||
|
# TODO: fix signature being mangled and newlines erased
|
||||||
if not skipping:
|
if not skipping:
|
||||||
wrapped = textwrap.wrap(line, width=74, break_long_words=False, replace_whitespace=True)
|
wrapped = textwrap.wrap(line, width=74, break_long_words=False, replace_whitespace=True)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue