Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 07-17-2014, 09:33 AM   #1
Steven630
Groupie
Steven630 began at the beginning.
 
Posts: 154
Karma: 10
Join Date: May 2012
Device: Kindle Paperwhite2
How do I override colour when writing a recipe?

Quote:
<p><span style="color: #ff0000"><strong>text 1</strong></span><span style="color: #008000"><strong>text 2</strong></span></p>
I want text1 and text2 to be in default colour (black). How should I write the recipe? Thank you.

I've tried something like

Quote:
span['style'] = span['style'].replace('color', 'ignore-me')
But it says
Quote:
NameError: global name 'span' is not defined
To which part should I add the code?

Last edited by Steven630; 07-17-2014 at 09:53 AM.
Steven630 is offline   Reply With Quote
Old 07-17-2014, 10:22 AM   #2
aleyx
Addict
aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.
 
Posts: 245
Karma: 20386
Join Date: Sep 2010
Location: France
Device: Cybook Diva
I think you can use extra_css to override span { color }. Maybe. (I never had to use recipes, so this is only a shot in the dark)
aleyx is offline   Reply With Quote
Advert
Old 07-17-2014, 11:02 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
remove_attributes = ['style']
kovidgoyal is offline   Reply With Quote
Old 07-17-2014, 11:39 AM   #4
Steven630
Groupie
Steven630 began at the beginning.
 
Posts: 154
Karma: 10
Join Date: May 2012
Device: Kindle Paperwhite2
Quote:
Originally Posted by kovidgoyal View Post
remove_attributes = ['style']
There are other elements in style that I want to keep. Any other way?
<p style="text-align: center">
Steven630 is offline   Reply With Quote
Old 07-17-2014, 11:41 AM   #5
Steven630
Groupie
Steven630 began at the beginning.
 
Posts: 154
Karma: 10
Join Date: May 2012
Device: Kindle Paperwhite2
Quote:
Originally Posted by aleyx View Post
I think you can use extra_css to override span { color }. Maybe. (I never had to use recipes, so this is only a shot in the dark)
I've tried remove_attributes = ['color'] to no avail
Steven630 is offline   Reply With Quote
Advert
Old 07-17-2014, 12:03 PM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Then you need to implement the postprocess_html function in your recipe filter the style attributes in that.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Override 'calibre' as converted feed's author in modified recipe sk365 Recipes 8 09-30-2016 03:11 AM
Help me writing this recipe korederoma Recipes 2 04-17-2012 03:05 PM
Recipe Request for "Daily Writing Tips" Loosheesh Recipes 3 12-01-2011 06:01 AM
Help with writing recipe kiklop74 Calibre 2 12-05-2008 01:54 PM
Problems writing recipe kiklop74 Calibre 9 10-28-2008 06:58 PM


All times are GMT -4. The time now is 06:05 PM.


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