Quick Solution: 1) Download Sigil 2) Open your book in Sigil 3) Click on toc in the book browser 4) Click on code view in the top toolbar 5) Delete the extraneous lines of html which are causing the gaps or dashes.
How I Got There: After hours and hours of frustrating brain-wrangling and googling I finally figured out what was wrong so am posting it for the benefit of anyone else in years to come who may come across this.
After two of the most horrible days I’ve ever had as an author and exhausting every possible avenue I decided to just stare at the table of contents with its dashes and gaps until a light bulb went on. Suddenly, it hit me. All the chapters with gaps before them were ones that I had edited and replaced in InDesign *after including a TOC*.
I correctly guessed that the code for those now deleted chapters was still lingering somewhere. I had a look at the ncx file (which contains the TOC code) by copying my booktitle.epub, then renaming the copy booktitle.zip, opening it and navigating to OEBPS/toc.ncx
Sure enough where the dashes and gaps were showing in the toc in my ebook reader (I was using Adobe DE), there were extra lines in the code with <text> </text> as shown in the screenshot below, indicating that my TOC had clickable links with no text, which were displaying as gaps.
When I opened the ncx in notepad, by the way, it was a mess as you can see from the lower portion of the screenshot. By the time I took the screenshot I’d already tidied up the upper portion in order to see where the problem was as that messy code was doing my head in.
I tried to manually order the code by altering the navpoint and playorder numbers to make them sequential, as I used to do back in the days when you had to handcode epubs, then replace the new toc.ncx back into the unzipped folder, zip it up again and resave it as an epub. ADE wouldn’t even open it. Brilliant. I am not a nerd, or a boffin or a techy. I’m an author who hates this shit.
Anyway I googled some more and discovered the wonderful lovely amazing Sigil which is open source and free to download. Sigil led me to the quick solution I’ve outlined at the start of this post and basically stopped me turning into a complete basket case. Thank you Strahinja Markovi?, John Schember, Kevin Hendricks and Doug Massay. I love you all, the hours of work you’ve all put into Sigil have led to an absolute triumph, the programme is brilliant and without it I would have melted into a puddle of jelly by now.
Thanks also to David Blatner and Olav Kvern whose Real World InDesign CS3 book taught me everything I know about InDesign today and led me to this forum.
Phew. This is like an Oscar speech, sorry. I’m just so relieved I finally sorted this out and wouldn’t want anyone to ever go through this misery ever again.
https://postimg.org/image/yxn4n61mp/