Thread: kepub stuff
View Single Post
Old 09-30-2014, 09:01 PM   #28
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,257
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
*** Warning *** Tedious technical details ahead. Skip if you're not interested.

There has been a lot of emotional ranting about kepub vs. epub styling in the last few days, so I spent some time today poking around the innards of a Kobo-bought DRM'd kepub from my Kobo Desktop library and compared:
  1. kepub with DRM still intact
  2. kepub/epub hybrid resulting from applying [deleted] de-DRM.
    Although calibre sees it as an epub, at this stage it's really a de-DRM'd kepub, but you can open it in the calibre Viewer and Editor.
  3. epub produced by running Modify Epub on the hybrid with option 'Strip Kobo DRM remnants' checked.
    IMO it's now truly a 'standard epub'.
[1] vs [2]:
The only difference I could see was that [1] had encrypted html and image files and [2] didn't. The css, toc.ncx and opf files were identical. So I don't think de-DRMing introduced any styling changes.

[2] vs. [3]:
Anak (post #11) has already posted a summary of Kobo-specific kepub stuff found in [2]. I found that Modify Epub removed almost all of that. I could not see how the small remnant would adversely affect the styling of 99.999% of epubs. Once again, the css, toc.ncx and opf files were identical.

In detail (and reiterating Anak's post), [2] contains the following in every html file. The red/blue/purple stuff is the kepub-specific code. Modify Epub removes the red/purple bits leaving the blue bits as harmless (99.999% of the time) remnants.
Code:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>The Feud</title>
<link rel="stylesheet" type="text/css" href="../styles/styles.css"></link>
<link rel="stylesheet" type="text/css" href="../styles/additional.css"></link>
<!-- kobo-style -->
<link type="text/css" rel="stylesheet" href="css/kobo.css"></link>
<script type="text/javascript" src="js/kobo.js"></script>
<style type="text/css" id="kobostylehacks">
    div#book-inner p, div#book-inner div { font-size: 1.0em; } 
    a { color: black; } 
    a:link, a:visited, a:hover, a:active { color: blue; } 
    div#book-inner * { margin-top: 0 !important; margin-bottom: 0 !important;}
</style>
</head>
<body>
<div id="book-columns">
<div id="book-inner">
<h2 class="chapter-number" xmlns="http://www.w3.org/1999/xhtml"><a id="page_4"></a>
<span class="koboSpan" id="kobo.1.1">ONE</span></h2>
... the rest of the original epub content ... ...
</div>
</div>
</html>
Modify Epub also removed the physical kepub-specific files:
css/kobo.css (empty, anyway)
js/kobo.js
rights.xml

In conclusion (based on a totally unscientific sample of one): I believe that [3] can be considered a 'standard epub'. Its original css files are unchanged - thus its styling matches the publisher's original intentions (warts-and-all). If you want to disagree with any of this then feel free, but please, lets have less heat and more light if we're all going to learn anything. I don't have an epub3 book (real or pseudo) to test, so any further enlightenment welcome

Caveats:
If one were to open both [2] and [3] in the calibre Viewer or an Adobe epub2 renderer then, YES, there will be big differences. For anyone familiar with css the reason should be obvious in the purple css line shown above.
  • For [2], anything contained within <div id="book-inner">...</div> (i.e. everything in every chapter) will have all top/bottom margins totally zapped e.g. scenebreaks likely AWOL, headings all squashed.
  • For [3], the offending purple css line is gone, leaving the original css top/bottom margins to prevail.
The moral of the story is, if you're going to keep [2] at all, store it in calibre as KEPUB format and only view it by sideloading to a Kobo device as a KEPUB to be read with the Access renderer.
[3] can be treated like any standard epub2 book.

If you got this far, congrats and thank you for your time

Last edited by pdurrant; 10-28-2014 at 05:02 AM.
jackie_w is offline   Reply With Quote