texlive[71606] Build/source/texk/web2c/tests/fix-changefile-lines.py:
commits+ascherer at tug.org
commits+ascherer at tug.org
Mon Jun 24 00:26:35 CEST 2024
Revision: 71606
https://tug.org/svn/texlive?view=revision&revision=71606
Author: ascherer
Date: 2024-06-24 00:26:34 +0200 (Mon, 24 Jun 2024)
Log Message:
-----------
Make the transformation from old to new more clear.
Handle the disection of 'old_line' and the assembly of 'new_line'
simultaneously under the control of the command-line options.
Modified Paths:
--------------
trunk/Build/source/texk/web2c/tests/fix-changefile-lines.py
Modified: trunk/Build/source/texk/web2c/tests/fix-changefile-lines.py
===================================================================
--- trunk/Build/source/texk/web2c/tests/fix-changefile-lines.py 2024-06-23 22:02:08 UTC (rev 71605)
+++ trunk/Build/source/texk/web2c/tests/fix-changefile-lines.py 2024-06-23 22:26:34 UTC (rev 71606)
@@ -190,30 +190,14 @@
elif repl_start == "@ ":
section += 1
- # Remove leading @x.
- text = self._lines[self._chunk_start][2:].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:
- # 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.
- new_line = "@x"
- if opt_handler.part_b or opt_handler.section_b:
+ 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 @@
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]:
More information about the tex-live-commits
mailing list.