View Single Post
Old 12-11-2022, 11:58 PM   #14
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,118
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
Version 0.8.0

Version 0.8.0 - 11 December 2022
  • Update: Tag Actions: Add Style filter.
  • Update: Tag Actions: Modifications to config widget.
  • Update: Tag Actions: Add ability to narrow down the nodes by css selectors.
  • Fix: Tag Actions: Fix bug when specifying xpath and not configuring any tag filters.
  • Fix: Search & Replace: Replace function name not loading in config widget.
  • Fix: Expand Styles: Font size not updated in inline styles.

Style Property Filter

This filter allows you to locate tags by their style and apply actions on them. For example you can filter elements with a certain color or font-size and perform any of the available actions on them.


This filter has the following options:
  • Text comparison operators to search for textual styles e.g. font-style "matches" italic
  • Numerical operators for dimension based styles like font-size, margin-top, ... etc
  • It supports the In-memory (not in the ebook itself) conversion of dimension units (px,pt,..etc) to be able to make a comparison on actual size regardless of the unit used.


To illustrate this, attached below is couple of chains that do the following:
  • A chain that changes paragraphs to different headings (h1, h2, h3) based on the paragraph font-size. This first makes an In-memory (not in the ebook itself) conversion of all font-sizes to px.
  • A modified version of the above chain: It adds another couple of limitations to paragraphs that will be converted to headings:
    1. It only applies to paragraphs with 80 letters or less. This is done by using the "Text Filter" with regex.
    2. For paragraphs to be converted into h1 and h2 headings, they must be centered and bold (by using two other style filters).

Starting with this version, the plugin has been added to the plugins index, and can be downloaded through calibre.
Attached Thumbnails
Click image for larger version

Name:	11.png
Views:	251
Size:	54.2 KB
ID:	198342  
Attached Files
File Type: zip para_to_headings_v1.zip (760 Bytes, 271 views)
File Type: zip para_to_headings_v2.zip (891 Bytes, 252 views)
capink is offline   Reply With Quote