File size: 837 Bytes
d3dbf03 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#!/usr/bin/env python
from pathlib import Path
from utils import replace_link
# This script reads /projects/*/README.md and generate projectzoo.md
all_files = list(Path('../../projects/').glob('*/README.md'))
example_project = '../../projects/example_project/README.md'
all_files.remove(Path(example_project))
all_files.insert(0, Path(example_project))
project_zoo = open('../../projects/README.md').read()
for file in all_files:
with open(file) as f:
content = f.read()
content = replace_link(r'\[([^\]]+)\]\(([^)]+)\)', '[{}]({})', content,
file)
content = replace_link(r'\[([^\]]+)\]: (.*)', '[{}]: {}', content,
file)
project_zoo += content
with open('projectzoo.md', 'w') as f:
f.write(project_zoo)
|