fix markdown listing for files with spaces

This commit is contained in:
Clement Ng
2017-04-04 01:26:27 +10:00
parent e76f76e19c
commit cf9f6b323e
2 changed files with 476 additions and 474 deletions

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import os
from urllib.parse import quote
readme = open('README.md', 'w')
@@ -20,6 +21,6 @@ for dir in os.listdir('.'):
lang = ''
for str in file[0:(len(file) if file.find('.') == -1 else file.find('.'))].replace('-', ' ').replace('_', ' ').split():
lang += str.capitalize() + ' '
readme.write('* [{}]({})\n'.format(lang[:-1], os.path.join(dir if dir != "#" else "%23", file))) # Cut trailing space
readme.write('* [{}]({})\n'.format(lang[:-1], quote(os.path.join(dir if dir != "#" else "%23", file)))) # Cut trailing space
readme.close()