![]() |
suggestion: plugin to remove spaces
What about a plugin to remove spaces in filenames of XHTML and/or images? Or perhaps replacing them by an underscore?
Should not be too difficult I think, but I am not a Python expert. Could be very useful in case of a lot of files... |
Are you thinking of an automated "everything in one fell swoop" kind of thing? I only ask because renaming files in the book browser will take care of updating all links to it.
|
How to handle these filenames:
chapter 01.html chapter_01.html in the same book? |
Quote:
Select the Range: Change the names to something generic to avoid clashes Now rename those to the final sequenced names BTW the bulk renamer allows you to skip files sec01 sec02 p01 <not selected sec03 sec04 p02 <not selected |
Quote:
|
Actually, this is not easy as it sounds in that you must go through every link/anchor/aside/footnote, etc in every xhtml file looking for changed file names in internal links.
The code to actually do exactly this is built into Sigil in a C++ routine that performs UniversalUpdates and it is run when the epub is first loaded since the paths to the files will change due to being moved into the epub directory structure used by Sigil. In the end, it might be easier to change the builtin updates routine then to recreate all of that code in a plugin. KevinH |
Quote:
Just kidding...:2thumbsup |
Just FYI, this would be five lines of code if you were making a plugin for the calibre editor (not counting the boilerplate for the plugin)
Code:
from calibre.ebooks.oeb.polish.replace import rename_filesand you are done. |
Hmm ... since all of the real work is done in rename_files for Calibre, that is very true. I think I could do something similar by extending the Sigil launcher interface and have it call the rename file code inside Sigil in a similar manner.
But I still think the easiest Sigil-based solution is to simply take care of that when the epub is first loaded. So if you are in need of a plugin quickly, doing what Kovid recommended in Calibre is probably the way to go until/if we release this feature in future version on Sigil assuming there is demand for it. Thanks Kovid! KevinH |
| All times are GMT -4. The time now is 08:30 PM. |
Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.