diff --git a/se/se_epub_lint.py b/se/se_epub_lint.py index 2227766f..e8008722 100644 --- a/se/se_epub_lint.py +++ b/se/se_epub_lint.py @@ -3047,8 +3047,8 @@ def _lint_xhtml_typo_checks(filename: Path, dom: se.easy_xml.EasyXmlTree, file_c if typos: messages.append(LintMessage("y-028", "Possible typo: [xhtml][/] directly preceded or followed by letter.", se.MESSAGE_TYPE_WARNING, filename, typos)) - # Check for misapplied italics. Ignore 's' because the plural is too common. - typos = [node.to_string() for node in dom.xpath("/html/body//*[(name() = 'i' or name() = 'em') and ./following-sibling::node()[1][re:test(., '^[a-z]\\b', 'i') and not(re:test(., '^s\\b'))]]")] + # Check for misapplied italics. Ignore 's' because the plural is too common. i with epub:type handled by y-032. + typos = [node.to_string() for node in dom.xpath("/html/body//*[(name() = 'em' or (name() = 'i' and not(@epub:type))) and ./following-sibling::node()[1][re:test(., '^[a-z]\\b', 'i') and not(re:test(., '^s\\b'))]]")] if typos: messages.append(LintMessage("y-029", "Possible typo: Italics followed by a letter.", se.MESSAGE_TYPE_WARNING, filename, typos)) @@ -3059,13 +3059,13 @@ def _lint_xhtml_typo_checks(filename: Path, dom: se.easy_xml.EasyXmlTree, file_c # Check for missing punctuation in continued quotations # ” said Bob “ - nodes = dom.xpath("/html/body//p[re:test(., '”\\s(?:said|[A-Za-z]{2,}ed)\\s[A-Za-z]+?(?Newspapers - nodes = dom.xpath("/html/body//i[@epub:type and ( (following-sibling::node()[1][re:test(., '^[a-z]', 'i') and not(re:test(., '^(s|es|er)'))]) or preceding-sibling::node()[1][re:test(., '[a-z]$')]) ]") + nodes = dom.xpath("/html/body//i[@epub:type and ( (following-sibling::node()[1][re:test(., '^[a-z]', 'i') and not(re:test(., '^(s|es|er)\\b'))]) or preceding-sibling::node()[1][re:test(., '[a-z]$')]) ]") if nodes: messages.append(LintMessage("y-032", "Possible typo: Italics running into preceding or following characters.", se.MESSAGE_TYPE_WARNING, filename, [node.to_string() for node in nodes])) diff --git a/tests/lint/typos/y-031/golden/y-031-out.txt b/tests/lint/typos/y-031/golden/y-031-out.txt new file mode 100644 index 00000000..9fce95f2 --- /dev/null +++ b/tests/lint/typos/y-031/golden/y-031-out.txt @@ -0,0 +1,26 @@ +t-005 [Manual Review] chapter-1.xhtml Dialog without ending comma. + fay” she said +y-031 [Manual Review] chapter-1.xhtml Possible typo: Dialog tag missing +punctuation. +

“Good boy,” said old “Kiowa.” “You’d better go get some supper.”

+

He pronounced the inhibition lengthily and sonorously, so that the +“not” sounded like “n‑o‑o‑o‑t!”

+

“Ah well,” he said “then let’s take off this little frock.”

+

The sharp reprimand was not lost upon her, and in time it came to +pass that for “fay” she said “succeed.”

+

Catching, however, two words which sounded like the English “White” +and “Red,” I said “Yaw” after the last.

+

She hadn’t much reserve of patience, and at the end of the second +game, when Ella Stowbody sniffily asked her, “Are you going to send to +Minneapolis for your dress for the next soirée—heard you were,” Carol said +“Don’t know yet” with unnecessary sharpness.

+

“Keep away from women and horses and, and—” he stopped “—eagles, +Billy.”

+

When they told her to respond with “Amen,” she responded “Amen.”

+

When told to “look closely,” I said “why?”

+

“Forget that nonsense,” Andy exclaimed “forcefully.”

+

“A chary enquiry is a ghost of the mind,” said Billy adroitly +“unfortunately, that is wrong; on the contrary, their bathtub was, in this +moment, a petite underwear.”

+

“Liars are perjured quills,” whispered someone sweetly “a bathroom is +a lip's coal.”

diff --git a/tests/lint/typos/y-031/in/src/epub/text/chapter-1.xhtml b/tests/lint/typos/y-031/in/src/epub/text/chapter-1.xhtml new file mode 100644 index 00000000..3b491c09 --- /dev/null +++ b/tests/lint/typos/y-031/in/src/epub/text/chapter-1.xhtml @@ -0,0 +1,75 @@ + + + + I + + + + +
+

I

+ +

“Father is very much hurt,” she said, “that you have written nothing to him.”

+ + +

“Their felony was, in this moment, an arcane spain,” “Nancy” said to the “paperboy.”

+ +

“The first daimen summer is, in its own way, a shock,” said Joe to “Charlie.”

+ +

“What we don't know for sure is whether or not the shaven bait comes from a filthy scarf,” said John with “sarcasm.”

+ +

“Extending this logic, they were lost without the punchy field that composed their weather,” said Daniel from “compassion.”

+ +

“Killjoy” said to a “friend,” “An earth sees a weather as an unstilled jacket.”

+ +

“Nonsense,” said friend is “persona non grata.”

+ +

“Unless,” added the “mistress,” with a smile that half belied the severity of her speech ⁠…

+ +

“The Bottoms” succeeded to “Hell Row.”

+ +

Her plaintive dirges for “notre malheureuse patrie,” interpolated with “charmant” and “mon prince,” died away along the terrace.

+ +

Probably Smith had fresh in his recollection the passage in which Madox ridicules as a “piece of puerility” the use of the English word “misterie,” derived from “the Gallic word mestera.”

+ +

“Well, Mary,” answered a “dear-me-what-now” voice.

+ +

The order in council for the printing and publishing a declaration of war against Denmark is dated “Whitehall, Sept. 19, 1666”; annexed is “A True Declaration of all transactions⁠ ⁠…”

+ +

“Good boy,” said old “Kiowa.” “You’d better go get some supper.”

+ +

He pronounced the inhibition lengthily and sonorously, so that the “not” sounded like “n‑o‑o‑o‑t!”

+ + + +

You said “for a space.” I said “for a while.”

+ +

“Better’n a bleedin’ dipso!” Lips said “S.h.h.h!

+ +

“What do you think you’re doing?” I said “Nothing.”

+ +

“But he’s not here.” She added “He’s not been here with me.”

+ +

“Ah well,” he said “then let’s take off this little frock.”

+ +

The sharp reprimand was not lost upon her, and in time it came to pass that for “fay” she said “succeed.”

+ +

Catching, however, two words which sounded like the English “White” and “Red,” I said “Yaw” after the last.

+ +

She hadn’t much reserve of patience, and at the end of the second game, when Ella Stowbody sniffily asked her, “Are you going to send to Minneapolis for your dress for the next soirée—heard you were,” Carol said “Don’t know yet” with unnecessary sharpness.

+ +

“Keep away from women and horses and, and—” he stopped “—eagles, Billy.”

+ +

When they told her to respond with “Amen,” she responded “Amen.”

+ +

When told to “look closely,” I said “why?”

+ +

“Forget that nonsense,” Andy exclaimed “forcefully.”

+ + +

“A chary enquiry is a ghost of the mind,” said Billy adroitly “unfortunately, that is wrong; on the contrary, their bathtub was, in this moment, a petite underwear.”

+ +

“Liars are perjured quills,” whispered someone sweetly “a bathroom is a lip's coal.”

+
+ + diff --git a/tests/lint/typos/y-032/golden/y-032-out.txt b/tests/lint/typos/y-032/golden/y-032-out.txt new file mode 100644 index 00000000..99947515 --- /dev/null +++ b/tests/lint/typos/y-032/golden/y-032-out.txt @@ -0,0 +1,4 @@ +y-032 [Manual Review] chapter-1.xhtml Possible typo: Italics running into +preceding or following characters. + Hamlet + Threatful Flood diff --git a/tests/lint/typos/y-032/in/src/epub/text/chapter-1.xhtml b/tests/lint/typos/y-032/in/src/epub/text/chapter-1.xhtml new file mode 100644 index 00000000..ef3936dc --- /dev/null +++ b/tests/lint/typos/y-032/in/src/epub/text/chapter-1.xhtml @@ -0,0 +1,27 @@ + + + + I + + + + +
+

I

+ +

I will here produce a few extracts taken from our Protocol of Peace for the year 1867.

+ +

It was Caesar’s Commentaries, which La Ramee had lent him.

+ +

All my Heralds went off like hot cakes.

+ +

Once there happened to be only two Semper Augustuses in all Holland, one in Haarlem and one in Amsterdam.

+ +

A well-informed Critical Reviewer would have amended the title thus: “Lucian reviv’d: or Gulliver Beat with his own Bow.”

+ +

This one was definitely the Hamletest of the fake Hamlets.

+ +

Recent controversy aside, aThreatful Flood is a litter of the mind.

+
+ + diff --git a/tests/lint/typos/y-033/golden/y-033-out.txt b/tests/lint/typos/y-033/golden/y-033-out.txt new file mode 100644 index 00000000..b6d7b3a6 --- /dev/null +++ b/tests/lint/typos/y-033/golden/y-033-out.txt @@ -0,0 +1,4 @@ +y-033 [Manual Review] chapter-1.xhtml Possible typo: Three-em-dash obscuring an +entire word, but not preceded by a space. +

Joy to me! Come hither! Give me thy hand⸺ha! let be! aha!⸺Disgust, +disgust, disgust⸻alas to me!

diff --git a/tests/lint/typos/y-033/in/src/epub/text/chapter-1.xhtml b/tests/lint/typos/y-033/in/src/epub/text/chapter-1.xhtml new file mode 100644 index 00000000..c54abfa6 --- /dev/null +++ b/tests/lint/typos/y-033/in/src/epub/text/chapter-1.xhtml @@ -0,0 +1,23 @@ + + + + I + + + + +
+

I

+ +

⸻ Odenheimer, restaurateur. This witness volunteered his testimony.”

+ +

Augustus seized one of the muskets lying on the floor and shot another mutineer (⸻ Wilson) through the breast.

+ +

At this time I did a little humble work for the ⸻, but was quite resolved to fly at higher game than that.

+ +

“⁠⸻ to you,” she flung scornfully at them over her shoulder.

+ +

Joy to me! Come hither! Give me thy hand⸺ha! let be! aha!⸺Disgust, disgust, disgust⸻alas to me!

+
+ +