|
|
Thread Tools | Search this Thread |
03-25-2018, 10:21 PM | #1 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
[Plugin] RemoveUnusedBookmarks - removes all unused bookmarks from epubs
Removes all unused bookmarks from epubs Requirements Plugin Type: Edit MIT Licence(OSI) Minimum Sigil requirement: v0.9.3 or higher Python Requirements: Python 3.4+ (Bundled or External) OS Requirements: Windows, Linux or OSX Current Version: "0.1.8" Installation * Select Manage Plugins from the Plugins menu. In the dialog box, select either the Bundled Python or the External Python(Python 3.4+ should be installed on your computer to run this plugin externally). * Click Add Plugin and select RemoveUnusedBookmarks_vXXX.zip. This will load and install the plugin into Sigil, which you can then select and run the plugin by selecting Plugins > Edit > RemoveUnusedBookmarls Description This epub2/epub3 plugin's main task is to remove all unused bookmarks(link destination ids) from the epub. The plugin also does the following tasks: * Automatically converts all 'name' attributes to 'id' attributes. * Removes all unused bookmarks/ids from the xhtml files including the toc.ncx and nav.xhtml(epub3 only). * Automatically removes any anchor tags that contain no attributes. * Ensures that all anchor start and end tags(with id only and no link) are always correctly formatted. Caveat * This plugin will remove all destination bookmarks/ids that are not directly used by internal links in the xhtml, toc.ncx or nav.xhtml(for epub 3). The only exception to this is if an id contains markers such as "toc", "cover", "text", "start", which will not be removed. * This plugin can now process Epub 2 and Epub 3 files. Pagelists and nav maps are supported. Plugin Run Load your epub into Sigil and then just run the plugin. At the end of the run, the plugin will now display a results message window showing number of files processed, total bookmarks found and total bookmarks removed.(v0.1.1) Update: This plugin can now process epubs that contain svg images without giving svg errors in Epubcheck.(v0.1.3) Update: Both Epub 2 and Epub 3 files can now be processed with this plugin. Changes: Spoiler:
Last edited by slowsmile; 07-27-2020 at 02:51 AM. |
03-26-2018, 12:42 AM | #2 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Thank you for this useful plugin.
I would appreciate to read in the terminal window a comment of sort: "processed x files, found y bookmarks". Now it processes silentlly and I do not know if it really did the job. Last edited by roger64; 03-26-2018 at 12:43 AM. Reason: typo |
Advert | |
|
03-26-2018, 12:59 AM | #3 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
@roger64...I'll try and add that terminal results window as a final info display when I have some time - I'm a bit busy at the moment.
Last edited by slowsmile; 03-26-2018 at 01:30 AM. |
03-26-2018, 03:09 AM | #4 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
Update: The plugin will now display a terminal message window at the end of processing to show relevant processing information to the user.(v0.1.1)
Last edited by slowsmile; 03-26-2018 at 03:42 AM. |
03-26-2018, 05:10 AM | #5 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Thank you
|
Advert | |
|
03-26-2018, 10:15 AM | #6 |
Guru
Posts: 783
Karma: 2298438
Join Date: Jan 2017
Location: Poland
Device: Various
|
@slowsmile: Think about it:
Code:
<meta name="description" content="Story awarded (first award)."/> <meta name="keywords" content="award, story, john, doe, horror"/> <meta name="author" content="John Doe"/> <meta name="generator" content="BeckyPad 1.07"/> Code:
<meta name="calibre:cover" content="true"/> Last edited by BeckyEbook; 03-26-2018 at 10:22 AM. |
03-26-2018, 01:21 PM | #7 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
@Becky...It's now 12:10 am in the Philippines where I live and I'm going to bed now. I'll try and put in a fix for the "calibre:cover" IDErrorCheck problem tomorrow morning.
I would also appreciate it you would keep problems concerning the IDErrorCheck plugin on the correct forum thread. This thread is primarily for RemoveUnusedBookmarks plugin problems. |
03-26-2018, 01:49 PM | #8 |
Guru
Posts: 783
Karma: 2298438
Join Date: Jan 2017
Location: Poland
Device: Various
|
This thread IS correct.
Plugin RemoveUnusedBookmarks destroys meta tags. IDErrorCheck too. CustomCleanerPlus "only" remove them. Last edited by BeckyEbook; 03-26-2018 at 01:54 PM. |
03-26-2018, 02:09 PM | #9 |
Grand Sorcerer
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I'm unclear as to what you're referring to as "bookmarks" and what is being used to determine that they're "unused."
From what I can see, this plugin modifies id attributes and anchor tags. Am I missing something? |
03-26-2018, 06:49 PM | #10 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
@DiapDealer...By bookmarks we mean ids.
What Becky is referring to is the the odd Calibre id that is inserted in Becky's cover.xhtml meta tag in her scrambled.epub document. The layout of the cover.xhtml file looks like this: Spoiler:
Becky is insistent that I should fix the above issue, which is actually caused by the Calibre conversion of her original doc to epub. This problem is caused by Calibre's non-standard use of meta ids in other words. I really don't know why that "calibre:cover" id is there in the meta tags of the cover file. It's obviously an irregular id that has been put there by Kovid Goyal for reasons that I am unable to fathom. I can certainly put in a fix for this problem(by simply removing the offending meta line in the cover file) but it does irk me that such a non-standard and obviously fudged id is being generated by Calibre in all its conversions to epub which cause problems when my plugins are being used. Last edited by slowsmile; 03-26-2018 at 10:02 PM. |
03-26-2018, 07:42 PM | #11 |
Grand Sorcerer
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
|
03-26-2018, 07:49 PM | #12 |
Guru
Posts: 783
Karma: 2298438
Join Date: Jan 2017
Location: Poland
Device: Various
|
But I do not insist.
I just notice that the use of some plugins damages my metadata in files. The workaround would be to leave name unchanged in the meta tags. The default cover template in calibre actually contains Code:
<meta content="true" name="calibre:cover"/> Code:
<meta content="true"/> |
03-26-2018, 08:31 PM | #13 | |
null operator (he/him)
Posts: 21,000
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
BR |
|
03-26-2018, 09:30 PM | #14 |
Grand Sorcerer
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Becky's got a point. Your plugin really should be excluding meta tags when it's doing it's processing. Those tags aren't relevant to your plugin's stated workflow after all.
Calibre/Kovid's reasons for what he does are immaterial to this issue. "name" is a valid attribute for meta tags, and "calibre:cover" violates no xhtml value character rules. Your plugin should not mangle them (or any existing meta tag)--especially since they're not in your plugin's bailiwick to begin with. Your code is changing every "name" attribute it finds (in any tag) to an "id" attribute. That's just a bad idea. Change: Code:
#ensure all bookmarks have only 'id' attributes for tag in soup.find_all(True): if tag.has_attr('name'): idref = tag['name'] del tag['name'] tag['id'] = idref Code:
#ensure all bookmarks have only 'id' attributes for tag in soup.find_all(True): if tag.has_attr('name') and tag.name != "meta": idref = tag['name'] del tag['name'] tag['id'] = idref There's no reason for this plugin to be changing any meta tags. Last edited by DiapDealer; 03-26-2018 at 10:04 PM. |
03-26-2018, 10:08 PM | #15 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
@DiapDealer...I've already fixed the 'calibre:cover' issue by removing the line in the cover file. But I take your point that meta tags with ids should not be checked or changed. Will work on a fix for that now. These fixes will be included in both IDErrorCheck and RemoveUnusedBookmarks plugins. And thanks for the heads up info on meta ids, I didn't know that.
Last edited by slowsmile; 03-26-2018 at 10:12 PM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Removing plugin in Calibre removes it from all instances of Calibre | oblox | Calibre | 9 | 09-09-2016 06:39 AM |
iPad Possibility to sync bookmarks through side loaded ePubs (Any iOS software?) | andsoitgoes | Apple Devices | 12 | 04-13-2012 08:38 PM |
Modify bookmarks in epubs | silentguy | Development | 3 | 08-03-2011 06:37 PM |
Sideloaded ePubs, chapters and bookmarks | Steven Lyle Jordan | Nook Color & Nook Tablet | 10 | 02-05-2011 07:35 PM |
Problem (bug) with bookmarks in PDF plugin (2.0 RC2) | luite | iRex | 1 | 07-12-2010 03:36 AM |