Skip to content

Commit 6e246db

Browse files
committed
fixed regex to work with language codes longer than 2 characters
1 parent f2f2e73 commit 6e246db

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/add_cc4_links.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def get_files(self):
6767
"""Get all the 4.0 files *except* those we are linking to"""
6868
self.files = [f for f in self.path.glob('*_4.0*.html')
6969
if not f.match(self.exclude_pattern)]
70+
self.files.sort()
7071

7172
def process_files(self):
7273
"""Add links to all the license files"""
@@ -83,7 +84,7 @@ def file_license_and_language(self, filepath):
8384

8485
def links_in_page(self, content):
8586
"""Find the translated license links at the bottom of the page"""
86-
return re.findall(r'//creativecommons\.org/licenses/[^/]+/4\.0/legalcode(\...)?">([^>]+)</a>', content)
87+
return re.findall(r'//creativecommons\.org/licenses/[^/]+/4\.0/legalcode(\.[^"]{2,})?">([^>]+)</a>', content)
8788

8889
def is_rtl(self, content):
8990
"""Determine whether the page is in a right-to-left script"""

0 commit comments

Comments
 (0)