View Single Post
Old 03-25-2018, 09:21 PM   #1
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
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:

v0.1.8
-- Fixed a problem with xml header layout spacing.
v0.1.7
-- Fixed a bug whereby if the epub contained SVG wrappers then the SVG code would be corrupted by the plugin, causing epubcheck errors.
v0.1.6
-- Improved html output(layout).
v0.1.5
-- Fixed several bugs which, under certain conditions, would give epubcheck errors.
-- This plugin can now be use with epub 2 and epub 3 files. My thanks to @democrite.
v0.1.4
-- The href ids are now more widely gathered from the following files: xhtml files, toc.ncx, opf manifest and opf guides. These href ids are then compared to existing ids/bookmarks in the xhtml files. The xhtml ids are only removed if they don't exist in the href id list.
-- NCX pagelists and page-map files are now not supported with this plugin. If either are detected in the epub then there will be a warning with bailout.
v0.1.3
-- Fixed a problem causing svg formatting errors in Epubcheck. SVG images can now be used in epubs without problems when using this plugin.
v0.1.2
-- The plugin now removes the meta line if it contains the 'name="calibre:cover"' attribute in the cover file. Thanks to Becky.
-- The plugin will now not change any "name" attribute values or names in any meta tags. Thanks to DiapDealer.
v0.1.1
-- Added a terminal window to display relevant plugin processing information for the user. Thanks to roger64.
v0.1.0
-- Initial release
Attached Thumbnails
Click image for larger version

Name:	results_dialog.JPG
Views:	995
Size:	18.8 KB
ID:	163069  
Attached Files
File Type: zip RemoveUnusedBookmarks_v018.zip (22.1 KB, 1472 views)

Last edited by slowsmile; 07-27-2020 at 01:51 AM.
slowsmile is offline   Reply With Quote