Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Workshop

Notices

Reply
 
Thread Tools Search this Thread
Old 12-01-2009, 02:25 PM   #1
Greg Anos
Grand Sorcerer
Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.
 
Posts: 11,256
Karma: 35000000
Join Date: Jan 2008
Device: Pocketbook
How to built a TOC from scratch?

I have a extremely simple HTML file I'd like to convert to various formats. It has no TOC, all branching is done by internal hyperlinks. Sigil will convert to EPUB, retaining the hyperlinks, but still without the TOC. How do you put in the TOC?
Greg Anos is offline   Reply With Quote
Old 12-01-2009, 04:17 PM   #2
=X=
Wizard
=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.
 
=X='s Avatar
 
Posts: 3,671
Karma: 12205348
Join Date: Mar 2008
Device: Galaxy S, Nook w/CM7
Every eBook foremat has their own syntax/method for TOC. Though they all support internal Hyperlinks.

However if you use calibre to convert the HTML to an eBook format you can pass in XPath syntax from the command line or GUI to create a TOC.


The manual way is just to modify the HTML by hand and add a TOC based on hyperlinks. This is a pain for PRS-505 users.

=X=
=X= is offline   Reply With Quote
Advert
Old 12-01-2009, 04:36 PM   #3
nrapallo
GuteBook/Mobi2IMP Creator
nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.
 
nrapallo's Avatar
 
Posts: 2,958
Karma: 2530691
Join Date: Dec 2007
Location: Toronto, Canada
Device: REB1200 EBW1150 Device: T1 NSTG iLiad_v2 NC Device: Asus_TF Next1 WPDN
I have successfully used Mobipocket Creator to add a Table of Contents to large .html ebooks I converted to various ebook formats, not just the .prc format.

What is required is to start Mobipocket Creator and then import your .html file and go to the Table of Contents section and click "Add a Table of Contents".

For the first level toc entries, choose the html tag name that identifies your toc entries and then place the attribute and value as well. For example, if all of your chapter headings are encased by a <div align="right"> ... </div>, then you would enter:
Tag name = div, Attribute = align and Value = right.

Another example chapter heading could be <p class="ch_heading"> in which case you use: p, class, ch_heading.

Mobipocket will alter your .html to place "id=" names and build an external toc .html file, which you could extract and place within your .html afterwards.

I used this same technique with several large ebooks I converted, the World Fact Book and Webster's Dictionary 1913.

Below is a screenshot of what that Table of Contents screen looks like (ignore the second and third levels).

Last edited by nrapallo; 12-01-2009 at 05:21 PM. Reason: typo
nrapallo is offline   Reply With Quote
Old 12-01-2009, 05:59 PM   #4
Greg Anos
Grand Sorcerer
Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.
 
Posts: 11,256
Karma: 35000000
Join Date: Jan 2008
Device: Pocketbook
Quote:
Originally Posted by nrapallo View Post
I have successfully used Mobipocket Creator to add a Table of Contents to large .html ebooks I converted to various ebook formats, not just the .prc format.

What is required is to start Mobipocket Creator and then import your .html file and go to the Table of Contents section and click "Add a Table of Contents".

For the first level toc entries, choose the html tag name that identifies your toc entries and then place the attribute and value as well. For example, if all of your chapter headings are encased by a <div align="right"> ... </div>, then you would enter:
Tag name = div, Attribute = align and Value = right.

Another example chapter heading could be <p class="ch_heading"> in which case you use: p, class, ch_heading.

Mobipocket will alter your .html to place "id=" names and build an external toc .html file, which you could extract and place within your .html afterwards.

I used this same technique with several large ebooks I converted, the World Fact Book and Webster's Dictionary 1913.

Below is a screenshot of what that Table of Contents screen looks like (ignore the second and third levels).


Please let me get this straight.

I'm looking at a HTML with an internal link of --- <A HREF="unique identifier">...</A>.

The receiving link is <A name=unique identifier></A>

I can see plugging the A and the HREF but what do you do with the unique indentifier? (Each internal link has a different tag...)



Sorry for the ignorant questions, but you can't learn without asking....

Last edited by Greg Anos; 12-01-2009 at 06:04 PM.
Greg Anos is offline   Reply With Quote
Old 12-01-2009, 06:49 PM   #5
=X=
Wizard
=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.
 
=X='s Avatar
 
Posts: 3,671
Karma: 12205348
Join Date: Mar 2008
Device: Galaxy S, Nook w/CM7
Quote:
Originally Posted by Ralph Sir Edward View Post
Please let me get this straight.

I'm looking at a HTML with an internal link of --- <A HREF="unique identifier">...</A>.

The receiving link is <A name=unique identifier></A>

I can see plugging the A and the HREF but what do you do with the unique indentifier? (Each internal link has a different tag...)



Sorry for the ignorant questions, but you can't learn without asking....
You can't, calbire did allow wild characters to create a TOC but MobiCreator does not.

You would have to create a class for all the <A> that you wanted to be a TOC.

Add the syntax in red
Code:
<A class="TOC" id="unique">
Then in the text box put

Code:
A   CLASS    TOC


This would be the syntax you would pass for calibre
Code:
<A class="TOC" id="unique">
<A class="TOC_LEVEL1" id="unique">
<A class="TOC_LEVEL1" id="unique">

--level1-toc="//h:a[re:test(@class, 'TOC', 'i')]"
--level2-toc="//h:a[re:test(@class, 'TOC_LEVEL1', 'i')]"
--level3-toc="//h:a[re:test(@class, 'TOC_LEVEL2', 'i')]"
I think the wild card is a "*" or a "?" but I can't remember.
Code:
--level1-toc="//h:a[re:test(@class, 'TOC*', 'i')]"
=X=

Last edited by =X=; 12-01-2009 at 06:51 PM. Reason: Added clarification
=X= is offline   Reply With Quote
Advert
Old 12-01-2009, 06:57 PM   #6
Greg Anos
Grand Sorcerer
Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.Greg Anos ought to be getting tired of karma fortunes by now.
 
Posts: 11,256
Karma: 35000000
Join Date: Jan 2008
Device: Pocketbook
Thanks to both of you. I will try this out in the morning....
Greg Anos is offline   Reply With Quote
Old 12-02-2009, 07:45 AM   #7
nrapallo
GuteBook/Mobi2IMP Creator
nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.
 
nrapallo's Avatar
 
Posts: 2,958
Karma: 2530691
Join Date: Dec 2007
Location: Toronto, Canada
Device: REB1200 EBW1150 Device: T1 NSTG iLiad_v2 NC Device: Asus_TF Next1 WPDN
Quote:
Originally Posted by Ralph Sir Edward View Post
Please let me get this straight.

I'm looking at a HTML with an internal link of --- <A HREF="unique identifier">...</A>.

The receiving link is <A name=unique identifier></A>

I can see plugging the A and the HREF but what do you do with the unique indentifier? (Each internal link has a different tag...)



Sorry for the ignorant questions, but you can't learn without asking....
If what you are doing is compiling a Table of Contents to important sections within your ebook, then you need to link, in that TOC, to the place where your "chapter" / sections are. If that "chapter" is identified by <h1> or <h2>, then you would use just that Tag name in bold with Mobipocket Creator.

If, on the other hand, you want to build a TOC with all your internal links, then just use Tag name = a and Attribute = href without specifying any Value. (This is the case you described above.)

It's quite powerful and can be augmented as =X= mentions above using a class definition with only the "links" you desire to be in the TOC generated by Mobipocket Creator.

I hope your experimentation has proved fruitful!
nrapallo is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a TOC from scratch? greenapple Sigil 5 06-01-2010 02:20 AM
Starting from Scratch (again!) krisk Lounge 55 06-10-2009 06:25 PM
Scratch/Crack Halk Bookeen 10 11-28-2008 03:52 AM
Can you scratch the screen? gregr209 Amazon Kindle 5 11-26-2007 12:12 PM
Scratch protection anathema Sony Reader 17 10-12-2007 11:53 AM


All times are GMT -4. The time now is 02:01 AM.


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