Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate matches for s-103 #734

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
20 changes: 20 additions & 0 deletions tests/lint/semantic/s-103/golden/s-103-out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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
King Henry I
King James I
King William I
King Charles I
King Edward I
King George I
King Henry I
King James I
King William I
29 changes: 29 additions & 0 deletions tests/lint/semantic/s-103/in/src/epub/text/chapter-1.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" epub:prefix="z3998: http://www.daisy.org/z3998/2012/vocab/structure/" xml:lang="en-GB">
<head>
<title>I</title>
</head>
<body epub:type="bodymatter z3998:fiction">
<section id="chapter-1" epub:type="chapter">
<h2 epub:type="ordinal z3998:roman">I</h2>
<p>Charles I’s.</p>
<p>Edward I’s.</p>
<p>George I’s.</p>
<p>Henry I’s.</p>
<p>James I’s.</p>
<p>William I’s.</p>
<p>King Charles I.</p>
<p>King Edward I.</p>
<p>King George I.</p>
<p>King Henry I.</p>
<p>King James I.</p>
<p>King William I.</p>
<p>King Charles I’s.</p>
<p>King Edward I’s.</p>
<p>King George I’s.</p>
<p>King Henry I’s.</p>
<p>King James I’s.</p>
<p>King William I’s.</p>
</section>
</body>
</html>
Loading