Created
August 3, 2023 01:50
-
-
Save mmcclimon/8cec3f1fae581a1cfed449df2af92df7 to your computer and use it in GitHub Desktop.
goofy program: fold-headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import fileinput | |
import re | |
in_headers = True | |
header_start = re.compile(r"[-A-Za-z0-9]+:\s") | |
for line in fileinput.input(): | |
if line.isspace(): | |
in_headers = False | |
if not in_headers or header_start.match(line): | |
print(line, end="") | |
else: | |
print(" " + line, end="") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment