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 07-07-2018, 03:32 AM   #1
ghartwig
Junior Member
ghartwig began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jul 2018
Location: Dallas, TX
Device: iBooks
Problems with eBooks from Apple Pages 7.1

The new version of Apple's Pages exports ePub files with this in the header:
Code:
<script src="../Misc/book.js"></script>
This seems to cause all of the body text to have special characters converted to entities when loaded. Example:

Code:
&lt;body dir="ltr" onload="Body_onLoad()"&gt;&lt;div class="body" style="white-space:pre-wrap; line-break:strict;"&gt;&lt;h1 class="p21" style=""&gt;
When these <script> tags are removed from each xhtml file, the ePub file loads into Sigil properly.
ghartwig is offline   Reply With Quote
Old 07-07-2018, 01:05 PM   #2
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
I don't have a Mac, but I was able to reproduce the problem with an epub file generated by Pages for iOS 4.1. (The source was Kovid Goyal's docx test file.)

Apparently Pages adds an onload Javascript attribute to all <body> tags.

A typical HTML file looks like this:

Spoiler:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>5 Lists | demo 4</title>
    <link rel="stylesheet" href="css/book.css" type="text/css" />
    <script src="js/book.js" />
    <meta charset="UTF-8" />
    <meta name="EPB-UUID" content="0945EA89-B14C-4079-ADF8-8058C7750C59" />
</head>

<body dir="ltr" onload="Body_onLoad()">
    <div class="body" style="white-space:pre-wrap; line-break:strict;">
        <h1 class="p1" style=""><span id="chapter-5" />Lists</h1>
        <p class="p3" style="">All types of lists are supported by the conversion, with the exception of lists that use fancy bullets, these get converted to regular bullets.</p>
        <h2 class="p2" style=""><span id="chapter-5-49" />Bulleted List</h2>
        <ol style="padding:0 0 0 1px; margin:0;">
            <li class="p37 p38 li1 b1" style=""><span class="c1 c23">One</span></li>
        </ol>
        <ol style="padding:0 0 0 1px; margin:0;">
            <li class="p37 p38 li1 b1" style=""><span class="c1 c23">Two</span></li>
        </ol>
        <h2 class="p2" style=""><span id="chapter-5-52" />Numbered List</h2>
        <ol style="padding:0; margin:0;">
            <li value="1" class="p37 p38 li2 b2" style=""><span class="c1 c21">One, with a very long line to demonstrate that the hanging indent for the list is working correctly</span></li>
        </ol>
        <ol style="padding:0; margin:0;">
            <li value="2" class="p37 p38 li2 b2" style=""><span class="c1 c21">Two</span></li>
        </ol>
        <h2 class="p2" style=""><span id="chapter-5-55" />Multi-level Lists</h2>
        <ol style="padding:0; margin:0;">
            <li value="1" class="p39 p40 li2 b2" style=""><span class="c1 c21">One</span></li>
        </ol>
        <p class="p41 p42" style=""><span class="c24"><bdi>1.1.</bdi></span><span class="c1">Two</span></p>
        <p class="p43 p44" style=""><span class="c25"><bdi>1.1.1.</bdi></span><span class="c1">Three</span></p>
        <p class="p43 p44" style=""><span class="c25"><bdi>1.1.2.</bdi></span><span class="c1">Four with a very long line to demonstrate that the hanging indent for the list is working correctly.</span></p>
        <p class="p43 p44" style=""><span class="c25"><bdi>1.1.3.</bdi></span><span class="c1">Five</span></p>
        <ol style="padding:0; margin:0;">
            <li value="2" class="p39 p40 li2 b2" style=""><span class="c1 c21">Six</span></li>
        </ol>
        <p class="p45 p46" style="">A Multi-level list with bullets:</p>
        <ol style="padding:0 0 0 1px; margin:0;">
            <li class="p39 p40 li3 b3" style=""><span class="c1 c23">One</span></li>
        </ol>
        <ol style="padding:0 0 0 1px; margin:0;">
            <li class="p47 p48 li1 b1" style=""><span class="c1 c23">Two</span></li>
        </ol>
        <p class="p49 p50" style=""><span class="c26"><img src="images/image1.gif" alt="bullet" style="vertical-align:baseline;width:1.000em;"/></span><span class="c1">This bullet uses an image as the bullet item</span></p>
        <p class="p51 p52" style=""><span class="c27"><bdi>o</bdi></span><span class="c1">Four</span></p>
        <ol style="padding:0 0 0 1px; margin:0;">
            <li class="p39 p40 li3 b3" style=""><span class="c1 c23">Five</span></li>
        </ol>
        <h2 class="p2" style=""><span id="chapter-5-68" />Continued Lists</h2>
        <ol style="padding:0; margin:0;">
            <li value="1" class="p53 p54 li4 b4" style=""><span class="c1 c21">One</span></li>
        </ol>
        <ol style="padding:0; margin:0;">
            <li value="2" class="p53 p54 li4 b5" style=""><span class="c1 c21">Two</span></li>
        </ol>
        <p class="p55" style="">An interruption in our regularly scheduled listing, for this essential and very relevant public service announcement.</p>
        <ol style="padding:0; margin:0;">
            <li value="3" class="p53 p54 li4 b6" style=""><span class="c1 c21">We now resume our normal programming</span></li>
        </ol>
        <ol style="padding:0; margin:0;">
            <li value="4" class="p53 p54 li4 b7" style=""><span class="c1 c21">Four</span></li>
        </ol>
        <p class="p3 p56" style=""> </p>
    </div>
</body>

</html>


After selecting Mend & Prettify Code, it looks like this:

Spoiler:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>

<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>5 Lists | demo 4</title>
  <link rel="stylesheet" href="css/book.css" type="text/css"/>
  <script src="js/book.js"></script>
</head>

<body>
  &lt;meta charset="UTF-8" /&gt;
    &lt;meta name="EPB-UUID" content="0945EA89-B14C-4079-ADF8-8058C7750C59" /&gt;
&lt;/head&gt;

&lt;body dir="ltr" onload="Body_onLoad()"&gt;
    &lt;div class="body" style="white-space:pre-wrap; line-break:strict;"&gt;
        &lt;h1 class="p1" style=""&gt;&lt;span id="chapter-5" /&gt;Lists&lt;/h1&gt;
        &lt;p class="p3" style=""&gt;All types of lists are supported by the conversion, with the exception of lists that use fancy bullets, these get converted to regular bullets.&lt;/p&gt;
        &lt;h2 class="p2" style=""&gt;&lt;span id="chapter-5-49" /&gt;Bulleted List&lt;/h2&gt;
        &lt;ol style="padding:0 0 0 1px; margin:0;"&gt;
            &lt;li class="p37 p38 li1 b1" style=""&gt;&lt;span class="c1 c23"&gt;One&lt;/span&gt;&lt;/li&gt;
        &lt;/ol&gt;
        &lt;ol style="padding:0 0 0 1px; margin:0;"&gt;
            &lt;li class="p37 p38 li1 b1" style=""&gt;&lt;span class="c1 c23"&gt;Two&lt;/span&gt;&lt;/li&gt;
        &lt;/ol&gt;
        &lt;h2 class="p2" style=""&gt;&lt;span id="chapter-5-52" /&gt;Numbered List&lt;/h2&gt;
        &lt;ol style="padding:0; margin:0;"&gt;
            &lt;li value="1" class="p37 p38 li2 b2" style=""&gt;&lt;span class="c1 c21"&gt;One, with a very long line to demonstrate that the hanging indent for the list is working correctly&lt;/span&gt;&lt;/li&gt;
        &lt;/ol&gt;
        &lt;ol style="padding:0; margin:0;"&gt;
            &lt;li value="2" class="p37 p38 li2 b2" style=""&gt;&lt;span class="c1 c21"&gt;Two&lt;/span&gt;&lt;/li&gt;
        &lt;/ol&gt;
        &lt;h2 class="p2" style=""&gt;&lt;span id="chapter-5-55" /&gt;Multi-level Lists&lt;/h2&gt;
        &lt;ol style="padding:0; margin:0;"&gt;
            &lt;li value="1" class="p39 p40 li2 b2" style=""&gt;&lt;span class="c1 c21"&gt;One&lt;/span&gt;&lt;/li&gt;
        &lt;/ol&gt;
        &lt;p class="p41 p42" style=""&gt;&lt;span class="c24"&gt;&lt;bdi&gt;1.1.&lt;/bdi&gt;&lt;/span&gt;&lt;span class="c1"&gt;Two&lt;/span&gt;&lt;/p&gt;
        &lt;p class="p43 p44" style=""&gt;&lt;span class="c25"&gt;&lt;bdi&gt;1.1.1.&lt;/bdi&gt;&lt;/span&gt;&lt;span class="c1"&gt;Three&lt;/span&gt;&lt;/p&gt;
        &lt;p class="p43 p44" style=""&gt;&lt;span class="c25"&gt;&lt;bdi&gt;1.1.2.&lt;/bdi&gt;&lt;/span&gt;&lt;span class="c1"&gt;Four with a very long line to demonstrate that the hanging indent for the list is working correctly.&lt;/span&gt;&lt;/p&gt;
        &lt;p class="p43 p44" style=""&gt;&lt;span class="c25"&gt;&lt;bdi&gt;1.1.3.&lt;/bdi&gt;&lt;/span&gt;&lt;span class="c1"&gt;Five&lt;/span&gt;&lt;/p&gt;
        &lt;ol style="padding:0; margin:0;"&gt;
            &lt;li value="2" class="p39 p40 li2 b2" style=""&gt;&lt;span class="c1 c21"&gt;Six&lt;/span&gt;&lt;/li&gt;
        &lt;/ol&gt;
        &lt;p class="p45 p46" style=""&gt;A Multi-level list with bullets:&lt;/p&gt;
        &lt;ol style="padding:0 0 0 1px; margin:0;"&gt;
            &lt;li class="p39 p40 li3 b3" style=""&gt;&lt;span class="c1 c23"&gt;One&lt;/span&gt;&lt;/li&gt;
        &lt;/ol&gt;
        &lt;ol style="padding:0 0 0 1px; margin:0;"&gt;
            &lt;li class="p47 p48 li1 b1" style=""&gt;&lt;span class="c1 c23"&gt;Two&lt;/span&gt;&lt;/li&gt;
        &lt;/ol&gt;
        &lt;p class="p49 p50" style=""&gt;&lt;span class="c26"&gt;&lt;img src="images/image1.gif" alt="bullet" style="vertical-align:baseline;width:1.000em;"/&gt;&lt;/span&gt;&lt;span class="c1"&gt;This bullet uses an image as the bullet item&lt;/span&gt;&lt;/p&gt;
        &lt;p class="p51 p52" style=""&gt;&lt;span class="c27"&gt;&lt;bdi&gt;o&lt;/bdi&gt;&lt;/span&gt;&lt;span class="c1"&gt;Four&lt;/span&gt;&lt;/p&gt;
        &lt;ol style="padding:0 0 0 1px; margin:0;"&gt;
            &lt;li class="p39 p40 li3 b3" style=""&gt;&lt;span class="c1 c23"&gt;Five&lt;/span&gt;&lt;/li&gt;
        &lt;/ol&gt;
        &lt;h2 class="p2" style=""&gt;&lt;span id="chapter-5-68" /&gt;Continued Lists&lt;/h2&gt;
        &lt;ol style="padding:0; margin:0;"&gt;
            &lt;li value="1" class="p53 p54 li4 b4" style=""&gt;&lt;span class="c1 c21"&gt;One&lt;/span&gt;&lt;/li&gt;
        &lt;/ol&gt;
        &lt;ol style="padding:0; margin:0;"&gt;
            &lt;li value="2" class="p53 p54 li4 b5" style=""&gt;&lt;span class="c1 c21"&gt;Two&lt;/span&gt;&lt;/li&gt;
        &lt;/ol&gt;
        &lt;p class="p55" style=""&gt;An interruption in our regularly scheduled listing, for this essential and very relevant public service announcement.&lt;/p&gt;
        &lt;ol style="padding:0; margin:0;"&gt;
            &lt;li value="3" class="p53 p54 li4 b6" style=""&gt;&lt;span class="c1 c21"&gt;We now resume our normal programming&lt;/span&gt;&lt;/li&gt;
        &lt;/ol&gt;
        &lt;ol style="padding:0; margin:0;"&gt;
            &lt;li value="4" class="p53 p54 li4 b7" style=""&gt;&lt;span class="c1 c21"&gt;Four&lt;/span&gt;&lt;/li&gt;
        &lt;/ol&gt;
        &lt;p class="p3 p56" style=""&gt; &lt;/p&gt;
    &lt;/div&gt;
&lt;/body&gt;

&lt;/html&gt;
</body>
</html>
Attached Files
File Type: epub demo_pages_4_1.epub (114.2 KB, 149 views)
Doitsu is offline   Reply With Quote
Old 07-07-2018, 01:22 PM   #3
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,506
Karma: 5433350
Join Date: Nov 2009
Device: many
Self closing script tags are the issue which was fixed earlier in master (at least I thought it was). Are you testing with current master?
KevinH is offline   Reply With Quote
Old 07-07-2018, 01:29 PM   #4
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,506
Karma: 5433350
Join Date: Nov 2009
Device: many
Under html5, a self-closing script tag is illegal and causes an error in head which invalidates the remainder of the document according to the rules for parsing html5 in browsers.

Under xhtml, it may be allowed but is really a bad choice especially for WebKit based browsers and browser based ePub readers, just like self-closing title tags for example. I can special case it if need be in mend if not already fixed.
KevinH is offline   Reply With Quote
Old 07-07-2018, 02:39 PM   #5
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,465
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I really wishes Pages would get rid of that "whitespace: pre-wrap" and "line-break: strict" crap while they're at it. It does nothing but cause problems whenever sensible line-breaks are added to their one-giant-line-with-no-line-breaks html chapters. All it accomplishes is making sure that the epub can't be properly edited with any external tools/editors without first removing that stuff.

Last edited by DiapDealer; 07-07-2018 at 04:14 PM.
DiapDealer is offline   Reply With Quote
Old 07-07-2018, 03:32 PM   #6
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by KevinH View Post
Self closing script tags are the issue which was fixed earlier in master (at least I thought it was). Are you testing with current master?
I used the 0.9.9 Windows release for testing. The problem no longer occurs with the latest files from master. I.e., one of your commits must have already fixed it.

Speaking of fixes, you've fixed lots of bugs since the 0.9.9 release. How about an interim bugfix release?

Last edited by Doitsu; 07-07-2018 at 03:47 PM.
Doitsu is offline   Reply With Quote
Old 07-07-2018, 04:19 PM   #7
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,465
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Doitsu View Post
Speaking of fixes, you've fixed lots of bugs since the 0.9.9 release. How about an interim bugfix release?
We hope to do a new release relatively soon(ish).
Spoiler:
How's that for a non-committal date?
DiapDealer is offline   Reply With Quote
Old 07-07-2018, 06:42 PM   #8
ghartwig
Junior Member
ghartwig began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jul 2018
Location: Dallas, TX
Device: iBooks
Quote:
Originally Posted by DiapDealer View Post
I really wishes Pages would get rid of that "whitespace: pre-wrap" and "line-break: strict" crap while they're at it.
I totally agree. It destroys normal formatting. That's the first thing I have to change on all my files.

Thanks to Doitsu for helping elaborate on the problem. It was quite a shock when I first opened an ePub file from the new version and I didn't see any reports from anyone else yet.

Nice explanation of the situation here: Why don't self-closing script tags work?


If self-closing script tags are illegal and/or not recommended, should someone open a ticket with Apple to have them change that?
ghartwig is offline   Reply With Quote
Old 07-07-2018, 07:06 PM   #9
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,506
Karma: 5433350
Join Date: Nov 2009
Device: many
Technically under rules of xhtml any tag can be self-closing but since there is no xhtml5 spec, and since the wording for the how html5 is supported under xhtml parsing rules in epub3s is not clearly specified, it seems a legal but strange decision by Apple to use it. Also given how many webkit derived browsers exist and support epub3 e-readers use them, it really makes no sense in my humble opinion to ever produce epub code that can not be clearly interpreted in all settings.



Quote:
Originally Posted by ghartwig View Post
I totally agree. It destroys normal formatting. That's the first thing I have to change on all my files.

Thanks to Doitsu for helping elaborate on the problem. It was quite a shock when I first opened an ePub file from the new version and I didn't see any reports from anyone else yet.

Nice explanation of the situation here: Why don't self-closing script tags work?


If self-closing script tags are illegal and/or not recommended, should someone open a ticket with Apple to have them change that?
KevinH is offline   Reply With Quote
Old 07-07-2018, 07:09 PM   #10
ghartwig
Junior Member
ghartwig began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jul 2018
Location: Dallas, TX
Device: iBooks
This is a new feature for them in Pages, and I believe they may have put it in that way as a mistake, like many of us have done on our own pages.
ghartwig is offline   Reply With Quote
Reply

Tags
javascript

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Does Sigil have problems with Pages 5? rosshalde Sigil 6 10-29-2014 12:02 PM
Apple granted patent for turning ebook pages Arbait News 1 11-19-2012 10:55 AM
Apple pages Creating Page breaks ralphiedee ePub 4 05-30-2012 09:29 AM
Count Pages Problems GQ Man Calibre 8 10-29-2011 10:53 PM
Apple: Creating ePub files with Pages kjk Apple Devices 1 08-26-2010 05:46 PM


All times are GMT -4. The time now is 04:12 AM.


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