AutoYADM commit: 2025-03-25 23:30:07
This commit is contained in:
parent
eb8eb64872
commit
ed19a33568
2 changed files with 2 additions and 81 deletions
|
@ -1,42 +0,0 @@
|
|||
#!/bin/env python
|
||||
|
||||
# Simple text-wrapping script for email.
|
||||
# Preserves code blocks, quotes, and signature.
|
||||
# Automatically joins and re-wraps paragraphs to
|
||||
# ensure even spacing & avoid ugly wrapping.
|
||||
# Author: Daniel Fichtinger
|
||||
# License: MIT
|
||||
|
||||
import textwrap
|
||||
import sys
|
||||
import re
|
||||
|
||||
paragraph = []
|
||||
skipping = False
|
||||
|
||||
def flush_paragraph():
|
||||
if paragraph:
|
||||
joined = " ".join(paragraph)
|
||||
wrapped = textwrap.wrap(joined, width=74, break_long_words=False, replace_whitespace=True)
|
||||
print("\n".join(wrapped))
|
||||
paragraph.clear()
|
||||
|
||||
for line in sys.stdin:
|
||||
line = line.rstrip()
|
||||
if line.startswith("```"):
|
||||
flush_paragraph()
|
||||
skipping = not skipping
|
||||
print(line)
|
||||
elif line.startswith("--"):
|
||||
flush_paragraph()
|
||||
skipping = True
|
||||
print(line)
|
||||
elif not line or re.match(r"^(\s+|-\s+|\+\s+|\*\s+|>\s*)", line):
|
||||
flush_paragraph()
|
||||
print(line)
|
||||
elif skipping:
|
||||
print(line)
|
||||
else:
|
||||
paragraph.append(line)
|
||||
else:
|
||||
flush_paragraph()
|
1
.config/mail/format.py
Symbolic link
1
.config/mail/format.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
/home/fic/dev/mail-utils/format.py
|
Loading…
Add table
Add a link
Reference in a new issue