Skip to content

Commit

Permalink
Add “or” to y-024 lint check
Browse files Browse the repository at this point in the history
  • Loading branch information
robinwhittleton committed Oct 31, 2024
1 parent 83bbaf2 commit ec3cc9b
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit ec3cc9b

Please sign in to comment.