diff options
Diffstat (limited to 'Build')
-rwxr-xr-x | Build/source/texk/web2c/tests/fix-changefile-lines.py | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/Build/source/texk/web2c/tests/fix-changefile-lines.py b/Build/source/texk/web2c/tests/fix-changefile-lines.py index 83d909c7eba..f7878ef33f3 100755 --- a/Build/source/texk/web2c/tests/fix-changefile-lines.py +++ b/Build/source/texk/web2c/tests/fix-changefile-lines.py @@ -190,30 +190,14 @@ class ChangeReader: elif repl_start == "@ ": section += 1 - # Remove leading @x. - text = self._lines[self._chunk_start][2:].strip() - - if opt_handler.part_b or opt_handler.section_b: - # Remove potentially leading [part.section] tag. - pattern = "\\[\\d+(\\.\\d+)?\\]" - if re.match(pattern, text): - text = re.sub(pattern, "", text, 1).strip() - - if opt_handler.line_b: - # Remove potentially line number information. - pattern = "l\\.\\d+" - if re.match(pattern, text): - text = re.sub(pattern, "", text, 1).strip() - - if opt_handler.hyphen_b: - # Remove potentially text comment separator. - pattern = "-+" - if re.match(pattern, text): - text = re.sub(pattern, "", text, 1).strip() - # Create line with standard tag and optional information. + old_line = self._lines[self._chunk_start][2:].strip() new_line = "@x" + if opt_handler.part_b or opt_handler.section_b: + pattern = "\\[\\d+(\\.\\d+)?\\]" + if re.match(pattern, old_line): + old_line = re.sub(pattern, "", old_line, 1).strip() new_line += " [" if opt_handler.part_b: new_line += f"{part}" @@ -222,13 +206,20 @@ class ChangeReader: if opt_handler.section_b: new_line += f"{section}" new_line += "]" + if opt_handler.line_b: + pattern = "l\\.\\d+" + if re.match(pattern, old_line): + old_line = re.sub(pattern, "", old_line, 1).strip() new_line += f" l.{line_number}" - if opt_handler.text_b and text: + if opt_handler.text_b and old_line: if opt_handler.hyphen_b: + pattern = "-+" + if re.match(pattern, old_line): + old_line = re.sub(pattern, "", old_line, 1).strip() new_line += " -" - new_line += f" {text}" + new_line += f" {old_line}" ch_line = self._lines[self._chunk_start] if new_line[:10] != ch_line[:10]: |