Ignore Signed Pages and just do it

This commit is contained in:
PapaTutuWawa 2020-09-22 17:32:00 +02:00
parent 2f73bfae47
commit 8a8d20d241

View File

@ -10,11 +10,18 @@ for file_ in sys.argv[1:]:
print(f'Signing {file_} ...')
with open(file_, 'r') as fh:
content = fh.read()
content = re.sub(r'^\s*<!doctype[^>]*>', '', content)
proc = subprocess.run(['gpg', '--armor', '--detach-sign', '--output', '-', '--local-user', 'papatutuwawa@polynom.me', file_],
capture_output=True, check=True, input=content, encoding='utf-8')
#content = re.sub(r'^\s*<!doctype[^>]*>', '', content)
proc = subprocess.run(['gpg',
'--armor',
'--detach-sign',
'--output', '-',
'--local-user', 'papatutuwawa@polynom.me',
file_],
capture_output=True,
check=True,
input=content,
encoding='utf-8')
signature = proc.stdout[:-1]
print(signature)
with open(file_, 'r') as fh:
content = fh.read().replace('%%%SIGNED_PAGES_PGP_SIGNATURE%%%', signature)
with open(file_, 'w') as fh: