Skip to content

Commit 1c13a43

Browse files
authored
Update screenshot README script (mbadolato#309)
Screenshots will now be listed alphabetically Non `.png` files will be excluded from output
1 parent 90a58f5 commit 1c13a43

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tools/genMD.py

100755100644
+10-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
import os
1+
from pathlib import Path
22

3-
with open('README.md', 'w') as mkdn:
4-
mkdn.write("Screenshots\n===\n")
5-
for f in [f for f in os.listdir('.') if os.path.isfile(f)]:
6-
mkdn.write("`%s`\n\n" % f)
7-
mkdn.write("![image](%s)\n\n" % f)
3+
screenshot_dir = (Path(__file__).parent / '../screenshots').resolve()
4+
screenshot_paths = list(screenshot_dir.glob('**/*.png'))
5+
screenshots = map(lambda path: path.name, screenshot_paths)
86

7+
readme_path = (screenshot_dir / 'README.md')
8+
with open(readme_path, 'w') as readme:
9+
readme.write('# Screenshots\n\n')
10+
for ss in sorted(screenshots, key=str.lower):
11+
readme.write(f'`{ss}`\n')
12+
readme.write(f'![image]({ss})\n\n')

0 commit comments

Comments
 (0)