View Single Post
Old 06-10-2015, 07:37 AM   #1
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Using Polish remove_unused_css method

I'm interested in automatically running the remove_unused_css method from calibre.ebooks.oeb.polish.css as part of one of my personal plugins which is a gui CSS tweaker.

The input parameters are (container, report=None, remove_unused_classes=False).
I'm OK with 1 and 3 but I'm not sure how to use report.

As far as I can tell, the method just returns True/False depending on whether any css rules or html classes were removed. I'd like to be able to access some detail of what changed, which I can see is being 'reported'.

I'm afraid the documented help param report: An optional callable that takes a single argument. It is called with information about the operations being performed. doesn't enlighten me.

The fact that I don't really understand calibre's logging system may be at the heart of my problems so if there's a 'Start-here-and-all-will-be-revealed' feel free to point me at it. Understanding the logging system is probably long overdue on my part.

Thanks in advance for any helpful info
jackie_w is offline   Reply With Quote