09-27-2014, 07:45 PM | #1 |
Grand Sorcerer
Posts: 28,044
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
[Plugin] PunctuationSmarten Sigil plugin
*Note: I recommend uninstalling any older versions of this plugin made for the alpha release of Sigil before installing the newer version which requires Sigil v0.8.3 and later *
*** Linux users will have to make sure that the Tk graphical python module is present if it's not already. On Debian-based flavors this can be done with "sudo apt-get install python3-tk" (or python2-tk). On Arch distributions it can be done with pacman -S tk)*** ** NOTE: this plugin periodically checks for updated versions by connecting to github (where the source is maintained). See the end of this post for more details ** This plugin will work with either Python 3.4+ or Python 2.7+. This is a Punctuation smartening plugin. It's basically the same plugin as the one I did for calibre's editor, but modified to work with Sigil. It gives you a little more granular control over the SmartyPants engine and adds the ability to define an apostrophe exceptions file for words like ('tis and such). Simply put one word per line (without the apostrophe) in a text file and it will give those words the proper apostrophe instead of a left (opening) single quote. EDIT: also going to attach a sample apostrophe exceptions file. Be cautious that you don't include something that could be a word in its own right that just happens to follow a single quote. PunctuationSmarten's code is hosted/maintained on Github This plugin's update checker will only try to check for updates after at least 12 hours has elapsed since its last check. The plugin will only notify you about updates once for each new version released. Changes Spoiler:
Last edited by DiapDealer; 04-22-2018 at 10:47 AM. |
09-28-2014, 11:30 AM | #2 |
Guru
Posts: 796
Karma: 6528026
Join Date: Sep 2012
Device: Kobo Elipsa
|
Where do I put apos_exceptions.txt and how do I tell Sigil where to look for it?
|
Advert | |
|
09-28-2014, 11:48 AM | #3 | |
Grand Sorcerer
Posts: 28,044
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
The settings (including the location of the exception file) will be remembered for subsequent sessions. |
|
09-28-2014, 11:58 AM | #4 | |
Guru
Posts: 796
Karma: 6528026
Join Date: Sep 2012
Device: Kobo Elipsa
|
Quote:
|
|
01-09-2015, 02:48 AM | #5 |
Connoisseur
Posts: 71
Karma: 47102
Join Date: Dec 2013
Location: Outside the Universe
Device: Kindle PW3
|
DiapDealer, thank you so much, I have been looking forward to this feature. Love the apos_exceptions.
|
Advert | |
|
01-10-2015, 02:11 PM | #6 |
Connoisseur
Posts: 71
Karma: 47102
Join Date: Dec 2013
Location: Outside the Universe
Device: Kindle PW3
|
Hey, DiapDealer, again. I just noticed an odd behaviour on your plugin. I used it on a book which had a character named "Philonoë". So, when I actually use the plugin it produces "Philonoë‘s" instead of "Philonoë’s" i.e. the opening quote instead of the closing quote. Hope this can be fixed. Also, occurs with "Philonoë’d"
|
01-10-2015, 04:25 PM | #7 | |
Grand Sorcerer
Posts: 28,044
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
Looking for the problem also illuminated a different issue that I'm not sure I can fix. The Smartypants algorithm does a lot of regex lookarounds to determine if a preceding (or following) character is (or isn't) a "word" character. It's not a problem with your example, but consider if your example used an entity instead of a unicode character: I can fix it so "Philonoë'd" or "Philonoë's" is smartened correctly. But if you (or anyone) uses an entity instead of a character in that situation); like "Philonoë'd" or Philonoë's", then the regex being used has no (easy) way of determining if the preceding entity does (or doesn't) represent a word character. Even if with the fix I have planned, the smartening algorithm would fail in that situation. Thanks for pointing out the original issue! |
|
01-11-2015, 06:44 AM | #8 |
Connoisseur
Posts: 71
Karma: 47102
Join Date: Dec 2013
Location: Outside the Universe
Device: Kindle PW3
|
Good to hear.
Thanks for pointing out the exception, luckily for me, I tend to reduce the usage of "entities" when creating epubs, so, perhaps that won't affect me much. But it's always better to know than not. Once again. |
02-02-2015, 12:53 PM | #9 |
Grand Sorcerer
Posts: 28,044
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Updated the first post with a much-needed update to the plugin. It uses the new preferences functionality that Sigil 0.8.3 provides and so Sigil v0.8.3 is, in fact, the minimum version necessary to use the plugin.
Also tweaked smartypants' regex to deal better with unicode characters (thanks @tempura). It will work with either Python 3 (3.4 or higher) or Python 2.7. |
02-02-2015, 02:41 PM | #10 |
Member
Posts: 17
Karma: 18298
Join Date: Jan 2015
Device: Mantano
|
How can i see what exactly has been changed?
|
02-02-2015, 03:50 PM | #11 |
Grand Sorcerer
Posts: 28,044
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I don't provide any kind of diff or undo feature if that's what you mean. The plugin will tell you which files it modified, but other than that ... you're on your own. Don't save the epub if you're unsure, and always keep good backups.
|
02-02-2015, 09:27 PM | #12 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
If you need diffing features, you will need to use calibre's editor.
|
02-03-2015, 01:29 AM | #13 |
Member
Posts: 17
Karma: 18298
Join Date: Jan 2015
Device: Mantano
|
What about some HTML comments in the modified files?
|
02-03-2015, 01:40 AM | #14 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
That would require writing extraneous info to the files, and then expecting everyone to remove them afterward, just to provide a halfway approach to showing talking about a change diff. And then you have to go around searching for the comments.
A better idea would be to use actual diffing. calibre can do it. In fact, calibre's editor can also compare any two books that were edited by other tools. Perhaps someone will formulate a diff feature for Sigil, though I wouldn't hold my breath. |
02-03-2015, 02:12 AM | #15 |
Member
Posts: 17
Karma: 18298
Join Date: Jan 2015
Device: Mantano
|
Well i'm not using calibre and dont want to install it just for this. Maybe the html comments can be made configurable and once they have something unique and common in it you can get rid of them by a stored search in a second.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Plugin] ePub3-itizer - epub3 output plugin for Sigil | KevinH | Plugins | 456 | 10-27-2024 07:00 AM |
epubcheck plugin for Sigil | Doitsu | Plugins | 533 | 10-24-2024 04:32 PM |
[Plugin] KindleImport Sigil plugin | DiapDealer | Plugins | 187 | 07-04-2022 11:11 AM |
icarus Sigil plugin | AlPe | Plugins | 26 | 12-05-2017 11:03 AM |
smoothRemove_v010 plugin for Sigil | kbanelas | Plugins | 15 | 01-27-2017 06:51 PM |