From 7ba6e44beaca275e2b53345683b65bddb4515af1 Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner Date: Mon, 15 Jul 2024 11:28:14 -0400 Subject: [PATCH 1/2] Add tests for s-103 --- .../lint/semantic/s-103/golden/s-103-out.txt | 26 ++++++++++++++++ .../s-103/in/src/epub/text/chapter-1.xhtml | 31 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 tests/lint/semantic/s-103/golden/s-103-out.txt create mode 100644 tests/lint/semantic/s-103/in/src/epub/text/chapter-1.xhtml diff --git a/tests/lint/semantic/s-103/golden/s-103-out.txt b/tests/lint/semantic/s-103/golden/s-103-out.txt new file mode 100644 index 00000000..6e316594 --- /dev/null +++ b/tests/lint/semantic/s-103/golden/s-103-out.txt @@ -0,0 +1,26 @@ +s-103 [Manual Review] chapter-1.xhtml Probable missing semantics for a roman I +numeral. + 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 + 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 diff --git a/tests/lint/semantic/s-103/in/src/epub/text/chapter-1.xhtml b/tests/lint/semantic/s-103/in/src/epub/text/chapter-1.xhtml new file mode 100644 index 00000000..f5875457 --- /dev/null +++ b/tests/lint/semantic/s-103/in/src/epub/text/chapter-1.xhtml @@ -0,0 +1,31 @@ + + + + I + + +
+

I

+

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’s.

+

King Edward I’s.

+

King George I’s.

+

King Henry I’s.

+

King James I’s.

+

King William I’s.

+
+ + From e73f8dfe054f32ff8987351c2f2bd89012be52f2 Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner Date: Mon, 15 Jul 2024 11:35:31 -0400 Subject: [PATCH 2/2] Remove duplicate matches for s-103 --- se/se_epub_lint.py | 2 +- tests/lint/semantic/s-103/golden/s-103-out.txt | 18 ++++++------------ .../s-103/in/src/epub/text/chapter-1.xhtml | 2 -- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/se/se_epub_lint.py b/se/se_epub_lint.py index 89b66c8e..88990e31 100644 --- a/se/se_epub_lint.py +++ b/se/se_epub_lint.py @@ -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)) diff --git a/tests/lint/semantic/s-103/golden/s-103-out.txt b/tests/lint/semantic/s-103/golden/s-103-out.txt index 6e316594..9d6cc84f 100644 --- a/tests/lint/semantic/s-103/golden/s-103-out.txt +++ b/tests/lint/semantic/s-103/golden/s-103-out.txt @@ -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 @@ -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 diff --git a/tests/lint/semantic/s-103/in/src/epub/text/chapter-1.xhtml b/tests/lint/semantic/s-103/in/src/epub/text/chapter-1.xhtml index f5875457..f0384943 100644 --- a/tests/lint/semantic/s-103/in/src/epub/text/chapter-1.xhtml +++ b/tests/lint/semantic/s-103/in/src/epub/text/chapter-1.xhtml @@ -18,8 +18,6 @@

King Henry I.

King James I.

King William I.

-

King Charles I’s.

King Edward I’s.

King George I’s.