From 7a307a2e24c04b28b8177cbcd0ec2a77512d94ae Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 21 Jan 2014 18:52:47 +0530 Subject: [PATCH] Edit book: Add a new tool to automatically remove all unused CSS rules. Useful for books created from templates that can have large numbers of CSS rules that dont match any actual content. Available via Tools->Remove unused CSS. Book polishing: Add an option to automatically remove all unused CSS rules, works the same as the tool for Edit book, above. --- manual/edit.rst | 9 ++ src/calibre/ebooks/oeb/polish/css.py | 149 ++++++++++++++++++++++++++ src/calibre/ebooks/oeb/polish/main.py | 16 +++ src/calibre/gui2/actions/polish.py | 4 +- src/calibre/gui2/tweak_book/ui.py | 6 +- 5 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 src/calibre/ebooks/oeb/polish/css.py diff --git a/manual/edit.rst b/manual/edit.rst index 45bcd17fe2..3475b54a3d 100644 --- a/manual/edit.rst +++ b/manual/edit.rst @@ -335,6 +335,15 @@ Note that the algorithm can sometimes generate incorrect results, especially when single quotes at the start of contractions are involved. Accessed via :guilabel:`Tools->Smarten punctuation`. +Removing unused CSS rules +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Remove all unused CSS rules from stylesheets and