10-17-2015, 03:31 PM | #1 |
Connoisseur
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. |
10-17-2015, 10:54 PM | #2 |
creator of calibre
Posts: 43,776
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
10-18-2015, 08:44 AM | #3 |
Guru
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. |
10-23-2015, 02:48 PM | #4 | |
Connoisseur
Posts: 63
Karma: 10
Join Date: Apr 2013
Device: Kobo Clara, Onyx Boox Monte Cristo
|
Quote:
|
|
10-23-2015, 03:21 PM | #5 | |
Connoisseur
Posts: 63
Karma: 10
Join Date: Apr 2013
Device: Kobo Clara, Onyx Boox Monte Cristo
|
Quote:
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. |
|
10-23-2015, 11:43 PM | #6 |
Guru
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. |
10-31-2015, 01:05 PM | #7 | |
Connoisseur
Posts: 63
Karma: 10
Join Date: Apr 2013
Device: Kobo Clara, Onyx Boox Monte Cristo
|
Quote:
And no problem with using command-line tools, just a slight change in the conversion options. |
|
11-06-2015, 07:27 PM | #8 |
Guru
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
|
|
Tags |
ebook-convert, epub, text |
Thread Tools | Search this Thread |
|
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 | 1 | 04-12-2009 09:29 AM |