Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 11-27-2018, 12:22 PM   #1
GrosNours
Junior Member
GrosNours began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Nov 2018
Device: none
Use CSS sheet in conversion

Hi,

I have some raw text files that I want to convert to epub (they will be easier to read on my tablet).

Is there a way to use a sspecific CSS file in the conversion, instead of what seemed to be hardcoded calibre* classes? I don't want to search and replace the generated files to change the styles afterwards, if I can help it.
GrosNours is offline   Reply With Quote
Old 11-27-2018, 12:53 PM   #2
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: 41,789
Karma: 18984052
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Look in the look & feel section of th econversion dialog
kovidgoyal is offline   Reply With Quote
Advert
Old 11-27-2018, 01:13 PM   #3
itimpi
Wizard
itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.
 
Posts: 4,548
Karma: 950151
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
Quote:
Originally Posted by GrosNours View Post
Hi,

I have some raw text files that I want to convert to epub (they will be easier to read on my tablet).

Is there a way to use a sspecific CSS file in the conversion, instead of what seemed to be hardcoded calibre* classes? I don't want to search and replace the generated files to change the styles afterwards, if I can help it.
Calibre does not have hard-coded classes. What it does is try to ‘flatten’ any classes already present and give the new classes generated from this process names of the form ‘calibrenn’

If you are starting from raw text files then you will not have any pre-existing classes so any classes generated will be as a result of any conversion options you specify.
itimpi is offline   Reply With Quote
Old 11-28-2018, 05:05 AM   #4
GrosNours
Junior Member
GrosNours began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Nov 2018
Device: none
Thank you itimpi, it makes (a little) more sense now.

But I am still confused about the whole process:
- in the look&feel section, it is said that you can add a CSS path. But there is now button to add it. how can you do that?
- I tried to add some CSS instructions and I see them added to the calibre* classes in the output. But what if simply want to use my specific classes, that I have in a CSS stylesheet file, or even more don't use classes at all, and just use a stylesheet that sets values for p, h1, h2, etc. Can I do this from a raw text file as input, or do I have to first convert to XHTML?
GrosNours is offline   Reply With Quote
Old 11-28-2018, 12:14 PM   #5
retiredbiker
Addict
retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.
 
retiredbiker's Avatar
 
Posts: 314
Karma: 843578
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Ubuntu, Jutoh,Kobo Forma
Since you're going from raw text, a conversion has no real way of knowing where to apply your css, no matter what you put in...it has no coding to start from.

In such cases, I have a very simple css in a text file that contains what I like for reading: indent, noindent, chaptertitle, quotations, verse, center, right, and that's about it.

I convert the text to epub, then in the editor import my css file. Then I use search and replace as needed to change 'calibren' classes to my own. For a simple book like a novel this usually only takes a few minutes. If you have a lot of fancy stuff you want to pretty up, well, that can take a while. I know you don't want to do that, but I don't see any other way.

Last edited by retiredbiker; 11-28-2018 at 12:20 PM.
retiredbiker is offline   Reply With Quote
Advert
Old 11-28-2018, 02:50 PM   #6
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,026
Karma: 71684510
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
calibre conversions will always use it's own class names.

For an idea on the extra cxs see https://manual.calibre-ebook.com/con...html#extra-css
PeterT is offline   Reply With Quote
Old 11-29-2018, 09:21 AM   #7
GrosNours
Junior Member
GrosNours began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Nov 2018
Device: none
Quote:
Originally Posted by retiredbiker View Post
Since you're going from raw text, a conversion has no real way of knowing where to apply your css, no matter what you put in...it has no coding to start from.

In such cases, I have a very simple css in a text file that contains what I like for reading: indent, noindent, chaptertitle, quotations, verse, center, right, and that's about it.

I convert the text to epub, then in the editor import my css file. Then I use search and replace as needed to change 'calibren' classes to my own. For a simple book like a novel this usually only takes a few minutes. If you have a lot of fancy stuff you want to pretty up, well, that can take a while. I know you don't want to do that, but I don't see any other way.
You are right, I don't want to do that, but as you said, it looks like it is *the* way.
GrosNours is offline   Reply With Quote
Old 11-29-2018, 09:24 AM   #8
GrosNours
Junior Member
GrosNours began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Nov 2018
Device: none
Quote:
Originally Posted by PeterT View Post
calibre conversions will always use it's own class names.

For an idea on the extra cxs see https://manual.calibre-ebook.com/con...html#extra-css
Yeah, I've seen that, but it does not explain how to include a whole CSS file, which seems to be possible. Is it just copy-paste of the data, or can I just type the path of the .css file (and in this case, absolute path? relative to a base directory?)
GrosNours is offline   Reply With Quote
Old 11-29-2018, 11:35 AM   #9
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: 41,789
Karma: 18984052
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
copy paste will always work. An absolute path should work, if you get it right
kovidgoyal is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to remove CSS style sheet from epub files Achromatic Calibre 2 01-01-2016 11:15 AM
css code ignored in conversion barrytatt Conversion 2 12-26-2014 07:41 AM
CSS conversion from a plugin jgoguen Development 1 02-13-2013 12:11 AM
An example file of your CSS style sheet roger64 Writer2ePub 6 04-11-2012 03:59 AM
Additional CSS for conversion LARdT Calibre 6 02-18-2010 08:52 PM


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


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