View Single Post
Old 08-02-2007, 11:18 PM   #85
Lime2K
Member
Lime2K began at the beginning.
 
Lime2K's Avatar
 
Posts: 21
Karma: 10
Join Date: May 2007
Device: Sony Reader (PRS-500)
Talking

Here's a bug report, _and_ the fix for it (it was a really easy one)

PieLRF wasn't recognizing ‘ and ’ as single quotes.

Here's the original code <in textconvert.py>, under <def convert_html_ampersands>

Code:
The original code:
if html_quotes :
	line = line.replace("&ldquo;", u"\u201C") # OPEN
	line = line.replace("&rdquo;", u"\u201D") # CLOSE
	line = line.replace("", u"\u201C")
	line = line.replace("", u"\u201D")
	line = line.replace("", u"\u2018")
	line = line.replace("", u"\u2019")
else :
	line = line.replace("&ldquo;", u"\"")
	line = line.replace("&rdquo;", u"\"")
	line = line.replace("", u"\"")
	line = line.replace("", u"\"")
	line = line.replace("", u"'")
	line = line.replace("", u"'")
#endif 

Replace with:
if html_quotes :
	line = line.replace("&ldquo;", u"\u201C") # OPEN
	line = line.replace("&rdquo;", u"\u201D") # CLOSE
	line = line.replace("", u"\u201C")
	line = line.replace("", u"\u201D")
	line = line.replace("&lsquo;", u"\u2018")
	line = line.replace("&rsquo;", u"\u2019")
	line = line.replace("", u"\u2018")
	line = line.replace("", u"\u2019")
else :
	line = line.replace("&ldquo;", u"\"")
	line = line.replace("&rdquo;", u"\"")
	line = line.replace("", u"\"")
	line = line.replace("", u"\"")
	line = line.replace("&lsquo;", u"'")
	line = line.replace("&rsquo;", u"'")
	line = line.replace("", u"'")
	line = line.replace("", u"'")
#endif
This keeps the correct behavior of --html-quotes.

I fixed it in my personal copy already, but am posting it here so it makes it into the official releases as well.

Enjoy!
Lime2K is offline   Reply With Quote