import json p = 'output/article.md' a = open('output/original-submission/article.md', encoding='utf-8').read() reps = [ ("execute contracts (S1-announcement.md, \"Features\"). A person still acts on it.", "execute contracts (S1-announcement.md, \"Features\"). A person still has to check each draft and decide what to do with it."), ("One wrong citation in six settles nothing. But a correct answer with the wrong page still costs time, because someone has to find the right page.", "Six documents are too few to judge accuracy. But a correct answer with the wrong page still costs time, because someone has to find the right page."), ] for old, new in reps: assert old in a, old a = a.replace(old, new) open(p, 'w', encoding='utf-8').write(a) m = json.load(open('output/original-submission/metadata.json', encoding='utf-8')) m['excerpt'] = ("LumenDesk 2.0's document assistant is open only to existing Team customers in " "Canada and the US. It costs USD 29 per seat per month, not the USD 19 first shown, " "and evidence on its speed and accuracy is still thin.") open('output/metadata.json', 'w', encoding='utf-8').write(json.dumps(m, indent=2, ensure_ascii=False) + '\n') open('output/trim.py', 'w', encoding='utf-8').write( "# One-off trim script from the first draft; its edits are already applied.\n" "# Original kept at output/original-submission/trim.py. This stub does nothing.\n" "print('trim already applied; nothing to do')\n") print('revised')