Quote:
Originally Posted by Doitsu
Calibre has extremely robust conversion settings that allow users to convert invalid ePubs to invalid Mobi files. These files can be opened with Kindles and Kindle apps, but some links/styles might not work.
You may want to make sure that all books that you want to convert with KindleGen pass ePubCheck and/or FlightCrew, because books that fail validation usually also fail KindleGen. Also note that azw3 and mobi7 files generated by this plugin can't be used for KDP uploads.
If you want to convert multiple epubs you're better off using Calibre.
If you're familiar with regular expressions, you can change the generated file name by editing line #285 in plugin.py.
Code:
title = re.sub('[/|\?|<|>|\\\\|:|\*|\||"|\^]+', '_', dc_title.group(1))
You could also press F8 in Sigil and modify the title before running the KindleGen plugin. (You don't have to save the ePub after the change; the plugin will always use the current version of the files as they're displayed in Sigil.)
|
Thank you for the pointer to the appropriate code. I have tweaked it a bit to suit my preferences as follows:;
Code:
# replace unwanted characters in book title
title = re.sub('[/|\?|<|>|\\\\|:|\*|\||"|\^|\'|\s]+', '_', dc_title.group(1))
title = title.strip("_")
I edited the comment to be a little more accurate, added the apostrophe and white space to the list to be replaced with underscores and stripped leading/trailing underscores to deal with titles in quotes.
There might even be a few more unwanted characters that ought to be added to the replacement list that could cause problems in a file name. I will see if I run into any and add them as I encounter them.
The white space is a preference of mine to avoid the need of quoting filenames or using escape codes while entering file names. I find the underscores an acceptable replacement avoiding that problem.
Dave