Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 11-30-2015, 04:44 PM   #1
darrenmcg
Enthusiast
darrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
Posts: 31
Karma: 12920
Join Date: Nov 2014
Device: Voyage 5.8.9.2
Question Metadata comments formatting?

Hello everyone, is there a way to disable the formatting in the metadata comments section?
Currently I clear all formatting but I'm usually left with something like:
<p class="description">blah,blah,blah</p>
or:
<p>blah,blah,blah</p>
I'd like to get rid of all that and just have:
blah,blah,blah
Also, is there a way to disable the formatting toolbar in the comments section all together?

I'm trying to have a "clean" <dc:description> in the epubs content.opf file
darrenmcg is offline   Reply With Quote
Old 11-30-2015, 05:28 PM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
No, calibre automatically adds html formatting. The minimum you can get away with is a set of p tags.

But if you don't modify the description, calibre will not mess around with it. That's the only way to get plaintext comments.
eschwartz is offline   Reply With Quote
Advert
Old 11-30-2015, 05:35 PM   #3
darrenmcg
Enthusiast
darrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
Posts: 31
Karma: 12920
Join Date: Nov 2014
Device: Voyage 5.8.9.2
Oh, ok, thanks.
Does Calibre also add them during format conversion?
darrenmcg is offline   Reply With Quote
Old 11-30-2015, 06:23 PM   #4
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
No, it's part of the metadata editing I am pretty sure.

calibre won't modify your metadata on its own, but it does have its own rules about how you can update it. Namely, it will auto-htmlize any changed metadata you modify the book record with.
eschwartz is offline   Reply With Quote
Old 11-30-2015, 08:26 PM   #5
dickloraine
Guru
dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.
 
Posts: 631
Karma: 7544080
Join Date: Apr 2013
Location: Berlin
Device: PRS 350, Kobo Aura
You could modify calibre itself or make a plugin. I think calibre runs your description only through some function, likely names txt2html or something like that. Shouldn't be that hard, but I don't know, if this could negatively impact for example the fetching of metadata.
dickloraine is offline   Reply With Quote
Advert
Old 11-30-2015, 08:53 PM   #6
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
in "src/calibre/library/comments.py" see the function "comments_to_html"
eschwartz is offline   Reply With Quote
Old 12-02-2015, 04:05 PM   #7
darrenmcg
Enthusiast
darrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
Posts: 31
Karma: 12920
Join Date: Nov 2014
Device: Voyage 5.8.9.2
Thanks guys.
darrenmcg is offline   Reply With Quote
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,764
Karma: 7029857
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:	495
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:	558
Size:	54.4 KB
ID:	145375
I checked metadata.opf and indeed the HTML is gone.
chaley is offline   Reply With Quote
Old 01-08-2016, 12:52 PM   #9
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Oh, cool. Leveraging S&R to evade the comments editor post-processing.

Why didn't I think of that?
eschwartz is offline   Reply With Quote
Old 01-08-2016, 04:17 PM   #10
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,892
Karma: 55267620
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by eschwartz View Post
Oh, cool. Leveraging S&R to evade the comments editor post-processing.

Why didn't I think of that?
Because you need to leave at least ONE solution to someone else
theducks is offline   Reply With Quote
Old 01-08-2016, 04:23 PM   #11
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,259
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
I've made a small plugin with the same goal (among other things )
Terisa de morgan is offline   Reply With Quote
Old 01-09-2016, 08:20 PM   #12
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Care to share it?
eschwartz is offline   Reply With Quote
Old 01-11-2016, 12:29 AM   #13
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,259
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Not at all. This is my plugin and the function (it's a menu option too) is "_do replace_text). Keep in mind that:
  1. It's totally specific and..
  2. My first try to do a plugin and
  3. One of my first attempts with python

So it probably will be a mess
Attached Files
File Type: zip MyTools.zip (369.6 KB, 248 views)
Terisa de morgan is offline   Reply With Quote
Old 01-11-2016, 04:29 PM   #14
darrenmcg
Enthusiast
darrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterdarrenmcg can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
Posts: 31
Karma: 12920
Join Date: Nov 2014
Device: Voyage 5.8.9.2
Thanks for your suggestion chaley. I tried your suggestion, but couldn't get it to work with the standard comments section. However, I've managed to do it using regex. Tested and it works fine, also tested with an absolutely tag trashed comment and it works too.
Attached Thumbnails
Click image for larger version

Name:	Untitled-1.jpg
Views:	419
Size:	93.2 KB
ID:	145442  
darrenmcg is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove all formatting in comments by regular expression aurigod Library Management 2 02-05-2015 12:38 PM
Changing paragraph formatting in Comments field Berzelius Calibre 16 10-26-2014 06:40 PM
How do I paste description (comments) without the html formatting? webipsum Calibre 5 07-15-2014 07:38 PM
COMMENTS batch formatting ippopom Library Management 7 02-26-2013 01:23 PM
[Old Thread] Comments section *formatting* mezme Calibre 5 08-26-2011 06:22 PM


All times are GMT -4. The time now is 12:57 AM.


MobileRead.com is a privately owned, operated and funded community.