Loading generateChangemarks/changemarks.py +29 −13 Original line number Diff line number Diff line Loading @@ -458,7 +458,10 @@ def find_clauses_with_changes(progress: Progress, mdLines_changes: list[Tuple[st _taskID = progress.add_task('[blue]Find clauses with changes', start=False, total=0) clauseregex = re.compile('^#+\s(\d+(\.\d+)*|Annex \w(\.\d+)*|\w*(\.\d+)*|~~#).*') clauseregex = re.compile('^#+\s(\d+(\.\d+)*|Annex \w(\.\d+)*|\w*(\.\d+)*).*') removedclauseregex = re.compile('^\~\~#+\s(\d+(\.\d+)*|Annex \w(\.\d+)*|\w+\s\w*(\.\d+)*).*') addedclauseregex = re.compile('^\<span\sclass\=\"underline\"\>#+\s(\d+(\.\d+)*|Annex \w(\.\d+)*|\w+\s\w*(\.\d+)*).*') clauses: list[Clause] = [] changed_clauses: list[Clause] = [] changeInClause = False Loading @@ -473,24 +476,37 @@ def find_clauses_with_changes(progress: Progress, mdLines_changes: list[Tuple[st # break # index = index + 1 index = 1 for line, change in mdLines_changes: if change: changeInClause = True if line.startswith('#'): matches = re.findall(clauseregex, line) # Match heading if matches: # It may be the end of the clause or the start of a subclause def checkClause(_matches): nonlocal clause nonlocal changeInClause if index - 2 == clause.from_id: # It is a subclause clause.from_id = index clause.raw = line clause.clause_nr = matches[0][0] clause.clause_nr = _matches[0][0] else: # It is the end of the clause clause.to_id = index - 1 clauses.append(clause) if changeInClause: changed_clauses.append(clause) clause = Clause(line, index, index, matches[0][0]) clause = Clause(line, index, index, _matches[0][0]) changeInClause = False index = 1 for line, change in mdLines_changes: if change: changeInClause = True if line.startswith('#') or line.startswith("~~#") or line.startswith("<span class=\"underline\">#"): matches = re.findall(clauseregex, line) # Match heading removedmatches = re.findall(removedclauseregex, line) # Match removed heading addedmatches = re.findall(addedclauseregex, line) # Match removed heading if matches: # It may be the end of the clause or the start of a subclause checkClause(matches) elif removedmatches: checkClause(removedmatches) elif addedmatches: checkClause(addedmatches) else: # it is last clause print("Unknown heading") Loading generate_changemarks.sh +1 −1 Original line number Diff line number Diff line #!/bin/bash FORGELIB_DOCKER_IMAGE=forge.3gpp.org:5050/tools/3gpp-scripts/forgelib:v2.11.0 FORGELIB_DOCKER_IMAGE=forge.3gpp.org:5050/tools/3gpp-scripts/forgelib:v2.13.0 GENERATE_CHANGEMARKS_DOCKER_IMAGE=generatechangemarks:master DOCKER_IMAGE=pandoc/core:3.1.1.0 Loading Loading
generateChangemarks/changemarks.py +29 −13 Original line number Diff line number Diff line Loading @@ -458,7 +458,10 @@ def find_clauses_with_changes(progress: Progress, mdLines_changes: list[Tuple[st _taskID = progress.add_task('[blue]Find clauses with changes', start=False, total=0) clauseregex = re.compile('^#+\s(\d+(\.\d+)*|Annex \w(\.\d+)*|\w*(\.\d+)*|~~#).*') clauseregex = re.compile('^#+\s(\d+(\.\d+)*|Annex \w(\.\d+)*|\w*(\.\d+)*).*') removedclauseregex = re.compile('^\~\~#+\s(\d+(\.\d+)*|Annex \w(\.\d+)*|\w+\s\w*(\.\d+)*).*') addedclauseregex = re.compile('^\<span\sclass\=\"underline\"\>#+\s(\d+(\.\d+)*|Annex \w(\.\d+)*|\w+\s\w*(\.\d+)*).*') clauses: list[Clause] = [] changed_clauses: list[Clause] = [] changeInClause = False Loading @@ -473,24 +476,37 @@ def find_clauses_with_changes(progress: Progress, mdLines_changes: list[Tuple[st # break # index = index + 1 index = 1 for line, change in mdLines_changes: if change: changeInClause = True if line.startswith('#'): matches = re.findall(clauseregex, line) # Match heading if matches: # It may be the end of the clause or the start of a subclause def checkClause(_matches): nonlocal clause nonlocal changeInClause if index - 2 == clause.from_id: # It is a subclause clause.from_id = index clause.raw = line clause.clause_nr = matches[0][0] clause.clause_nr = _matches[0][0] else: # It is the end of the clause clause.to_id = index - 1 clauses.append(clause) if changeInClause: changed_clauses.append(clause) clause = Clause(line, index, index, matches[0][0]) clause = Clause(line, index, index, _matches[0][0]) changeInClause = False index = 1 for line, change in mdLines_changes: if change: changeInClause = True if line.startswith('#') or line.startswith("~~#") or line.startswith("<span class=\"underline\">#"): matches = re.findall(clauseregex, line) # Match heading removedmatches = re.findall(removedclauseregex, line) # Match removed heading addedmatches = re.findall(addedclauseregex, line) # Match removed heading if matches: # It may be the end of the clause or the start of a subclause checkClause(matches) elif removedmatches: checkClause(removedmatches) elif addedmatches: checkClause(addedmatches) else: # it is last clause print("Unknown heading") Loading
generate_changemarks.sh +1 −1 Original line number Diff line number Diff line #!/bin/bash FORGELIB_DOCKER_IMAGE=forge.3gpp.org:5050/tools/3gpp-scripts/forgelib:v2.11.0 FORGELIB_DOCKER_IMAGE=forge.3gpp.org:5050/tools/3gpp-scripts/forgelib:v2.13.0 GENERATE_CHANGEMARKS_DOCKER_IMAGE=generatechangemarks:master DOCKER_IMAGE=pandoc/core:3.1.1.0 Loading