1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #26341 -- Fixed makemessages breaking location comments for HTML files

Thanks Sylvain Garancher for the report and Veranika Sabiashchanskaya for the
initial patch.
This commit is contained in:
Claude Paroz
2016-04-28 21:18:55 +02:00
parent 185f90c45f
commit b16b124996
5 changed files with 32 additions and 7 deletions

View File

@@ -128,13 +128,18 @@ class BuildFile(object):
# Remove '.py' suffix
if os.name == 'nt':
# Preserve '.\' prefix on Windows to respect gettext behavior
old = '#: ' + self.work_path
new = '#: ' + self.path
old_path = self.work_path
new_path = self.path
else:
old = '#: ' + self.work_path[2:]
new = '#: ' + self.path[2:]
old_path = self.work_path[2:]
new_path = self.path[2:]
return msgs.replace(old, new)
return re.sub(
r'^(#: .*)(' + re.escape(old_path) + r')',
r'\1' + new_path,
msgs,
flags=re.MULTILINE
)
def cleanup(self):
"""