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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 06-28-2010, 12:09 PM   #1
Todd
Junior Member
Todd began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jun 2010
Device: Moto Droid
TOC question

How do i generate TOC from a plain txt file that has no markup, or HTML, but only:
blahblahblah.

Chapter 2

Blahblahblah
Or should I just figure out a sed regex to add <h1> or whatever tags before I run it thru Calibre?
Todd is offline   Reply With Quote
Old 06-28-2010, 12:54 PM   #2
jackie_w
Wizard
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: 2,781
Karma: 3973173
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"
Edit your .TXT file's headings using markdown like so:-

Code:
# My Book Title

# My Book's Author

///Table of Contents///

## CHAPTER 1

... blah blah blah ...

## CHAPTER 2

... blah blah blah ...
The single # lines will be treated as <h1> and the ## lines as <h2>.

The ///Table of Contents/// line should be placed where you want the internal TOC to be.

When you're done editing, convert the TXT file, but make sure you check the [Convert] - [TXT Input] - "Process using markdown" box.

You can read more about markdown here

Good Luck
jackie_w is offline   Reply With Quote
 
Enthusiast
Old 06-29-2010, 03:37 AM   #3
Todd
Junior Member
Todd began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jun 2010
Device: Moto Droid
That works, thanks
Todd is offline   Reply With Quote
Old 06-29-2010, 03:25 PM   #4
nyrath
Addict
nyrath reads XML... blindfoldednyrath reads XML... blindfoldednyrath reads XML... blindfoldednyrath reads XML... blindfoldednyrath reads XML... blindfoldednyrath reads XML... blindfoldednyrath reads XML... blindfoldednyrath reads XML... blindfoldednyrath reads XML... blindfoldednyrath reads XML... blindfoldednyrath reads XML... blindfolded
 
nyrath's Avatar
 
Posts: 281
Karma: 52007
Join Date: Jun 2010
Device: nook
However, I did find out the hard way that Markdown considers indenting to mean "wrap this in <code> tags"

I had been using tabs in my text file to mark paragraphs. When I used the markdown method to create a TOC, the entire book turned into monospaced non-broken lines.

Removing the tabs and adding blank lines between the paragraphs fixed the problem.
nyrath is offline   Reply With Quote
Old 07-09-2010, 02:43 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: 651
Karma: 436517
Join Date: Jul 2010
Location: UK
Device: PRS-300, PW2
This is not really a problem because Markdown is designed to work that way. It's described in the Markdown reference under [Code Blocks]. Starting a line with at least 4 spaces or 1 tab triggers a code block.

Incidentally, ending a line with 2 spaces triggers a hard line break, which can be useful.

Markdown is an excellent pre-processor for generating ebooks from plain text.
Agama is offline   Reply With Quote
Old 07-15-2010, 07:16 PM   #6
JaneD
Addict
JaneD ought to be getting tired of karma fortunes by now.JaneD ought to be getting tired of karma fortunes by now.JaneD ought to be getting tired of karma fortunes by now.JaneD ought to be getting tired of karma fortunes by now.JaneD ought to be getting tired of karma fortunes by now.JaneD ought to be getting tired of karma fortunes by now.JaneD ought to be getting tired of karma fortunes by now.JaneD ought to be getting tired of karma fortunes by now.JaneD ought to be getting tired of karma fortunes by now.JaneD ought to be getting tired of karma fortunes by now.JaneD ought to be getting tired of karma fortunes by now.
 
JaneD's Avatar
 
Posts: 288
Karma: 998895
Join Date: May 2010
Location: LA, CA
Device: Kindle DX, Kindle 3 (Keyboard), Nexus 7 (2013)
Quote:
Originally Posted by jackie_w View Post
Edit your .TXT file's headings using markdown like so:-

Code:
# My Book Title

# My Book's Author

///Table of Contents///

## CHAPTER 1

... blah blah blah ...

## CHAPTER 2

... blah blah blah ...
The single # lines will be treated as <h1> and the ## lines as <h2>.

The ///Table of Contents/// line should be placed where you want the internal TOC to be.

When you're done editing, convert the TXT file, but make sure you check the [Convert] - [TXT Input] - "Process using markdown" box.

You can read more about markdown here

Good Luck
Jackie, just used this for a book I was converting and it worked great! Sent karma your way - thanks!
JaneD is offline   Reply With Quote
Old 07-15-2010, 08:22 PM   #7
jackie_w
Wizard
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: 2,781
Karma: 3973173
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"
Glad to have helped
jackie_w 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
TOC question for JBL Pranananda Ectaco jetBook 1 06-22-2010 07:55 AM
6.0 TOC question Amalthia Calibre 3 07-30-2009 12:45 PM
New to Calibre... TOC question ruchti Calibre 10 06-08-2009 05:53 PM
BD TOC Question Novasea Workshop 5 10-27-2008 11:38 AM
toc question zelda_pinwheel IMP 4 01-18-2008 10:49 AM


All times are GMT -4. The time now is 03:36 AM.


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