View Single Post
Old 02-08-2011, 01:05 PM   #23
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
I just found a file that exhibited this problem heavily today, and the root cause wasn't unbalanced quotes in the source file. It was actually spaces between the quoted text and the quotes. That really confuses the smartypants function.

A 'bad' example:
" This is bad... "

A 'good' example:
"This is good..."

There isn't really an easy way to fix this automatically with regex - I tried - you just need to go through the text and find places where there is an offending space. You can use a regex to make it simpler though:
"\s+(?=\w)

(?<=\W)\s+"

(?<=\w)\s+"

Just search through the text with those patterns, and replace with " when it's a real match.
ldolse is offline   Reply With Quote