Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 03-25-2012, 03:04 PM   #1
Gusgsm
Junior Member
Gusgsm began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Aug 2010
Device: Papyre 5.1 (Hanlin)
Making EPUB 'My Way' CSS

Hi,

I am converting-making epub with Calibre and so far, so good. It's terrific. However, there's something I don't know how to make, surely due to my ignorance:

I input XHMTL as simple as possible. That is: plain p, h2, h3, and h1 tags with some em and blockquotes. No more as what I do are plain text novels. Then I add a very simple css with very basic rules (align letf, size 1em, 1.4em...). Nothing more as I like/need my code and texts to be as simple and clean as possible.

The question:

Is there any way I cand stop Calibre from adding all the classes and extra CSS stuff so that I simply inject the CSS in the conversion dialogues and I get the simple output I want?

Thanks a lot, folks.

Gustavo, posting from Madrid
Gusgsm is offline   Reply With Quote
Old 03-26-2012, 06:05 PM   #2
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,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
I don't think you can stop Calibre adding all the classes to the <p>, <h1> etc tags inside the converted epub, but if you already have a standard css file which you use with your simple html, then those Calibre-created classes should give you the same visual result as your standard css file.

There are several ways to make Calibre use your standard css file:
  • Add a <link> to your standard css file in the html header section before you import the html file into Calibre
  • Add your standard css statements, between <style>...</style> tags inside the html header section before you import the html file into Calibre
  • Copy your standard css statements to the Look&Feel ExtraCSS box as you convert zip-to-epub.
  • Type the filename of your standard css file (onyour PC) to the Look&Feel ExtraCSS box as you convert zip-to-epub.
jackie_w is offline   Reply With Quote
Old 03-27-2012, 06:41 AM   #3
Gusgsm
Junior Member
Gusgsm began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Aug 2010
Device: Papyre 5.1 (Hanlin)
Thanks. I'll try though some of the answer I have already tried and Calibre (if I recall it all right) adds a lot of extra things.

Anyway, nothing I cannot really live with it. I hoped there were some 'template-like' setting where I could place my CSS output preferences (and some othe ones as well) and forget about them for ever

Bye

Gustavo
Gusgsm is offline   Reply With Quote
Old 03-27-2012, 06:55 AM   #4
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,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
If either option 3 or 4 works for you, you can add css to your Calibre preferences defaults. Then you could 'forget about it' for all new conversions.
jackie_w is offline   Reply With Quote
Old 03-27-2012, 07:19 AM   #5
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
Quote:
Originally Posted by Gusgsm View Post
I input XHMTL as simple as possible. That is: plain p, h2, h3, and h1 tags with some em and blockquotes. No more as what I do are plain text novels. Then I add a very simple css with very basic rules (align letf, size 1em, 1.4em...). Nothing more as I like/need my code and texts to be as simple and clean as possible.
I achieve this by using calibre's Tweak ePub option after conversion:

1) Explode the ePub.
2) Copy your own stylesheet.css over the top of calibre's generated one.
3) Use a simple regex to remove all class="calibre..." from the generated HTML documents.
4) Rebuild the ePub.

You can omit step 3 but this will leave redundant data in the book.

I know it's a few steps but it doesn't take long and you only do it once for each book, provided you do not reconvert. (Maybe there would be a way to program this as a plugin to automate it.)

I agree, it would be useful to be able to do this via some sort of conversion dialogue.

Last edited by Agama; 03-27-2012 at 07:22 AM.
Agama is offline   Reply With Quote
Old 03-27-2012, 07:24 AM   #6
Gusgsm
Junior Member
Gusgsm began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Aug 2010
Device: Papyre 5.1 (Hanlin)
@Agama;

I do that in one or two steps less: I open the file in OxygenXML, I replace the CSS and I make a full regex in all files inside the epub.

But the wonders of templating...
Gusgsm is offline   Reply With Quote
Old 03-27-2012, 07:29 AM   #7
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
What's OxygenXML? Sounds interesting. Is it expensive?
Agama is offline   Reply With Quote
Old 03-27-2012, 07:50 AM   #8
Gusgsm
Junior Member
Gusgsm began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Aug 2010
Device: Papyre 5.1 (Hanlin)
There's a reasonable priced version. The demo is fully functional for 30 days. I have no relation with them, BTW.
Gusgsm is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
epub to epub converting: making chapters? Joy736 Conversion 8 10-30-2011 04:47 PM
Why, During ePub to ePub Conversion does Calibre changes existing CSS classes? JSWolf Conversion 7 08-06-2011 07:32 PM
Override ePub CSS with userStyle.css? barium Sony Reader Dev Corner 11 07-16-2011 03:25 PM
Confused about making changes to my CSS in Sigil Michael Grossman Sigil 11 06-17-2011 08:34 PM
epub CSS versus "Regular" CSS konrad ePub 4 02-18-2011 09:29 AM


All times are GMT -4. The time now is 09:02 PM.


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