![]() |
#1 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
Smart Quotes help (for Sigil plugin)
I'm working on a python script which hopefully will be an improvement on smartypants (used by plugin for Sigil), and would like some help with regards as what doesn't work correctly.
The ones I don't think will ever be satisfactorily solved will be where there's words which start with an apostrophe, such as 'Twas brillig, and the slithy toves.... (Having said that, I could have a list of known 'words - 'tis, 'twas 'cause etc.) If you've got any known flubs, please can you let me know, with a small example as well if possible, and what it should look like when done correctly. Ones like Code:
John said, "The man said 'aaaaa' " 'bbbb' " 'cccc' " dddd " and then ended the story." Code:
John said, “The man said ‘aaaaa’ ” ‘bbbb’ “ ‘cccc’ ” dddd ” and then ended the story.” RIGHT: Code:
John said, “The man said ‘aaaaa’ “ ‘bbbb’ “ ‘cccc’ “ dddd “ and then ended the story.” Thanks for any cases given. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,335
Karma: 203719142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
There's a weird situation I can't nail down 100% where smartypants reverses a closing quote (makes it an opening one). When it does happen, it seems to be near an emdash entity (or character). But that seems to be bug, rather than a special typographic situation it doesn't handle.
I also thought of creating a user-editable list/dictionary of 'tis-type words that could be integrated into smarty (or another) script. ![]() I think you've identified the two big "deal-breaker" scenarios where SmartyPants is concerned, though. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
I think I know what you mean, but using your smartypants plugin - it does them correctly -- although it removes two spaces, where they appear between the dashes and the quotes. I think when the space stays there, smartypants did an opening quote rather than a closing one.
Code:
<p>He said, "Go away -- "</p> <p>He said, "Go away --"</p> <p>He said, 'Go away -- '</p> <p>He said, 'Go away --'</p> |
![]() |
![]() |
![]() |
#4 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,542
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
A dash can be inside or outside quotes. Is this handled correctly?
Code:
<p>"Blah blah"--he said, and continued--"blah, blah blah."</p> <p>"Blah blah--" he said, and continued, "--blah, blah, blah."</p> |
![]() |
![]() |
![]() |
#5 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,335
Karma: 203719142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
In my wrapper script however, I do a little pre/post processing to achieve some personal goals that wouldn't be possible with smartypants alone (borrowing heavily from calibre). Those changes may not suit others, but they're pretty easily tweaked. For instance: 1) I preserve any html comments present. Smarty would butcher those double-dashes (calibre does the same thing). 2) I remove spaces that may occur on either side of double-dashes; simply because I find spaces before or after emdashes aesthetically unappealing when reading. 3) Smarty uses numeric entities for the quotation marks, emdashes and ellipses it creates. I've made arrangements to selectively convert those entities that Smarty creates to characters where it suits me. I think Perkins' script is only going to be dealing with quotation marks, though. Which makes sense since "fixing" the double-dash and the "three consecutive periods" stuff is pretty trivial, really. Last edited by DiapDealer; 08-20-2013 at 05:55 PM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
Quote:
Code:
“Blah blah”–he said, and continued–“blah, blah blah.” “Blah blah–” he said, and continued, “–blah, blah, blah.” Code:
<p>"Blah blah-- " he said, and continued, " --blah, blah, blah."</p> I'm working on correcting that. Edit: Just solved that particular problem as well. Last edited by Perkin; 08-20-2013 at 06:05 PM. |
|
![]() |
![]() |
![]() |
#7 |
Color me gone
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
Glad you solved the problems of quotes with spaces. This is very very common in older works.
|
![]() |
![]() |
![]() |
#8 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
Uploaded the plugin to DiapDealer' PlugIn thread, here
It's in post #19 Edit: It converts quotes/apostophe and the mdash,ndash,ellipsis, and preserves html comments and does the words that begin with an apostrophe - from an apos_exceptions.txt file If you don't want it to do any of the (m/n)dash or ellipsis entities, you can comment out the lines (add a # to beginning of the line) in the smarten.py file 30, 31, 32 (calculate extras for the entities) 42, (add pre tags to comments) 56, 57, 58 (convert the entities) 119 (remove the pre tags from comments) Last edited by Perkin; 08-22-2013 at 09:08 AM. |
![]() |
![]() |
![]() |
#9 | |
Connoisseur
![]() Posts: 57
Karma: 10
Join Date: Dec 2011
Device: Samsung Tablet
|
Here's a list of my saved searches for Quote fixes. Some also include changing hyphens to mdash also. No text examples to go with them sorry.
Quote:
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Smart Quotes | crutledge | Calibre | 8 | 12-27-2012 07:35 PM |
Creating smart quotes in Sigil? | MacEachaidh | Sigil | 15 | 02-28-2012 07:29 PM |
Smart Quotes | Paxman53 | Sigil | 15 | 02-15-2012 08:31 PM |
Smart Quotes | Toxaris | ePub | 2 | 05-31-2010 10:32 AM |
Removing smart quotes | horseyride | Workshop | 8 | 03-06-2008 12:08 PM |