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

Sometimes --epub-chapter-level not work properly #1465

Closed
rgaiacs opened this issue Jul 29, 2014 · 3 comments
Closed

Sometimes --epub-chapter-level not work properly #1465

rgaiacs opened this issue Jul 29, 2014 · 3 comments

Comments

@rgaiacs
Copy link
Contributor

rgaiacs commented Jul 29, 2014

Give the file sample-with-div.html

$ pandoc --version
pandoc 1.13
$ cat sample-with-div.html
<html>

<head>
    <title>Title</title>
</head>

<body>
    <div>
        <div>
            <div>
                <h1>Title</h1>
                <h2>Section 1</h2>
                <p>Some text.</p>
                <h2>Section 2</h2>
                <p>More text.</p>
            </div>
        </div>
    </div>
</body>

</html>

when I try to convert it to EPUB

$ pandoc -f html -t epub -o sample-with-div.epub --standalone --epub-chapter-level=2 sample-with-div.html

the option --epub-chapter-level doesn't work:

$ unzip -l sample-with-div.epub 
Archive:  sample-with-div.epub
  Length      Date    Time    Name
---------  ---------- -----   ----
       20  2014-07-29 22:55   mimetype
      246  2014-07-29 22:55   META-INF/container.xml
      160  2014-07-29 22:55   META-INF/com.apple.ibooks.display-options.xml
      439  2014-07-29 22:55   stylesheet.css
      519  2014-07-29 22:55   title_page.xhtml
     1159  2014-07-29 22:55   content.opf
      741  2014-07-29 22:55   toc.ncx
      438  2014-07-29 22:55   nav.xhtml
      689  2014-07-29 22:55   ch001.xhtml
---------                     -------
     4411                     9 files

For some reason the div tags makes the option --epub-chapter-level not work:

$ pandoc --version
pandoc 1.13
$ cat sample-without-div.html 
<html>

<head>
    <title>Title</title>
</head>

<body>
    <h1>Title</h1>
    <h2>Section 1</h2>
    <p>Some text.</p>
    <h2>Section 2</h2>
    <p>More text.</p>
</body>

</html>
$ pandoc -f html -t epub -o sample-without-div.epub --standalone --epub-chapter-level=2 sample-without-div.html
$ unzip -l sample-without-div.epub 
Archive:  sample-without-div.epub
  Length      Date    Time    Name
---------  ---------- -----   ----
       20  2014-07-29 23:00   mimetype
      246  2014-07-29 23:00   META-INF/container.xml
      160  2014-07-29 23:00   META-INF/com.apple.ibooks.display-options.xml
      439  2014-07-29 23:00   stylesheet.css
      519  2014-07-29 23:00   title_page.xhtml
     1399  2014-07-29 23:00   content.opf
     1091  2014-07-29 23:00   toc.ncx
      679  2014-07-29 23:00   nav.xhtml
      550  2014-07-29 23:00   ch001.xhtml
      580  2014-07-29 23:00   ch002.xhtml
      580  2014-07-29 23:00   ch003.xhtml
---------                     -------
     6263                     11 files

This is also a regression:

$ pandoc-1.12.4.2 --version                                                                                       
pandoc-1.12.4.2 1.12.4.2
$ pandoc-1.12.4.2 -f html -t epub -o sample-with-div.epub --standalone --epub-chapter-level=2 sample-with-div.html 
$ unzip -l sample-with-div.epub 
Archive:  sample-with-div.epub
  Length      Date    Time    Name
---------  ---------- -----   ----
       20  2014-07-29 23:03   mimetype
      246  2014-07-29 23:03   META-INF/container.xml
      160  2014-07-29 23:03   META-INF/com.apple.ibooks.display-options.xml
      439  2014-07-29 23:03   stylesheet.css
      519  2014-07-29 23:03   title_page.xhtml
     1382  2014-07-29 23:03   content.opf
     1091  2014-07-29 23:03   toc.ncx
      806  2014-07-29 23:03   nav.xhtml
      548  2014-07-29 23:03   ch001.xhtml
      577  2014-07-29 23:03   ch002.xhtml
      577  2014-07-29 23:03   ch003.xhtml
---------                     -------
     6365                     11 files
@jgm
Copy link
Owner

jgm commented Aug 1, 2014

By putting these in a div together, you are indicating that they are a unit and shouldn't be broken up.
The regression is because of the introduction of a first-class Div element in pandoc; previously the open and closing groups of divs were just parsed as separate raw HTML chunks.

@rgaiacs
Copy link
Contributor Author

rgaiacs commented Aug 8, 2014

@jgm could you provide a option to use the old behaviour?

@jgm
Copy link
Owner

jgm commented Aug 9, 2014

I've just added an extension native_divs (also native_spans). If you do pandoc -f html-native_divs, you'll get the old behavior.

@jgm jgm closed this as completed Aug 9, 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