Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 09-27-2014, 07:45 PM   #1
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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:
v0.3.0
- redesigned to work with either Python 2.7 or Python 3.4
- make use of plugin preferences available starting with Sigil 0.8.3 (which is required)
- tweaks to smartypants' regex to deal better with unicode characters
v0.3.1
- bad version

v0.3.2
- update to make use of Sigil's upcoming autostart/autoclose feature for plugins
- files selected in Book Browser are pre-selected in plugin widget
- add update check for plugin
v0.3.3
- prevent smartypants from mangling html comments
Attached Files
File Type: txt apos_exceptions.txt (130 Bytes, 3966 views)
File Type: zip PunctuationSmarten_v0.3.3.zip (18.3 KB, 3810 views)

Last edited by DiapDealer; 04-22-2018 at 10:47 AM.
DiapDealer is offline   Reply With Quote
Old 09-28-2014, 11:30 AM   #2
icallaci
Guru
icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.
 
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?
icallaci is offline   Reply With Quote
Advert
Old 09-28-2014, 11:48 AM   #3
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,044
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by icallaci View Post
Where do I put apos_exceptions.txt and how do I tell Sigil where to look for it?
You can keep the file wherever you want to on your system. When you run the plugin for the first time, check the box that indicates you want to use an apostrophe exception file. Use the button to the right of the text box to open a dialog to browse to where the file is located and select it. Select which files you wish to smarten and click process.

The settings (including the location of the exception file) will be remembered for subsequent sessions.
DiapDealer is offline   Reply With Quote
Old 09-28-2014, 11:58 AM   #4
icallaci
Guru
icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.
 
Posts: 796
Karma: 6528026
Join Date: Sep 2012
Device: Kobo Elipsa
Quote:
Originally Posted by DiapDealer View Post
You can keep the file wherever you want to on your system. When you run the plugin for the first time, check the box that indicates you want to use an apostrophe exception file. Use the button to the right of the text box to open a dialog to browse to where the file is located and select it. Select which files you wish to smarten and click process.

The settings (including the location of the exception file) will be remembered for subsequent sessions.
Ah, thanks. I didn't have an epub handy to try it out on, so I missed that.
icallaci is offline   Reply With Quote
Old 01-09-2015, 02:48 AM   #5
tempura
Connoisseur
tempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipedia
 
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.
tempura is offline   Reply With Quote
Advert
Old 01-10-2015, 02:11 PM   #6
tempura
Connoisseur
tempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipedia
 
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"
tempura is offline   Reply With Quote
Old 01-10-2015, 04:25 PM   #7
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,044
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by tempura View Post
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"
I see the problem--and I THINK I can fix it. Just have to do some testing to make sure the fix doesn't break something else.

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!
DiapDealer is offline   Reply With Quote
Old 01-11-2015, 06:44 AM   #8
tempura
Connoisseur
tempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipediatempura knows more than wikipedia
 
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.
tempura is offline   Reply With Quote
Old 02-02-2015, 12:53 PM   #9
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is offline   Reply With Quote
Old 02-02-2015, 02:41 PM   #10
Grizella
Member
Grizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a Texan
 
Posts: 17
Karma: 18298
Join Date: Jan 2015
Device: Mantano
How can i see what exactly has been changed?
Grizella is offline   Reply With Quote
Old 02-02-2015, 03:50 PM   #11
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,044
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Grizella View Post
How can i see what exactly has been changed?
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.
DiapDealer is offline   Reply With Quote
Old 02-02-2015, 09:27 PM   #12
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
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.
eschwartz is offline   Reply With Quote
Old 02-03-2015, 01:29 AM   #13
Grizella
Member
Grizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a Texan
 
Posts: 17
Karma: 18298
Join Date: Jan 2015
Device: Mantano
What about some HTML comments in the modified files?
Grizella is offline   Reply With Quote
Old 02-03-2015, 01:40 AM   #14
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
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.
eschwartz is offline   Reply With Quote
Old 02-03-2015, 02:12 AM   #15
Grizella
Member
Grizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a TexanGrizella might easily be mistaken for a Texan
 
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.
Grizella is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 11:43 PM.


MobileRead.com is a privately owned, operated and funded community.