mirror of
https://github.com/JoseDeFreitas/awesome-youtubers.git
synced 2024-12-22 13:55:08 -05:00
Add commas rule
This commit is contained in:
parent
305712f15b
commit
d646b23719
@ -23,18 +23,40 @@ def featured_playlists():
|
||||
|
||||
for line, value in enumerate(content_readme):
|
||||
if checker in value:
|
||||
|
||||
words = value[len(checker)+1:-4]
|
||||
# Check for trailing slash
|
||||
if len(value) < length and value[-2] != '\\':
|
||||
if value[-2] == ' ':
|
||||
content_readme[line] = value[:-1] + '\\' + '\n' + '<br/>' + '\n'
|
||||
content_readme[line] = value[:-1] + '\\' + '\n<br/>\n'
|
||||
with open(file_readme, 'w') as write_readme:
|
||||
write_readme.writelines(content_readme)
|
||||
else:
|
||||
content_readme[line] = value[:-1] + ' \\' + '\n' + '<br/>' + '\n'
|
||||
content_readme[line] = value[:-1] + ' \\' + '\n<br/>\n'
|
||||
with open(file_readme, 'w') as write_readme:
|
||||
write_readme.writelines(content_readme)
|
||||
|
||||
result = "Trailing slash wasn't found.\nFixed."
|
||||
# Check for well-formatted backsticks
|
||||
if value.count('`') % 2 != 0:
|
||||
content = words.split(', ')
|
||||
fix_words = []
|
||||
|
||||
for topic in content:
|
||||
if topic[0] != '`' and topic[-1] != '`':
|
||||
fix_words.append('`' + topic + '`')
|
||||
elif topic[-1] != '`':
|
||||
fix_words.append(topic + '`')
|
||||
elif topic[0] != '`':
|
||||
fix_words.append('`' + topic)
|
||||
else:
|
||||
fix_words.append(topic)
|
||||
|
||||
content_readme[line] = value[:len(checker)] + ' ' + ', '.join(fix_words) + '. \\\n'
|
||||
with open(file_readme, 'w') as write_readme:
|
||||
write_readme.writelines(content_readme)
|
||||
|
||||
result = "Backsticks weren't found.\nFixed."
|
||||
|
||||
return result
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user