![]() |
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'Code:
John said, “The man said ‘aaaaa’RIGHT: Code:
John said, “The man said ‘aaaaa’Thanks for any cases given. |
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. |
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> |
A dash can be inside or outside quotes. Is this handled correctly?
Code:
<p>"Blah blah"--he said, and continued--"blah, blah blah."</p> |
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. |
Quote:
Code:
“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. |
Glad you solved the problems of quotes with spaces. This is very very common in older works.
|
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) |
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:
|
| All times are GMT -4. The time now is 08:52 PM. |
Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.