View Single Post
Old 10-08-2020, 04:17 PM   #1
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 441
Karma: 145424
Join Date: Dec 2017
Device: Kobo
[GUI Plugin] Comments Cleaner

Comments Cleaner is a small plugin that clean comments from superfluous and unwanted CSS rules (background-color, text color, font-family, among other things), but keeps the basic elements (italic, bold).
The plugin will also try to convert plain-text comments.

The plugin has the following options:
  • Keep or remove Hyperlinks
  • Weights management
    • Round the value to the hundred (only below Calibre 6)
    • Round to Bold
  • Remove Strikethrough, Underline and Italic
  • Headings management
    • Converte to a paragraph
    • Converte to a paragraph but keep the bold
  • Text alignment
    • Automatic justification
    • Force justification
    • Remove alignment
  • Specific alignment for lists
  • Keep or Delete the ID and CLASS attributs
  • Remove all formatting (NO MERCY!!)
  • Try a conversion from Mardown format (the key word is TRY)
  • Remove Multiple Line Return <br> and create a new paragraph instead
  • Convert 'Line Return' into Paragraph or Space
  • Management of empty paragraphs
  • Removing images
  • Ability to specify others CSS rules to keep in addition to the basic CSS rule
  • Possibility to apply the cleaning to others custom HTML columns
  • Support of Category Notes
Basic CSS rules keep by default:
Spoiler:
text-align
font-weight
font-style
text-decoration


Installation
Open Preferences -> Plugins -> Get new plugins and install the "Comments Cleaner" plugin.
You may also download the attached zip file and install the plugin manually, then restart calibre as described in the Introduction to plugins thread

The plugin works for Calibre 5 and later.

Page: GitHub | MobileRead

Note for those who wish to provide a translation:
I am French! Although for obvious reasons, the default language of the plugin is English, keep in mind that already a translation.

Version History:
Spoiler:
version 1.15.1 - 2025/06/20
Bug fixes
  • Fix a regression that convert line starting by a year to list when a raw text is converted with Markdown

version 1.15.0 - 2024/09/14
Changed
  • Optimisation parsing

version 1.14.0 - 2024/08/05
Added
  • Possibility of keeping all CSS rules

version 1.13.0 - 2024/02/19
Added
  • Support drag-and-drop books from the library
Bug fixes
  • Fix some untranslated string

version 1.12.2 - 2024/02/10
Bug fixes
  • Fix some wrong bold cleaning

version 1.12.1 - 2024/01/27
Bug fixes
  • Fix wrong text display when customizing keyboard shortcut

version 1.12.0 - 2023/11/17
Added
  • Support for Category Notes
  • Option for the images
Changed
  • Drop Python 2 / Calibre 4 compatibility, only Calibre 5 and above
Bug fixes
  • Tags with CAPS name don't propely parsed

version 0.11.1 - 2023/09/31
Bug fixes
  • Don't update the config file when Calibre start

version 1.11.0 - 2023/09/08
Changed
  • Fix double ScrollArea in config dialog

version 1.10.0 - 2023/04/10
Added
  • Support of custom HTML columns

version 1.9.0 - 2022/10/19
Changed
  • Again, big rework of common_utils (use submodule)

version 1.8.0 - 2022/10/11
Changed
  • Big rework of common_utils.py

version 1.7.3 - 2022/09/08
Bug fixes
  • Icon not display when a theme colors is used

version 1.7.2 - 2022/08/17
Changed
  • Small improvement of XMLentity

version 1.7.1 - 2022/07/19
Changed
  • Small improvement of compatibility betwen multiple Calibre version

version 1.7.0 - 2022/07/18
Changed
  • Small technical change for compatibility with Calibre 6

version 1.6.3 - 2022/04/25
Changed
  • Improve a bad parse for raw text comment but containing
    tags

version 1.6.2 - 2022/02/22
Changed
  • Various technical improvement

version 1.6.1 - 2022/01/08
Bug fixes
  • Fix a regression of "del align for list <li>"

version 1.6.0 - 2022/01/04
Changed
  • Compatible Calibre6/Qt6

version 1.5.0 - 2021/10/31
Added
  • Improvement of "Single 'Line return'" option: Replace by Space, by new paragraph, no change

version 1.4.1 - 2021/10/03
Changed
  • Clean text full heading
Bug fixes
  • The text of progress dialog is correctly translated, FINALY! \o/

version 1.4.0 - 2021/09/11
Changed
  • Better support of small screens for the config dialog
  • Improve
    in <strong>/<em>
  • Improve clean for text fully bold and <sub>/<sup> paragraphe
  • Improved uniformity with the Calibre comment format

version 1.3.4 - 2021/08/30
Changed
  • Clean text fully bold

version 1.3.3 - 2021/08/17
Changed
  • Clean a very rare invalid comment fomat (all in <sub>/<sup>)

version 1.3.2 - 2021/01/07
Bug fixes
  • Fix convert to list a plain text beginning with a year

version 1.3.1 - 2020/11/26
Changed
  • Reduce the height of the configuration window

version 1.3.0 - 2021/01/07
Added
  • Add new options for the cleaning:
    • Round the Weights value instead of truncated
    • Remove Strikethrough, Underline and Italic
    • Try a conversion from Markdown format (the key word is TRY)
    • Management of empty paragraphs
    • Convert 'Line Return' into paragraph
    • Specific alignment for lists
    • Remove all formatting (NO MERCY!!)
Changed
  • Improvements of mass edit:
    • Add a progres bar window and possibility to cancel the current operation
    • Don't update the unchanged comments in the Database
  • and a lot of improvements for the cleaning.

version 1.2.2 - 2020/11/26
Bug fixes
  • Fix rare issue with LibraryDatabase()

version 1.2.1 - 2020/11/16
Bug fixes
  • Fix error when loading the Spanish translation

version 1.2.0 - 2020/10/12
Added
  • Support translation
  • Spanish translation by dunhill

version 1.1.0 - 2020/10/12
Added
  • Add a option for Multiple Line Return.
  • Add a option for the Headings.
  • Add a option for the ID and CLASS attributs.

version 1.0.0 - 2020/10/11
Added/Changed
  • Strategy change: All CSS rules are removed. Only a handful basic rules as keep.
    • Add a option to specify additional CSS rules to keep.
    • Saving parameters in a JSON (common to all libraries). Your settings will be reset!!
    • Add an option to remove 'Multiple Line Return' and create a new paragraph instead.

version 0.3.1 - 2020/10/09
Added
  • Transforms non-html (full text) comments to HTML

version 0.3.0 - 2020/10/09
Added
  • Add option for the Weight

version 0.2.1 - 2020/10/08
Added
  • Add "Delete all align" in the justification option

version 0.2.0 - 2020/10/08
First release
Attached Thumbnails
Click image for larger version

Name:	Comments_Cleaner.png
Views:	291
Size:	38.0 KB
ID:	209973   Click image for larger version

Name:	Comments_Cleaner-exemple.gif
Views:	264
Size:	16.7 KB
ID:	209974   Click image for larger version

Name:	Comments_Cleaner-menu.png
Views:	243
Size:	6.4 KB
ID:	209975   Click image for larger version

Name:	Comments_Cleaner-notes.png
Views:	224
Size:	15.1 KB
ID:	209976  
Attached Files
File Type: zip Comments Cleaner-1.15.1.zip (462.8 KB, 2411 views)

Last edited by un_pogaz; 06-20-2025 at 07:17 AM.
un_pogaz is offline   Reply With Quote