Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPUB 3 TOC entries in Nav Doc produce extraneous whitespace in iBooks #1392

Closed
elmimmo opened this issue Jul 1, 2014 · 2 comments
Closed

Comments

@elmimmo
Copy link

elmimmo commented Jul 1, 2014

The TOC generated when creating an EPUB 3 produces items that contain unnecessary preceding and trailing whitespace as well as preceding and trailing line breaks. Those are rendered by iBooks in its native TOC view, producing TOC with far too much whitespace:

img_3715

Actual result:

<nav epub:type="toc">
    <h1 id="toc-title">My EPUB 3</h1>
    <ol class="toc">
        <li id="toc-li-1">
            <a href="ch001.xhtml">
                <span>Chapter 1</span>
            </a>
        </li>
        <li id="toc-li-2">
            <a href="ch002.xhtml">
                <span>Chapter 2</span>
            </a>
            <ol class="toc">
                <li id="toc-li-3">
                    <a href="ch003.xhtml">
                        <span>Chapter 2.1</span>
                    </a>
                </li>
                <li id="toc-li-4">
                    <a href="ch004.xhtml">
                        <span>Chapter 2.2</span>
                    </a>
                </li>
            </ol>
        </li>
        <li id="toc-li-5">
            <a href="ch005.xhtml">
                <span>Chapter 3</span>
            </a>
        </li>
        <li id="toc-li-6">
            <a href="ch006.xhtml">
                <span>Chapter 4</span>
            </a>
        </li>
    </ol>
</nav>

Below, the expected result, in order to obtain a proper appearance in iBooks:

img_3716

<nav epub:type="toc">
    <h1 id="toc-title">My EPUB 3</h1>
    <ol class="toc">
        <li id="toc-li-1">
            <a href="ch001.xhtml">Chapter 1</a>
        </li>
        <li id="toc-li-2">
            <a href="ch002.xhtml">Chapter 2</a>
            <ol class="toc">
                <li id="toc-li-3">
                    <a href="ch003.xhtml">Chapter 2.1</a>
                </li>
                <li id="toc-li-4">
                    <a href="ch004.xhtml">Chapter 2.2</a>
                </li>
            </ol>
        </li>
        <li id="toc-li-5">
            <a href="ch005.xhtml">Chapter 3</a>
        </li>
        <li id="toc-li-6">
            <a href="ch006.xhtml">Chapter 4</a>
        </li>
    </ol>
</nav>

or even better, for the sake of readability:

<nav epub:type="toc">
    <h1 id="toc-title">My EPUB 3</h1>
    <ol class="toc">
        <li id="toc-li-1"><a href="ch001.xhtml">Chapter 1</a></li>
        <li id="toc-li-2"><a href="ch002.xhtml">Chapter 2</a>
            <ol class="toc">
                <li id="toc-li-3"><a href="ch003.xhtml">Chapter 2.1</a></li>
                <li id="toc-li-4"><a href="ch004.xhtml">Chapter 2.2</a></li>
            </ol>
        </li>
        <li id="toc-li-5"><a href="ch005.xhtml">Chapter 3</a></li>
        <li id="toc-li-6"><a href="ch006.xhtml">Chapter 4</a></li>
    </ol>
</nav>
@mpickering
Copy link
Collaborator

Do you have the source file you used to generate this output?

@elmimmo
Copy link
Author

elmimmo commented Jul 1, 2014

Well, not, exactly as the code above was hand-edited to make them more generic than the one pertaining to the book I was working with.

The one below produces almost identical one that, and at any rate, causes the same visual defect in iBooks:

# My EPUB 3 #

An intro text.

## Chapter 1 ##

This is chapter 1.

## Chapter 2 ##

This is chapter 2.

### Chapter 2.1 ###

This is subchapter 1 inside chapter 2.

### Chapter 2.2 ###

This is subchapter 2 inside chapter 2.

## Chapter 3 ##

This is chapter 3.

## Chapter 4 ##

This is chapter 4.

Convert it to EPUB 3 running

pandoc -f markdown -t epub3 -o sample.epub sample.md

unzip the file sample.epub and inspect the file nav.xhtml.

This is with pandoc 1.12.4.2 (compiled with texmath 0.6.6.3, highlighting-kate 0.5.8.3.) installed with Homebrew on Mac OS X 10.7.5.

@jgm jgm closed this as completed in 0f970ed Jul 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants