Skip to content

Commit

Permalink
Report curly quotes preceded by punctuation (#713)
Browse files Browse the repository at this point in the history
Example: `based on nature.“[A]`

Fixes #704
  • Loading branch information
windymilla authored Jan 31, 2025
1 parent d42f607 commit f83f69f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/guiguts/misc_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1879,6 +1879,7 @@ def populate(self) -> None:
search_start = maintext().start()
search_end = maintext().index(tk.END)
last_open_double_idx = ""
punctuation = ".,;:!?"
while match := maintext().find_match(
rf"^$|[{DQUOTES}{SQUOTES}\"']",
IndexRange(search_start, search_end),
Expand Down Expand Up @@ -1919,6 +1920,8 @@ def add_quote_entry(prefix: str) -> None:
add_quote_entry("DOUBLE OPEN QUOTE FOLLOWED BY SPACE: ")
elif context[0].isalnum():
add_quote_entry("DOUBLE OPEN QUOTE PRECEDED BY WORD CHARACTER: ")
elif context[0] in punctuation:
add_quote_entry("DOUBLE OPEN QUOTE PRECEDED BY PUNCTUATION: ")
dqtype = 1
last_open_double_idx = match.rowcol.index()
elif match_text == DQUOTES[1]: # Close double
Expand Down Expand Up @@ -1954,6 +1957,8 @@ def add_quote_entry(prefix: str) -> None:
add_quote_entry("SINGLE OPEN QUOTE FOLLOWED BY SPACE: ")
elif context[0].isalnum():
add_quote_entry("SINGLE OPEN QUOTE PRECEDED BY WORD CHARACTER: ")
elif context[0] in punctuation:
add_quote_entry("SINGLE OPEN QUOTE PRECEDED BY PUNCTUATION: ")
elif match_text == SQUOTES[1]: # Close single
pass # Close singles/apostrophes can go almost anywhere
elif match_text == '"': # Straight double
Expand Down

0 comments on commit f83f69f

Please # to comment.