View Single Post
Old 09-28-2014, 09:21 PM   #89
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 47,134
Karma: 169815798
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by JSWolf View Post
But for those of us who want to fix the code some, the kepub is a nightmare inside. The original code moght not be the best it could be, but when the ePub gets converted to kepub, it's many many times worse. Even after using Modify ePub, there's still some crud left in.
Really? Even before using ModifyEpub, using Sigil, it took a few minutes worth of running canned regular expressions to remove the Kobo location spans and another half minute to delete the .js files. Now if you wanted to modify the files as stored on an Android device which the .zip wrapper is unpacked, that is a bit more of a challenge.

Looking at Locked In, the added code is the location spans wrapped around every sentence:


<span class="koboSpan" id="kobo.6.4" xmlns="http://www.w3.org/1999/xhtml">

and the following at the head of each file:

<!-- kobo-style -->

<script src="../Misc/kobo.js" type="text/javascript" xmlns="http://www.w3.org/1999/xhtml">
</script>

<style type="text/css">
.koboSpan { -webkit-text-combine: inherit; }
</style>


A simple regex to reduce each location span to <span>
something like
find: <<span class="koboSpan" id="kobo(.*?)" xmlns="http://www.w3.org/1999/xhtml">

replace: <span>

and a simple find the header string and replace with nothing.
DNSB is offline   Reply With Quote