gosmartkeyboard/util/clean.py

16 lines
544 B
Python
Raw Permalink Normal View History

#!/usr/bin/env python3
# Remove fenced code blocks from generated HTML files
# We need to do this because srcweave does not support fenced code blocks
# We also adjust links to use .html
import glob
for f in glob.glob('docs/*.html'):
with open(f, 'r') as fin:
lines = fin.readlines()
with open(f, 'w') as fout:
for line in lines:
if line.startswith('<p>```'):
continue
2023-03-07 22:29:26 +00:00
fout.write(line.replace('ReadMe.md', 'index.html').replace('.md', '.html').replace('.MD', '.html'))