12-01-2009, 02:25 PM | #1 |
Grand Sorcerer
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?
|
12-01-2009, 04:17 PM | #2 |
Wizard
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= |
Advert | |
|
12-01-2009, 04:36 PM | #3 |
GuteBook/Mobi2IMP Creator
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 |
12-01-2009, 05:59 PM | #4 | |
Grand Sorcerer
Posts: 11,256
Karma: 35000000
Join Date: Jan 2008
Device: Pocketbook
|
Quote:
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. |
|
12-01-2009, 06:49 PM | #5 | |
Wizard
Posts: 3,671
Karma: 12205348
Join Date: Mar 2008
Device: Galaxy S, Nook w/CM7
|
Quote:
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">
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')]" Code:
--level1-toc="//h:a[re:test(@class, 'TOC*', 'i')]" Last edited by =X=; 12-01-2009 at 06:51 PM. Reason: Added clarification |
|
Advert | |
|
12-01-2009, 06:57 PM | #6 |
Grand Sorcerer
Posts: 11,256
Karma: 35000000
Join Date: Jan 2008
Device: Pocketbook
|
Thanks to both of you. I will try this out in the morning....
|
12-02-2009, 07:45 AM | #7 | |
GuteBook/Mobi2IMP Creator
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:
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! |
|
|
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 |