1
1
#!/usr/bin/env python3
2
2
# vim: set fileencoding=utf-8:
3
3
4
- """Add/Update the language list at the bottom of all CC0 legalcode files.
4
+ """Normalize file and add/update the language list at the bottom of all CC0
5
+ legalcode files.
5
6
"""
6
7
7
8
# Copyright 2016, 2017 Creative Commons
@@ -181,7 +182,7 @@ def insert_missing_lang_footer_comments(args, filename, content):
181
182
182
183
183
184
def has_correct_faq_officialtranslations (content ):
184
- """Determine if the link to the tranlsation FAQ is correct.
185
+ """Determine if the link to the translation FAQ is correct.
185
186
"""
186
187
if content .find (f'"{ FAQ_TRANSLATION_LINK } "' ) == - 1 :
187
188
return False
@@ -232,16 +233,15 @@ def normalize_faq_translation_link(args, filename, content):
232
233
233
234
234
235
def has_correct_languages_anchor (content ):
235
- """Determine if the link to the tranlsation FAQ is correct.
236
+ """Determine if language anchor uses id
236
237
"""
237
238
if content .find ('id="languages"' ) == - 1 :
238
239
return False
239
240
return True
240
241
241
242
242
243
def normalize_languages_anchor (args , filename , content ):
243
- """Replace various incorrect translation FAQ links with the correct link
244
- (FAQ_TRANSLATION_LINK).
244
+ """Replace name with id in languages anchor (HTML5 compatibility)
245
245
"""
246
246
if has_correct_languages_anchor (content ):
247
247
print (
@@ -268,7 +268,7 @@ def normalize_languages_anchor(args, filename, content):
268
268
269
269
270
270
def normalize_line_endings (args , filename , content ):
271
- """Normalize line endings to unix (\\ n)
271
+ """Normalize line endings to unix LF (\\ n)
272
272
"""
273
273
re_pattern = re .compile ("\r (?!\n )" )
274
274
matches = re_pattern .findall (content )
0 commit comments