Skip to content

Commit

Permalink
Logos extra links: Validate Strong leading zeroes
Browse files Browse the repository at this point in the history
Strong numbers should not have leading zeroes - if they had, they would
not be matched properly.

Therefore warn when there are leading zeroes and ignore the affected
lines in the CSV file.
  • Loading branch information
schierlm committed Dec 20, 2023
1 parent 0a900bf commit d978f10
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public void doExport(Bible bible, String... exportArgs) throws Exception {
System.out.println("WARNING: ExtraLinkFile " + extraLinkFile + " incomplete line: " + line);
continue;
}
if (!fields[0].matches("[A-Z][0-9]+")) {
if (!fields[0].matches("[A-Z][1-9][0-9]*")) {
System.out.println("WARNING: ExtraLinkFile " + extraLinkFile + " skipping invalid Strong number: " + line);
continue;
}
Expand Down Expand Up @@ -949,7 +949,7 @@ public static ExtraLinkCondition parse(String[] conditions) {
if (verseNumber != null)
throw new IllegalArgumentException("More than one verse reference");
verseNumber = new Versification.Reference(BookID.fromOsisId(parts[0]), Integer.parseInt(parts[1]), parts[2]);
} else if (cond.matches("[A-Z][0-9]+")) {
} else if (cond.matches("[A-Z][1-9][0-9]*")) {
strongNumbers.add(cond);
} else if (cond.matches(Utils.RMAC_REGEX)) {
rmacNumbers.add(cond);
Expand Down

0 comments on commit d978f10

Please sign in to comment.