View Single Post
Old 09-04-2007, 07:32 PM   #87
EatingPie
Blueberry!
EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.
 
EatingPie's Avatar
 
Posts: 888
Karma: 133343
Join Date: Mar 2007
Device: Sony PRS-500 (RIP); PRS-600 (Good Riddance); PRS-505; PRS-650; PRS-350
Man. I added this myself, and decided that -- while I was at it -- I should come back here to add your code too (assuming it was a different feature!). That's what I get for reading a bunch of books in my spare time instead of this thread!

I'll post an update in a few days. I also have the code for non-page-breaking Chapters, but it's not plugged in yet. I have to try it out then I'll probably post the update flagged as beta.

Sorry, no image support. I'm not sure I'll ever add that.

-Pie

Quote:
Originally Posted by Lime2K View Post
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!
EatingPie is offline   Reply With Quote