comparison curlers.py @ 25:d3eb798f7e95

Fix curling inside double quotes.
author David Barts <n5jrn@me.com>
date Sun, 15 Mar 2020 10:52:55 -0700
parents f8d0a5201dd7
children d5bf9985b5c4
comparison
equal deleted inserted replaced
24:f4cc6d8cafe8 25:d3eb798f7e95
90 if char == "\"": 90 if char == "\"":
91 # closing double quote 91 # closing double quote
92 ws[pos] = RDQUO 92 ws[pos] = RDQUO
93 self._state = self._norm 93 self._state = self._norm
94 elif char == "'": 94 elif char == "'":
95 if ws[pos-1].isalpha(): 95 if ws[pos-1].isalnum():
96 # either an inter-word, or an end of word, apostrophe 96 # either an inter-word, or an end of word, apostrophe
97 ws[pos] = APOS 97 ws[pos] = APOS
98 elif ws[pos+1].isdecimal() or _is_cockney(pos, ws): 98 elif ws[pos+1].isdecimal() or _is_cockney(pos, ws):
99 # also an apostrophe 99 # also an apostrophe
100 ws[pos] = APOS 100 ws[pos] = APOS
203 elif char == "\"": 203 elif char == "\"":
204 # closing double quote 204 # closing double quote
205 ws[pos] = RDQUO 205 ws[pos] = RDQUO
206 self._state = self._norm 206 self._state = self._norm
207 elif char == "'": 207 elif char == "'":
208 if ws[pos-1].isalpha(): 208 if ws[pos-1].isalnum():
209 # either an inter-word, or an end of word, apostrophe 209 # either an inter-word, or an end of word, apostrophe
210 ws[pos] = APOS 210 ws[pos] = APOS
211 elif ws[pos+1].isdecimal() or _is_cockney(pos, ws): 211 elif ws[pos+1].isdecimal() or _is_cockney(pos, ws):
212 # also an apostrophe 212 # also an apostrophe
213 ws[pos] = APOS 213 ws[pos] = APOS