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

Modernize aërial -> aerial #762

Merged
merged 2 commits into from
Oct 31, 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
6 changes: 3 additions & 3 deletions se/se_epub_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@
"y-019”, "Possible typo: [text]”[/] without opening [text]“[/]."
"y-020”, "Possible typo: consecutive comma-period ([text],.[/])."
"y-022”, "Possible typo: consecutive quotations without intervening text, e.g. [text]“…” “…”[/]."
"y-024”, "Possible typo: dash before [text]the/there/is/and/they/when[/] probably should be em-dash."
"y-024”, "Possible typo: dash before [text]the/there/is/and/or/they/when[/] probably should be em-dash."
"y-025”, "Possible typo: letter/comma/quote mark/letter with no intervening space."
"y-026”, "Possible typo: no punctuation before conjunction [text]But/And/For/Nor/Yet/Or[/]."
"y-027”, "Possible typo: Extra [text]’[/] at end of paragraph."
Expand Down Expand Up @@ -3047,9 +3047,9 @@ def _lint_xhtml_typo_checks(filename: Path, dom: se.easy_xml.EasyXmlTree, file_c
messages.append(LintMessage("y-022", "Possible typo: consecutive quotations without intervening text, e.g. [text]“…” “…”[/].", se.MESSAGE_TYPE_WARNING, filename, typos))

# Check for dashes instead of em-dashes
typos = [node.to_string() for node in dom.xpath("/html/body//p[re:test(., '\\s[a-z]+-(the|there|is|and|they|when)\\s')]")]
typos = [node.to_string() for node in dom.xpath("/html/body//p[re:test(., '\\s[a-z]+-(the|there|is|and|or|they|when)\\s')]")]
if typos:
messages.append(LintMessage("y-024", "Possible typo: dash before [text]the/there/is/and/they/when[/] probably should be em-dash.", se.MESSAGE_TYPE_WARNING, filename, typos))
messages.append(LintMessage("y-024", "Possible typo: dash before [text]the/there/is/and/or/they/when[/] probably should be em-dash.", se.MESSAGE_TYPE_WARNING, filename, typos))

# Check for letter/comma/quote mark/letter with no intervening space (rdquo is already handled by y-012)
typos = [node.to_string() for node in dom.xpath("/html/body//p[re:test(., '[a-z],[“‘’][a-z]', 'i')]")]
Expand Down
1 change: 1 addition & 0 deletions se/spelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def modernize_spelling(xhtml: str) -> str:
xhtml = regex.sub(r"\b([Cc])oërc", r"\1oerc", xhtml) # coërc -> coerc (as in coërcion)
xhtml = regex.sub(r"\b([Cc])oëd", r"\1oed", xhtml) # coëd -> coed (as in coëducation)
xhtml = regex.sub(r"\b([Dd])aïs\b", r"\1ais", xhtml) # daïs -> dais
xhtml = regex.sub(r"\b([Aa])ërial", r"\1erial", xhtml) # aërial -> aerial
xhtml = regex.sub(r"\b([Cc])oup[\- ]de[\- ]gr[aâ]ce", r"\1oup de grâce", xhtml) # coup-de-grace -> coup-de-grâce
xhtml = regex.sub(r"\b([Cc])anape", r"\1anapé", xhtml) # canape -> canapé
xhtml = regex.sub(r"\b([Pp])recis\b", r"\1récis", xhtml) # precis -> précis
Expand Down
2 changes: 1 addition & 1 deletion tests/lint/typos/y-024/golden/y-024-out.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
y-024 [Manual Review] chapter-1.xhtml Possible typo: dash before
`the/there/is/and/they/when` probably should be em-dash.
`the/there/is/and/or/they/when` probably should be em-dash.
<p>The cushion of-the celery becomes a clausal yak.</p>
<p>A desk sees-there as a patent description.</p>
<p>An unrhymed leopard without kittens-is truly a twist of hoven
Expand Down
Loading