View Full Version : Test for custom entities in ePUB


Jellby
05-19-2009, 12:33 PM
Hi,

In this thread (http://www.mobileread.com/forums/showpost.php?p=461945&postcount=38) it was suggested the use of custom entities (like ’ or — ) as a possible typographic tool. I would like to test it and see if (and how) different ePUB readers support it. Basically, the trick is adding entity definitions to the DOCTYPE line.

In this file I've used &loquo; and &roquo; for outer quotes and &liquo; and &riquo; for inner quotes, as well as ≈ for apostrophes. Chapter 1 has the definitions in-line, while Chapter 2 uses an external file (this would be preferable, since it allows changing all chapters in a single place).

I've tried with Calibre, and Chapter 1 (internal) works, but Chapter 2 (external) doesn't. Besides, both chapters show some garbage at the top. Could you try with other readers and maybe test other possible solutions?

zelda_pinwheel
05-19-2009, 12:35 PM
excellent timing, i was trying to play with this myself after seeing the custom entities used in adobe's alice in wonderland sample book, but i couldn't get it to work ; i got a bit of garbage showing at the beginning of the page, and the entities weren't translated correctly. i'm very interested to learn more about it. i starting looking for some info but haven't had time to get very far, but we could start by trying to reverse-engineer that adobe file. ;)

Nate the great
05-19-2009, 12:48 PM
I ran it through epubcheck (http://code.google.com/p/epubcheck/), and here are the error messages:

ERROR: DorianGray.epub/OEBPS/content.opf(8): unfinished element
ERROR: DorianGray.epub/OEBPS/content.opf: unique-identifier attribute in package element must reference an existing identifier element id
ERROR: DorianGray.epub/OEBPS/Chapter-02.xhtml: Could not resolve local XML entity 'OEBPS/css/entities.dcd'
ERROR: DorianGray.epub: resource OEBPS/css/entities.dcd is missing
ERROR: DorianGray.epub/OEBPS/Contents.xhtml(28): 'OEBPS/Chapter-03.xhtml': referenced resource missing in the package
You're also missing the other chapters, but that's not important.

I also tried it in BookWorm (http://bookworm.oreilly.com/), and neither chapter displayed correctly.

Jellby
05-19-2009, 12:57 PM
I ran it through epubcheck (http://code.google.com/p/epubcheck/), and here are the error messages:

You're also missing the other chapters, but that's not important.

Oh, I deleted too much, and removed the identifier :D Should be fixed now.

The rest of the chapter were intentionally deleted, but not all references, it seems. The "css/entities.dcd" file should be there, though. Maybe the "text/plain" type is not correct?

JSWolf
05-22-2009, 12:13 AM
In ADE, the drop caps overwrite the line above and the chapter numbers are way off in left field. Plus, the ePub logo looks silly. Other then that, it looks fine.

Jellby
05-22-2009, 07:42 AM
In ADE, the drop caps overwrite the line above and the chapter numbers are way off in left field. Plus, the ePub logo looks silly. Other then that, it looks fine.

The "line above" the drop caps should not be there. It's intended to be a page header and ADE is doing the wrong thing displaying it in the text flow (at the very least it should just ignore it).

The chapter numbers are intentionally displaced to the left.

I tried here with ADE and Chapter 2 is a mess and not displayed correctly at all.

JSWolf
05-22-2009, 08:21 AM
And the ePub logo does not look good where it is at all.

JSWolf
05-22-2009, 08:36 AM
The reason the headers failed is because you did not define a page template.

http://blogs.adobe.com/digitaleditions/template.html

Jellby
05-22-2009, 09:48 AM
And the ePub logo does not look good where it is at all.

It's meant to be at the bottom of the title page. Of course, the page size can be altered, so whether it will fit in the page or not is not predictable. (I could use "position: absolute", but that is discouraged in the ePUB specification).

The reason the headers failed is because you did not define a page template.

I don't try to create an ePUB customized for ADE, but a general compliant ePUB. I used "display: oeb-page-head", and, according to the spec:

The content of an element assigned display: oeb-page-head should be presented only as a header, and the content of an element assigned display: oeb-page-foot should be presented only as a footer. Neither should be simply presented as if it were inline or block.

(Where "should" means: "This word, or the adjective "RECOMMENDED", mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.")

And the page you linked says:

oeb-page-head and oeb-page-head values for display properties can be used to move the content to the page header or footer area. They are very similar to adobe-other-region display value, but need dynamic allocation of the header and footer space - something that Digital Editions 1.0 still cannot do. In future they are expected to work just like adobe-other-region value with adobe-region set to either xsl-region-before or xsl-region-after - at least in paginated mode. The good thing about these properties is that they are convey more semantic than adobe-other-region and thus can be used by Digital Editions even if epub is displayed in scroll mode (something that we do not have currently). Thus, I think these values are critical to implement right.

So I think I'm doing it right.

Jellby
05-27-2009, 07:45 AM
The "css/entities.dcd" file should be there, though. Maybe the "text/plain" type is not correct?

Silly me, it seem's I can't tell the difference between dcd and dtd :rolleyes:

Well, this version now validates in http://www.threepress.org/document/epub-validate/ The problems are still there, it seems external dtd files are not quite supported anywhere.

As for the chapter number in the titles, I see ADE is not behaving the way I expected, it's moving the float down, and normal browsers don't do that. I wonder if this is a bug or some ambiguity in the specification...