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

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 06-22-2010, 03:08 PM   #1
Kivgaen
Enthusiast
Kivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enough
 
Kivgaen's Avatar
 
Posts: 38
Karma: 608
Join Date: Aug 2009
Location: Toronto
Device: all devices
How does the TOC editor work?

I want to build a TOC for this .epub file and I can't figure out how to add to the table of contents. For some reason with this particular .epub file generated from InDesign, the TOC navigation wasn't automatically added in.

Can someone give me a hand in figuring out how to add stuff with Sigil to the TOC?

Cheers,

Luise
Kivgaen is offline   Reply With Quote
Old 06-22-2010, 03:49 PM   #2
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 2,504
Karma: 13830371
Join Date: Apr 2010
Location: Phoenix, AZ
Device: Kindle2, iPad, KindleFire and NookColor
TOCs, Headers and other strangers

Oh, oh!! I know that one!

In Sigil, this is simplicity itself. For every Chapter Heading, e.g., if you have:

"Chapter One"

Just highlight the Chapter One text and select "Heading 1" from the drop-down list on the left-hand side of the menu box. For sub-chapters, if you have them, choose Heading 2, and so on.

If you have an ACT structure--which I do for many clients--I use Heading 1 for the Acts (Act I, Act II, etc.) and Heading 2 for the Chapters. You can also do this in codeview, if you wish, in the html, which I actually how I do it, but everyone has their own way of working.

You can also use a spiffy feature of Sigil that I particulary like and end up using surprisingly often--you can create a TOC item for something that does not have text, like an illustration, by inserting a header on the page (you have to do this in codeview), thusly:
Code:
<h3 title="Illustration:  Map of Disneyland"></h3>
or wrap the same header tag around an image. The text contained within the title attribute, in this case, Map of Disneyland, will show up in the Table of Contents.

You can then view the TOC in the TOC editor. You can select items to omit by deselecting them (scroll to the right in the TOC editor where you'll see the checkmarks--uncheck anything you do not want to include).

You can start out getting a feel for this by just doing one Chapter header, then look at the TOC Editor to see it building; it'll give you a good idea of what's going on and help you build your TOC.

n.b.--you'll probably have to restyle your headers in your CSS, if you have not already included them in that file; be prepared for them to go wonky if the CSS isn't already there, so don't panic if they are suddenly Arial 14 or whatever.

I hope that helped!!

Hitch
Hitch is offline   Reply With Quote
 
Enthusiast
Old 06-22-2010, 03:54 PM   #3
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 14,854
Karma: 5654321
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by Kivgaen View Post
I want to build a TOC for this .epub file and I can't figure out how to add to the table of contents. For some reason with this particular .epub file generated from InDesign, the TOC navigation wasn't automatically added in.

Can someone give me a hand in figuring out how to add stuff with Sigil to the TOC?

Cheers,

Luise
AFAIKT The TOC editor is for removing entries that would show up otherwise. (un-tick the ones you don't want to see)

Any H1, H2, H3 tagged items appear in the TOC.

I tend to use H2 for multi part books and H3 for chapters.
That way the TOC indent

Code:
Book Title
...
   <h2>Part 6: Disaster Strikes </h2>
      <h3>Chapter 20:  Flood </h3>
      <h3>Chapter 21:  Pestilence</h3> 
...
If the Chapter Headings exist, just select and use the Select Headings pull down.
theducks is offline   Reply With Quote
Old 06-22-2010, 04:10 PM   #4
Kivgaen
Enthusiast
Kivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enough
 
Kivgaen's Avatar
 
Posts: 38
Karma: 608
Join Date: Aug 2009
Location: Toronto
Device: all devices
Hmm...

So what if your .epub document was generated with automatic styles, and uses the following code:

Code:
<p class="h1"> Heading 1</p>

<p class="h2">Heading 2</p>

<p class="tf">First paragraph without any indent</p>

<p class="tx">Second paragraph, with indent.</p>


with associated styles already generated...
If I already have the above structure, and I don't want to screw it up or mess with the way my document looks, THEN how would I generate a TOC?

Last edited by Kivgaen; 06-22-2010 at 04:10 PM. Reason: spelling
Kivgaen is offline   Reply With Quote
Old 06-22-2010, 04:23 PM   #5
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 14,854
Karma: 5654321
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by Kivgaen View Post
Hmm...

So what if your .epub document was generated with automatic styles, and uses the following code:

Code:
<p class="h1"> Heading 1</p>

<p class="h2">Heading 2</p>

<p class="tf">First paragraph without any indent</p>

<p class="tx">Second paragraph, with indent.</p>


with associated styles already generated...
If I already have the above structure, and I don't want to screw it up or mess with the way my document looks, THEN how would I generate a TOC?
Someone else will have to step in with the definitive answer, but my guess is you need to change the stylsheet:
make a h.h1 class out of the p.h1 class and change the p tag pairs to h1 in your book (repeat for h2 and h3 )
theducks is offline   Reply With Quote
Old 06-22-2010, 04:28 PM   #6
Valloric
Created Sigil, FlightCrew
Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.
 
Valloric's Avatar
 
Posts: 1,978
Karma: 350515
Join Date: Feb 2008
Device: Sony Reader PRS 505
In general, I recommend reading the manual. There's a section for the TOC editor.

Quote:
Originally Posted by Kivgaen View Post
Hmm...

So what if your .epub document was generated with automatic styles, and uses the following code:

Code:
<p class="h1"> Heading 1</p>

<p class="h2">Heading 2</p>

<p class="tf">First paragraph without any indent</p>

<p class="tx">Second paragraph, with indent.</p>


with associated styles already generated...
If I already have the above structure, and I don't want to screw it up or mess with the way my document looks, THEN how would I generate a TOC?
With Sigil, you wouldn't be able to use that markup to create a TOC. On a related note, using paragraph elements for headings with "h1" classes is... not a good idea. Far from it. It would be much simpler to just use
Code:
<h1> Heading 1</h1>
with the styles applied to the "h1" class applied for all h1 elements. This approach also uses nice semantic markup.

You could easily convert to this scheme with a regex search&replace operation.
Valloric is offline   Reply With Quote
Old 06-22-2010, 05:13 PM   #7
st_albert
Fanatic
st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.
 
Posts: 544
Karma: 64420
Join Date: Feb 2010
Device: none
Quote:
Originally Posted by Valloric View Post
With Sigil, you wouldn't be able to use that markup to create a TOC. On a related note, using paragraph elements for headings with "h1" classes is... not a good idea. Far from it. It would be much simpler to just use
Code:
<h1> Heading 1</h1>
with the styles applied to the "h1" class applied for all h1 elements. This approach also uses nice semantic markup.

You could easily convert to this scheme with a regex search&replace operation.
That is how I do it with epubs exported from indesign ID4. I unpack the ID4 epub, which contains the whole book as a single .xhtml file, and do various clean-up before feeding it to sigil. For the above example, you could do something like:

search for: <p class="h1"> (Heading\s\n+?)</p>

replace with: <h2>\0</h2>

where "\0" refers to whatever is in parenthesis in the search string. Note that sigil uses \1 for the first set of parentheses, and a checkbox for minimal search instead of the perl "?". My example uses the syntax of the bluefish html editor.

Then, in the stylesheet, create a style for h2 that is a copy of the style specified by p.h1 (in this example. YMMV). If you've just replaced all of the <p class="h1"> tags, you can remove the p.h1 style from the stylesheet.

While I'm at it, I do other cleanup tasks that are best done globally, like insert sigil chapter-break marks, etc. and then re-zip the original epub and feed it to sigil for breaking up into chapters and any final polishing needed.
st_albert is offline   Reply With Quote
Old 06-22-2010, 07:46 PM   #8
Kivgaen
Enthusiast
Kivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enough
 
Kivgaen's Avatar
 
Posts: 38
Karma: 608
Join Date: Aug 2009
Location: Toronto
Device: all devices
Quote:
Originally Posted by st_albert View Post
That is how I do it with epubs exported from indesign ID4. I unpack the ID4 epub, which contains the whole book as a single .xhtml file, and do various clean-up before feeding it to sigil. For the above example, you could do something like:

search for: <p class="h1"> (Heading\s\n+?)</p>

replace with: <h2>\0</h2>

where "\0" refers to whatever is in parenthesis in the search string. Note that sigil uses \1 for the first set of parentheses, and a checkbox for minimal search instead of the perl "?". My example uses the syntax of the bluefish html editor.

Then, in the stylesheet, create a style for h2 that is a copy of the style specified by p.h1 (in this example. YMMV). If you've just replaced all of the <p class="h1"> tags, you can remove the p.h1 style from the stylesheet.

While I'm at it, I do other cleanup tasks that are best done globally, like insert sigil chapter-break marks, etc. and then re-zip the original epub and feed it to sigil for breaking up into chapters and any final polishing needed.
I don't understand what you are saying... if My chapter headings looked like this:

<p class="h1">1. The Other Minister</p>

<p class="h1">2. Spinner's End</p>

<p class="h1">3. Will and Won't</p>

etc...

Then I could do a global find and replace that would search for the first instance of <p class="h1">... and then grab all of the string between that and the closing </p> tag and plop it into the new <h1> tag?

If that's what you're saying, that's perfect...
Kivgaen is offline   Reply With Quote
Old 06-22-2010, 08:43 PM   #9
st_albert
Fanatic
st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.st_albert calls his or her ebook reader Vera.
 
Posts: 544
Karma: 64420
Join Date: Feb 2010
Device: none
Quote:
Originally Posted by Kivgaen View Post
I don't understand what you are saying... if My chapter headings looked like this:

<p class="h1">1. The Other Minister</p>

<p class="h1">2. Spinner's End</p>

<p class="h1">3. Will and Won't</p>

etc...

Then I could do a global find and replace that would search for the first instance of <p class="h1">... and then grab all of the string between that and the closing </p> tag and plop it into the new <h1> tag?

If that's what you're saying, that's perfect...
Yes, that is what I'm saying exactly. You need to use a "regular expression" search which would look something like this in sigil:

Find what: <p class="h1">(.+)</p>

and it means roughly this: "find a string that starts with <p class="h1">, followed by one or more of any character [that's the .+ part], followed by </p>. The parenthesis means "remember the part of the string that's represented by .+ -- that is, the "one or more characters" between the <p class="h1"> and the </p>." In general, you could have more than one set of parentheses. The contents of the first set gets assigned to the temporary variable \1, the second set to \2, and so on.

You must also check the box "Minimal Matching" on the search dialog, and choose the "Regular expression" radio button, and the "down" button.

If you don't check "minimal matching" the search string will match as big a string as possible, which would be from the first <p class="h1"> to the very last <p/> in the file, which you don't want in this case!

If your head seems like it's ready to explode, don't worry. It probably won't. That's a normal reaction to the concept of regular expressions. You get used to it, supposedly.

OK, now the fun part. the "Replace With:" string looks like this:

<h1>\1</h1>

which means that the <p class="h1"> gets replaced by <h1>, the </p> gets replaced with </h1>, and the contents of variable \1 (i.e. the actual text of the header) gets put in between. Voila.

I strongly recommend you test your regular expression using just "find," not "replace," before you turn it loose. Sometimes that's the only way to be sure what a given regex will do.

check out Zelda_Pinwheel's excellent thread on this topic. Lots of great information. It is here:

http://www.mobileread.com/forums/showthread.php?t=75805

Phew, that's a long and detailed answer from someone who knows next to diddly about regex. If I've made a mess of things, I hope someone more knowledgeable (Y'all know who you are!) will come along and clean it up.
st_albert is offline   Reply With Quote
Old 06-22-2010, 09:29 PM   #10
capidamonte
Not who you think I am...
capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!
 
capidamonte's Avatar
 
Posts: 346
Karma: 5337
Join Date: Jan 2010
Location: Honolulu
Device: Sony PRS-350
Quote:
OK, now the fun part. the "Replace With:" string looks like this:

<h1>\1</h1>

which means that the <p class="h1"> gets replaced by <h1>, the </p> gets replaced with </h1>, and the contents of variable \1 (i.e. the actual text of the header) gets put in between.
Minor niggle:

Your explanation implies that because your search has three parts and your replacement has three parts, each part is being individually replaced.

It's one blob being replaced by another blob that has a sub-blob being remembered from the first blob and inserted somewhere. Does that make sense?

As a way of exampling, using your search example above, you could replace with \1 or MAD-SEARCHEZ!!1 or <h1></h1>\1 -- it's all one blob, replacing the blob that matched the search blob.

The reason I stress this, it's really useful to change the order of things using multiple sub-matches, but you must be clear that the pattern is not implicit, it's an overt expression.

June 14th, 2010, say, can become 14-June-2010 or 2010-June-14 or anything else pretty easily. e.g.

Code:
Search: (.+) (\d\d)th (\d\d\d\d)
Replace: \2-\1-\3
  or
Replace: \3-\1-\2
  or
Replace: Today is the \2th day of the month of \1 in the year \3.
Hope that wasn't too much,

cap
capidamonte is offline   Reply With Quote
Old 06-23-2010, 01:13 AM   #11
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 2,504
Karma: 13830371
Join Date: Apr 2010
Location: Phoenix, AZ
Device: Kindle2, iPad, KindleFire and NookColor
cap:

You know her head just exploded, right? ;-)

Hitch
Hitch is offline   Reply With Quote
Old 06-23-2010, 04:11 AM   #12
capidamonte
Not who you think I am...
capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!capidamonte , Klaatu Barada Niktu!
 
capidamonte's Avatar
 
Posts: 346
Karma: 5337
Join Date: Jan 2010
Location: Honolulu
Device: Sony PRS-350
Too many blobs?

cap
capidamonte is offline   Reply With Quote
Old 06-23-2010, 09:46 AM   #13
sherman
Addict
sherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animals
 
Posts: 268
Karma: 6566
Join Date: Aug 2008
Location: New Plymouth - NZ
Device: Sony PRS-505/SC, B&N Nook, Sony PRS-650/BC, Kobo Glo
Quote:
Originally Posted by st_albert View Post
Yes, that is what I'm saying exactly. You need to use a "regular expression" search which would look something like this in sigil:

Find what: <p class="h1">(.+)</p>

...
Personally, for added safety (especially if your forget to check the minimal matching!!) I would use something like:

Find what: <p class="h1">([^<]+)</p>

The only difference from a users point of view is that you are guaranteed that the regex will stop at the first < it comes across.

.+ means search for 1 or more character, no matter what it is.

[^<]+ means search for 1 or more of any character that is not '<'

You would use the same replace term in either case - <h1>\1</h1>
sherman is online now   Reply With Quote
Old 06-23-2010, 10:30 AM   #14
Kivgaen
Enthusiast
Kivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enough
 
Kivgaen's Avatar
 
Posts: 38
Karma: 608
Join Date: Aug 2009
Location: Toronto
Device: all devices
about blobs...

Thanks, that was all very well explained. (And no, my head didn't explode... although I agree, there may have been a few too many blobs.)

I'm actually a mathematician, so the idea of expressions is old hat to me. You all explained it very well. Thanks for the link to that thread -- I'll check it out later if I need more assistance when I get started on my next book.

Thanks for all the help (and the laughs). I can't wait to get to work today and try it out. (which reminds me... I'm late already!)

Kivgaen is offline   Reply With Quote
Old 06-23-2010, 11:36 AM   #15
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 2,504
Karma: 13830371
Join Date: Apr 2010
Location: Phoenix, AZ
Device: Kindle2, iPad, KindleFire and NookColor
Blob-A-Ran

Quote:
Originally Posted by capidamonte View Post
Too many blobs?

cap
And cap, just for you:

Blob-blob-blob, blob-blob-aran,
Blob-blob-blob, blob-blob-aran
Oh Blob-ar-ah-an,
Come take my ha-a-nd....
Blob-ar-aaan,
You got me cutting-and-a-pastin',
searchin' and replacin'
Blob-a-ran blob blob
Blob blob-a-ran
Went to a File, Looking for a Style,
Saw Blab-a-ran, thought she'd go a mile,
With Blob-a-ran, blob-a-ran
Come Take my H-a-a-nd....


with big-time apologies to the Beach Boys. For those of you that like me, are nearly older than dirt.

Hitch
Hitch 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
Sigil Toc editor Enesco Sigil 16 09-23-2010 06:41 AM
PRS-500 Software: LRF TOC Editor v1.02 hal9000 Sony Reader Dev Corner 29 07-04-2010 07:17 PM
Problem with TOC editor alecE Sigil 2 10-29-2009 01:30 AM
Getting TOC to work? enarchay Sony Reader 11 05-28-2009 05:46 AM
Making a TOC for LRFs? Issues with Calibre + LRF TOC editor not working Magitek LRF 0 05-06-2009 01:25 PM


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


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