| 7891e21c Andy McCall ↶ |
1 |
with open('/home/andymccall/development/oxygen/docs/xenon_spec.md', 'r') as f: |
| 2 |
text = f.read() |
| 3 |
|
| 4 |
|
| 5 |
import re |
| 6 |
text = re.sub(r'```[a-z]*\n', '', text) |
| 7 |
text = re.sub(r'```\n', '', text) |
| 8 |
|
| 9 |
|
| 10 |
text = text.replace('Receipt {\n', '```cbor\nReceipt {\n') |
| 11 |
text = text.replace(' duration_ms [8]: u64\n}\n', ' duration_ms [8]: u64\n}\n```\n') |
| 12 |
|
| 13 |
text = text.replace('Attest {\n', '```json\nAttest {\n') |
| 14 |
text = text.replace(' "reproducible": bool\n }\n }\n}\n', ' "reproducible": bool\n }\n }\n}\n```\n') |
| 15 |
|
| 16 |
text = text.replace('Signature {\n', '```cbor\nSignature {\n') |
| 17 |
text = text.replace(' ml [3]: bytes(3309) // Post-quantum signature\n}\n', ' ml [3]: bytes(3309) // Post-quantum signature\n}\n```\n') |
| 18 |
|
| 19 |
text = text.replace('PolicyRule {\n', '```json\nPolicyRule {\n') |
| 20 |
text = text.replace(' signer_roles: [ "official-worker" ]\n }\n ]\n}\n', ' signer_roles: [ "official-worker" ]\n }\n ]\n}\n```\n') |
| 21 |
|
| 22 |
|
| 23 |
if '```kdl' not in text: |
| 24 |
text = text.replace('schema-version 1\n', '```kdl\nschema-version 1\n') |
| 25 |
text = text.replace(' }\n}\n\n### 3.2', ' }\n}\n```\n\n### 3.2') |
| 26 |
|
| 27 |
with open('/home/andymccall/development/oxygen/docs/xenon_spec.md', 'w') as f: |
| 28 |
f.write(text) |