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 10-17-2015, 03:31 PM   #1
porphyry5
Connoisseur
porphyry5 began at the beginning.
 
Posts: 63
Karma: 10
Join Date: Apr 2013
Device: Kobo Clara, Onyx Boox Monte Cristo
How does ebook-convert react to plain text input

I mostly use calibre in semi-automatic scripts to convert pdfs and ocr-ed texts to epub format, and have found more or less by accident, when producing .txt input to calibre, that it reacts to various cues in the text. For example:
Lines beginning with the word 'Chapter' and not ending in a period will appear in the epub as bolded chapter headings on a fresh page and with an entry in the inline TOC, but if it ends with a period it is treated as an ordinary text paragraph;
If a line is bounded with underscores, it appears in the epub in italic text.

I have not been able to find any documentation specific to how ebook-convert reacts to such text patterns, but was wondering if there are others, such as might produce bolded text in the epub, or indent an entire block of text.

I realize that such effects, and many more, can be obtained by converting the txt to html, but the txt process is so much more automatic that I far prefer to use it if possible.
porphyry5 is offline   Reply With Quote
Old 10-17-2015, 10:54 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: 43,776
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
http://manual.calibre-ebook.com/conv...-txt-documents
kovidgoyal is offline   Reply With Quote
Old 10-18-2015, 08:44 AM   #3
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
Markdown works really well with calibre and plain text sources.

See https://daringfireball.net/projects/markdown/ then use calibre's options on the "TXT Input" section of the conversion dialogue.

Pre-processing your plain text with some regex can be an efficient way of introducing Markdown for calibre to detect so that your book gets some structure and style.

If you want to extend Markdown's styling then you can add your own syntax in your plain text file and then post-process the converted book with calibre's editor and regex.

I'm not sure if you can change the options with ebook-convert but you could set them as defaults.

___

@porphyry5 : Do you really still have a working PRS-300 ?

Last edited by Agama; 10-18-2015 at 09:40 AM.
Agama is offline   Reply With Quote
Old 10-23-2015, 02:48 PM   #4
porphyry5
Connoisseur
porphyry5 began at the beginning.
 
Posts: 63
Karma: 10
Join Date: Apr 2013
Device: Kobo Clara, Onyx Boox Monte Cristo
Quote:
Originally Posted by kovidgoyal View Post
Thanks, I guess what I'm doing is as far as one can go without resorting to html or markdown.
porphyry5 is offline   Reply With Quote
Old 10-23-2015, 03:21 PM   #5
porphyry5
Connoisseur
porphyry5 began at the beginning.
 
Posts: 63
Karma: 10
Join Date: Apr 2013
Device: Kobo Clara, Onyx Boox Monte Cristo
Quote:
Originally Posted by Agama View Post
Markdown works really well with calibre and plain text sources.

See https://daringfireball.net/projects/markdown/ then use calibre's options on the "TXT Input" section of the conversion dialogue.

Pre-processing your plain text with some regex can be an efficient way of introducing Markdown for calibre to detect so that your book gets some structure and style.

If you want to extend Markdown's styling then you can add your own syntax in your plain text file and then post-process the converted book with calibre's editor and regex.

I'm not sure if you can change the options with ebook-convert but you could set them as defaults.

___

@porphyry5 : Do you really still have a working PRS-300 ?
Thanks for your help. No, my PRS-300 is a goner, and I'm now thinking of updating its successor, a Nook Glowlight.

Command-line apps never give you less options than their gui equivalents, and mostly a lot more, though I think calibre is exceptional in that you get every option no matter which way you use it. And if you automate your processes with scripts as I do, the commandline is essential.

I've not used the text markdown calibre offers, nor xpath for that matter, preferring to use the minimum, bash, html and vimscript, to do everything. I get confused enough between just those three, using some other syntax than that for the language I'm coding in. I'm sure adding more languages increases confusion exponentially, which is why I almost never use awk or sed any more.

So I think my fiction conversions will have to continue being plain vanilla as to formatting.
porphyry5 is offline   Reply With Quote
Old 10-23-2015, 11:43 PM   #6
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
Markdown is so simple and even makes your plain text prettier. It's not actually a language to learn but a clever and intuitive styling syntax coded in... vanilla plain text!

Have a scan of its website, you may be pleasantly surprised.

See https://daringfireball.net/projects/markdown/basics

With your source remaining plain text it is still easy to apply scripted automations prior to calibre conversion.

Last edited by Agama; 10-24-2015 at 07:39 AM.
Agama is offline   Reply With Quote
Old 10-31-2015, 01:05 PM   #7
porphyry5
Connoisseur
porphyry5 began at the beginning.
 
Posts: 63
Karma: 10
Join Date: Apr 2013
Device: Kobo Clara, Onyx Boox Monte Cristo
Quote:
Originally Posted by Agama View Post
Markdown is so simple and even makes your plain text prettier. It's not actually a language to learn but a clever and intuitive styling syntax coded in... vanilla plain text!

Have a scan of its website, you may be pleasantly surprised.

See https://daringfireball.net/projects/markdown/basics

With your source remaining plain text it is still easy to apply scripted automations prior to calibre conversion.
Thank you very much for turning me on to this, I'm sold, the markdowned text is so unobtrusive that it's as readable as plain text, not something one can say about html.

And no problem with using command-line tools, just a slight change in the conversion options.
porphyry5 is offline   Reply With Quote
Old 11-06-2015, 07:27 PM   #8
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
Agama is offline   Reply With Quote
Reply

Tags
ebook-convert, epub, text

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Software: convert plain text files to epub/mobi format MobiEpubMaker Workshop 38 04-27-2015 05:52 AM
Copy plain text from ebook reader BetterRed Calibre 17 05-08-2013 05:38 AM
Problem with ebook-convert and "." in input file name Terisa de morgan Conversion 1 01-04-2013 07:29 AM
convert plain text to other formats ? Joebill Other formats 6 05-10-2010 11:10 PM
A java/Groovy program to convert plain text into pdf for eslick dracodoc PDF 1 04-12-2009 09:29 AM


All times are GMT -4. The time now is 03:12 PM.


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