Skip to content

Commit

Permalink
Remove duplicate matches for s-103
Browse files Browse the repository at this point in the history
  • Loading branch information
apasel422 authored and acabal committed Jul 15, 2024
1 parent 4f22013 commit bbb1a0f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion se/se_epub_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2248,7 +2248,7 @@ def _lint_xhtml_syntax_checks(self, filename: Path, dom: se.easy_xml.EasyXmlTree

# Check for common missing roman semantics for “I”
regent_regex = r"(?:Charles|Edward|George|Henry|James|William) I\b"
matches = regex.findall(fr"King {regent_regex}", file_contents) + regex.findall(fr"{regent_regex}’s", file_contents)
matches = regex.findall(fr"King {regent_regex}|{regent_regex}’s", file_contents)
if matches:
messages.append(LintMessage("s-103", "Probable missing semantics for a roman I numeral.", se.MESSAGE_TYPE_WARNING, filename, matches))

Expand Down
18 changes: 6 additions & 12 deletions tests/lint/semantic/s-103/golden/s-103-out.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
s-103 [Manual Review] chapter-1.xhtml Probable missing semantics for a roman I
numeral.
Charles I’s
Edward I’s
George I’s
Henry I’s
James I’s
William I’s
King Charles I
King Edward I
King George I
Expand All @@ -12,15 +18,3 @@ numeral.
King Henry I
King James I
King William I
Charles I’s
Edward I’s
George I’s
Henry I’s
James I’s
William I’s
Charles I’s
Edward I’s
George I’s
Henry I’s
James I’s
William I’s
2 changes: 0 additions & 2 deletions tests/lint/semantic/s-103/in/src/epub/text/chapter-1.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
<p>King Henry I.</p>
<p>King James I.</p>
<p>King William I.</p>
<!-- these erroneously result in two matches each
due to the separate searches for the King prefix and possessive suffix -->
<p>King Charles I’s.</p>
<p>King Edward I’s.</p>
<p>King George I’s.</p>
Expand Down

0 comments on commit bbb1a0f

Please sign in to comment.