mirror of
https://github.com/rust-unofficial/awesome-rust.git
synced 2025-01-03 05:10:17 +02:00
add comments
This commit is contained in:
parent
2569b17f9a
commit
1edae0d30e
10
cleanup.py
vendored
10
cleanup.py
vendored
@ -12,18 +12,25 @@ def fix_dashes(lines):
|
||||
|
||||
fixed_lines = []
|
||||
|
||||
# Distinguish between the prologue and the content.
|
||||
within_content = False
|
||||
|
||||
# Iterate over the awesome lines.
|
||||
for line in lines:
|
||||
|
||||
# Only touch the content, not the prologue.
|
||||
# The current line is within the content.
|
||||
if within_content:
|
||||
|
||||
# Adjust the dash.
|
||||
fixed_lines.append(line.replace(u' - ', u' — '))
|
||||
#
|
||||
# The current line is within the prologue.
|
||||
else:
|
||||
# The prologue has ended.
|
||||
if line.startswith(u'## Applications'):
|
||||
within_content = True
|
||||
|
||||
# Leave the current line unmodified.
|
||||
fixed_lines.append(line)
|
||||
|
||||
return fixed_lines
|
||||
@ -35,6 +42,7 @@ def fix_dashes(lines):
|
||||
with codecs.open('README.md', encoding='utf8') as awesome_file:
|
||||
awesome_lines = awesome_file.readlines()
|
||||
|
||||
# Fix the dashes.
|
||||
awesome_lines = fix_dashes(awesome_lines)
|
||||
|
||||
# Write the awesome file.
|
||||
|
Loading…
Reference in New Issue
Block a user