View Single Post
Old 01-08-2016, 12:39 PM   #8
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,789
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Just for completeness: it is possible to use bulk search/replace to clean HTML out of comments.

Step 1: create a custom template function. In my case I named it myFunc2.
Click image for larger version

Name:	Clipboard01.jpg
Views:	498
Size:	37.0 KB
ID:	145374

The actual text of the function is
Code:
def evaluate(self, formatter, kwargs, mi, locals, t):
	from calibre.utils.html2text import html2text
	return html2text(t)
Then use bulk search/replace with something like the following. In this case I am changing a custom comments column, but it would work on the normal one. The custom column contains the following raw HTML:
Code:
<p class="description"><font color="#ff0000">This comment set to red text.</font></p>
Running the search replace changes it as shown in the screen capture.
Click image for larger version

Name:	Clipboard02.jpg
Views:	562
Size:	54.4 KB
ID:	145375
I checked metadata.opf and indeed the HTML is gone.
chaley is offline   Reply With Quote