Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Closed Thread
 
Thread Tools Search this Thread
Old 08-06-2014, 12:12 PM   #31
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: 27,441
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by arspr View Post
Nevertheless one hint: I mounted my attached exception file from your example (downloaded from the initial post). And when I opened it (Windows Notepad), all the words were in the very same line with some kind of non-printable character between them. So I immediately thought about the UNIX-Windows CR/LF (or whatever) conflict and retyped those "return key" symbols in their place. So my file should be a pure genuine windows friendly one. Could it be the source of the trouble?
Shouldn't matter. The file is read in binary mode which should eliminate any EOL character nonsense. I've created those files on Win/Mac/Linux and mixed and matched their usage on the other platforms with no issues. But I'll double-check to be sure. If you get a chance, upload a small epub sample so I can be certain I'm starting with the exact same input as you are. Then I can pair that with your exceptions file to see if I can see what's going on.
DiapDealer is offline  
Old 08-06-2014, 12:18 PM   #32
arspr
Dead account. Bye
arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.
 
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none
Quote:
Originally Posted by DiapDealer View Post
Shouldn't matter. The file is read in binary mode which should eliminate any EOL character nonsense. I've created those files on Win/Mac/Linux and mixed and matched their usage on the other platforms with no issues. But I'll double-check to be sure. If you get a chance, upload a small epub sample so I can be certain I'm starting with the exact same input as you are. Then I can pair that with your exceptions file to see if I can see what's going on.
See my previous post (now edited). I can fully replicate the issue with your sample _before.epub

OTOH How do you manage to get ' correctly modified before decades in number? Because any automated decision you make can be really risky.

Last edited by arspr; 08-06-2014 at 12:24 PM.
arspr is offline  
Advert
Old 08-06-2014, 01:58 PM   #33
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: 27,441
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by arspr View Post
See my previous post (now edited). I can fully replicate the issue with your sample _before.epub
I'll be damned. I can replicate it with your exception file too! But in all fairness... that file is one weird puppy. It starts off with a UTF8 byte order mark (which is being included with the first 'bout' entry); each line is terminated with a CR/LF and then there's an additional LF character in between every entry. What did you use to create it?

I'll see if I can't come up with something to scrub the file of UTF8 BOM and additional LF characters before processing.

Quote:
OTOH How do you manage to get ' correctly modified before decades in number? Because any automated decision you make can be really risky.
I don't DO anything. SmartyPants looks for a single-straight quote immediately followed by two digits that are immediately followed by the lower-case letter 's' ... and changes that straight-single quote to a curly right-single quote. There are a few other details that take care of unique situations, but that's the gist of it. I don't really see the "risk" in that. Instead of worrying about it, why not offer up a situation where my tool gets 'XXs wrong? Or calibre's smartener for that matter. They're no different in that regard. Just straight-up SmartyPants. Besides ... the decades thing is easy enough to double-check with a regex search.

I'm not trying to offer up any new, infallible quotation-smartening logic here. All the caveats for algorithmic quotation-smartening still apply. I'm just looking to add more control to WHAT you want to smarten, and to lessen the number of 'tis 'bout and 'cept'n foul-ups, and to do so without affecting any code in the document that doesn't pertain to punctuation being smartened.
DiapDealer is offline  
Old 08-06-2014, 02:14 PM   #34
arspr
Dead account. Bye
arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.
 
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none
Yes, I've also noticed those EOL rubbish and that is the indirect cause of it. Because of those EOL troubles and duplications, there are in fact BLANK lines in the text which Notepad doesn't show, (which is the software I firstly used and which leads to that buggy file) but Notepad++ does. (I was actually testing it).

And the problem is that if you leave just one single BLANK line in the exception file, (even at the end of it), the plugin fails in that way: every single word is qualified as a contraction... I really think you should filter out blank lines.

Test it, just use your .txt and type a return at the end of the file (or in the middle).
arspr is offline  
Old 08-06-2014, 03:14 PM   #35
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: 27,441
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by arspr View Post
I really think you should filter out blank lines.
I plan to.
But keep in mind that I'm not interested in absolving users of any and all responsibility for providing valid input. If that file gets too hairy, it's getting ignored.

Last edited by DiapDealer; 08-06-2014 at 03:17 PM.
DiapDealer is offline  
Advert
Old 08-06-2014, 09:11 PM   #36
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
@DiapDealer -- Been playing with the PI a little. Very nice and going to be handy.

Q - in the delete spans, divs, etc. would you consider a little wildcard capability. Nothing like regex, but maybe something simple like ? and * for 1 char and many chars when matching class = " " ?

I know the screen shot is a little dumb since "filepos#####" is used for ID's and not classes, but the idea is basically the same
Attached Thumbnails
Click image for larger version

Name:	Capture.JPG
Views:	299
Size:	74.4 KB
ID:	126463  

Last edited by phossler; 08-06-2014 at 09:15 PM.
phossler is offline  
Old 08-06-2014, 11:35 PM   #37
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: 27,441
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by phossler View Post
@DiapDealer -- Been playing with the PI a little. Very nice and going to be handy.

Q - in the delete spans, divs, etc. would you consider a little wildcard capability. Nothing like regex, but maybe something simple like ? and * for 1 char and many chars when matching class = " " ?

I know the screen shot is a little dumb since "filepos#####" is used for ID's and not classes, but the idea is basically the same
I'd love to try. I don't know how successful I'll be at it, but it makes perfect sense.
DiapDealer is offline  
Old 08-09-2014, 12:20 PM   #38
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: 27,441
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Posting a somewhat beta-version of the plugin that contains many of the changes discussed.

** NOTE: because of horrible planning on my part, the atrociously named "diaps_editing_toolbag_SpanDivEdit_settings.js on" file in the plugin folder of calibre's configuration directory must be deleted before many of the changes to the Span/Div Editor Tool will appear (for those who have a previous version of the plugin installed). For that, I apologize. The file will not be recreated until I find a better way to handle customization. **

Changes to the Span/Div Editor tool:
1) inclusion of more html elements to delete/modify
2) inclusion of more choices to change those html elements to
3) more attributes to choose from in search criteria
4) the ability to use regex in the search box
(Regex is search-only at this point. There is no way currently to use regex captures to build the replacement attribute string when modifying.)

Changes to the Smarten Punctuation tool:
1) Makes sure the apostrophe exceptions file is somewhat sanitized before use (mainly makes sure blank lines and UTF-8 BOM doesn't make things barf)
Attached Files
File Type: zip diaps_toolbag_v0.2.0_plugin.zip (71.4 KB, 189 views)

Last edited by DiapDealer; 08-09-2014 at 01:19 PM.
DiapDealer is offline  
Old 08-11-2014, 12:38 PM   #39
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
Originally Posted by DiapDealer View Post
... doesn't make things barf)
1. Can you put that in less technical language??

2. Thanks - even the alpha-version of the PI has been very useful to cleanup a number of inefficiently formatted epubs. More than once I've messed up the RegEx doing that manually and had to revert to a previously saved version. The PI is safer AND less work

3. Keep 'PlugIn-g' away (pun intended)
phossler is offline  
Old 08-12-2014, 01:25 PM   #40
arspr
Dead account. Bye
arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.
 
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none


Noob question with plugins as I cannot find it in the Calibre User Manual:

Where is the plugin stored (Calibre in Windows) and therefore its diaps_editing_toolbag_SpanDivEdit_settings.json file? I've searched for it in the Calibre directory (and just for *.json) and I cannot find nothing relevant...
arspr is offline  
Old 08-12-2014, 01:35 PM   #41
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: 27,441
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by arspr View Post


Noob question with plugins as I cannot find it in the Calibre User Manual:

Where is the plugin stored (Calibre in Windows) and therefore its diaps_editing_toolbag_SpanDivEdit_settings.json file? I've searched for it in the Calibre directory (and just for *.json) and I cannot find nothing relevant...
On Windows, calibre's configuration directory is usually in your user directory:
"<username>/AppData/Roaming/calibre"

The plugins (and the json file(s)) are in the 'plugins' sub-directory.

You can also find it from within calibre by going to Preferences->Miscellaneous and clicking the "Open calibre configuration directory" button.

I apologize for the awkwardness of this solution. I'll try to create a way to reset that file (if it exists) from within the tool itself as soon as I can.
DiapDealer is offline  
Old 08-12-2014, 01:43 PM   #42
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,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Or even a way to edit it from the plugin...
eschwartz is offline  
Old 08-12-2014, 04:03 PM   #43
arspr
Dead account. Bye
arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.
 
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none
Quote:
Originally Posted by DiapDealer View Post
On Windows, calibre's configuration directory is usually in your user directory:
"<username>/AppData/Roaming/calibre"

The plugins (and the json file(s)) are in the 'plugins' sub-directory.

You can also find it from within calibre by going to Preferences->Miscellaneous and clicking the "Open calibre configuration directory" button.

I apologize for the awkwardness of this solution. I'll try to create a way to reset that file (if it exists) from within the tool itself as soon as I can.


I've deleted both .json files and installed your new version.

Although I suppose you've already tested it, as I was the culprit, I'll also test the bogus exception file ASAP.



Another side comment, the more I think about it the more awkward it seems. When the tools have an explicit dialog window why don't you move the "current file/entire book" option to that dialog? Having two look for tool options in two places seems a bit un-userfriendly IMO.

Last edited by arspr; 08-12-2014 at 04:08 PM.
arspr is offline  
Old 08-12-2014, 05:43 PM   #44
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: 27,441
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by arspr View Post
Another side comment, the more I think about it the more awkward it seems. When the tools have an explicit dialog window why don't you move the "current file/entire book" option to that dialog? Having two look for tool options in two places seems a bit un-userfriendly IMO.
Because many of the tools I will be using won't have any explicit dialogs, and I'd rather the "current file/entire book" option remain in a consistent location across all tools I may publish/use. I don't really consider it "two different places" myself. All actions for each tool are available from a single icon/menu: Run (including any run options), Set Scope, and--eventually--Customization. Scope and Customization will tend to persist from session to session. Most Run options (with some exceptions like Smarten) will likely need to be chosen each time they're run.
DiapDealer is offline  
Old 08-12-2014, 07:13 PM   #45
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: 27,441
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by eschwartz View Post
Or even a way to edit it from the plugin...
Heaven help us.

Look on the same menu where we choose the "current file/entire book" scope.
Attached Files
File Type: zip diaps_toolbag_v0.3.0_plugin.zip (73.0 KB, 187 views)

Last edited by DiapDealer; 08-12-2014 at 07:18 PM.
DiapDealer is offline  
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Editor plugin question DiapDealer Development 2 07-28-2014 10:23 PM
Editor: ToC Editor: Start entry macnab69 Editor 2 06-25-2014 11:15 AM
Book Editor TOC Editor Isue? weberr Editor 2 04-17-2014 11:13 AM
Plugin not customizable: Plugin: HTML Output does not need customization flyingfoxlee Conversion 2 02-24-2012 02:24 AM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM


All times are GMT -4. The time now is 01:54 AM.


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