MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Plugins (https://www.mobileread.com/forums/forumdisplay.php?f=268)
-   -   [Plugin] FixOPFv1 (https://www.mobileread.com/forums/showthread.php?t=271268)

DiapDealer 02-03-2016 08:09 PM

[Plugin] FixOPFv1
 
1 Attachment(s)
A temporary input plugin to change the OPF package type from "1" to "2".
Will also workaround a Sigil bug that's triggered when an epub's opf file doesn't have an xml declaration.
(temporary because it will become unnecessary in the next version of Sigil)

It will change the package from "1.0" to "2.0" and will change any of the older "text/html" or "text/x-oeb1-document" media types on manifested items to "application/xhtml+xml".

It will add an xml declaration to opf files that don't have one.

Nothing else should be touched (including epub2s or epub3s).

CJClink 02-21-2016 09:36 PM

Hi, Carolyn here.

I hope you can get this plug in to solve this problem -- I totally LOVE Sigil.

Here's the content.opf code as provided by Draft2Digital with no xml declaration in the first line, I've replaced some of the content with place-holder names:
Spoiler:

<package xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf" xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="BookId">
<metadata>
<dc:title>Title</dc:title>
<dc:publisher>Publisher</dc:publisher>
<dc:creator opf:role="aut">Author</dc:creator>
<dc:description>&lt;p&gt;Description removed&lt;/p&gt;</dc:description>
<dc:date>2016-03-01</dc:date>
<dc:language>EN</dc:language>
<meta content="1.1" name="draft2digitalVersion"/>
<meta content="Epub" name="draft2digitalType"/>
<meta content="cover" name="cover"/>
<dc:identifier id="BookId" opf:scheme="uuid">a0e4b441-b52e-4e8b-9f17-47e4d048997b</dc:identifier>
<dc:subject>spaceship</dc:subject>
<dc:subject>space battle</dc:subject>
<dc:subject>wormhole</dc:subject>
<dc:subject>dolphin</dc:subject>
<dc:subject>astrophysics</dc:subject>
<dc:subject>astronomy</dc:subject>
<dc:subject>dark matter</dc:subject>
</metadata>
<manifest>
<item href="c001.xhtml" id="c001" media-type="application/xhtml+xml"/>
<item href="toc.xhtml" id="toc" media-type="application/xhtml+xml"/>
<item href="c002.xhtml" id="c002" media-type="application/xhtml+xml"/>
<item href="c003.xhtml" id="c003" media-type="application/xhtml+xml"/>
<item href="c004.xhtml" id="c004" media-type="application/xhtml+xml"/>
<item href="c005.xhtml" id="c005" media-type="application/xhtml+xml"/>
<item href="c006.xhtml" id="c006" media-type="application/xhtml+xml"/>
<item href="c007.xhtml" id="c007" media-type="application/xhtml+xml"/>
<item href="c008.xhtml" id="c008" media-type="application/xhtml+xml"/>
<item href="c009.xhtml" id="c009" media-type="application/xhtml+xml"/>
<item href="c010.xhtml" id="c010" media-type="application/xhtml+xml"/>
<item href="c011.xhtml" id="c011" media-type="application/xhtml+xml"/>
<item href="c012.xhtml" id="c012" media-type="application/xhtml+xml"/>
<item href="c013.xhtml" id="c013" media-type="application/xhtml+xml"/>
<item href="c014.xhtml" id="c014" media-type="application/xhtml+xml"/>
<item href="c015.xhtml" id="c015" media-type="application/xhtml+xml"/>
<item href="c016.xhtml" id="c016" media-type="application/xhtml+xml"/>
<item href="c017.xhtml" id="c017" media-type="application/xhtml+xml"/>
<item href="c018.xhtml" id="c018" media-type="application/xhtml+xml"/>
<item href="c019.xhtml" id="c019" media-type="application/xhtml+xml"/>
<item href="c020.xhtml" id="c020" media-type="application/xhtml+xml"/>
<item href="c021.xhtml" id="c021" media-type="application/xhtml+xml"/>
<item href="c022.xhtml" id="c022" media-type="application/xhtml+xml"/>
<item href="c023.xhtml" id="c023" media-type="application/xhtml+xml"/>
<item href="c024.xhtml" id="c024" media-type="application/xhtml+xml"/>
<item href="c025.xhtml" id="c025" media-type="application/xhtml+xml"/>
<item href="c026.xhtml" id="c026" media-type="application/xhtml+xml"/>
<item href="c027.xhtml" id="c027" media-type="application/xhtml+xml"/>
<item href="c028.xhtml" id="c028" media-type="application/xhtml+xml"/>
<item href="c029.xhtml" id="c029" media-type="application/xhtml+xml"/>
<item href="c030.xhtml" id="c030" media-type="application/xhtml+xml"/>
<item href="c031.xhtml" id="c031" media-type="application/xhtml+xml"/>
<item href="c032.xhtml" id="c032" media-type="application/xhtml+xml"/>
<item href="c033.xhtml" id="c033" media-type="application/xhtml+xml"/>
<item href="c034.xhtml" id="c034" media-type="application/xhtml+xml"/>
<item href="c035.xhtml" id="c035" media-type="application/xhtml+xml"/>
<item href="c036.xhtml" id="c036" media-type="application/xhtml+xml"/>
<item href="c037.xhtml" id="c037" media-type="application/xhtml+xml"/>
<item href="c038.xhtml" id="c038" media-type="application/xhtml+xml"/>
<item href="c039.xhtml" id="c039" media-type="application/xhtml+xml"/>
<item href="c040.xhtml" id="c040" media-type="application/xhtml+xml"/>
<item href="c041.xhtml" id="c041" media-type="application/xhtml+xml"/>
<item href="c042.xhtml" id="c042" media-type="application/xhtml+xml"/>
<item href="c043.xhtml" id="c043" media-type="application/xhtml+xml"/>
<item href="c044.xhtml" id="c044" media-type="application/xhtml+xml"/>
<item href="c045.xhtml" id="c045" media-type="application/xhtml+xml"/>
<item href="base.css" id="base" media-type="text/css"/>
<item href="d2d_images/image000.jpg" id="image000" media-type="image/jpeg"/>
<item href="d2d_images/image001.jpg" id="image001" media-type="image/jpeg"/>
<item href="ncx.ncx" id="ncx" media-type="application/x-dtbncx+xml"/>
<item href="d2d_images/cover.jpg" id="cover" media-type="image/jpeg"/>
<item href="endmatter.css" id="endmatter" media-type="text/css"/>
<item href="cover-ed047dd1-965a-47cf-9c74-c8fa4e3436d9.xhtml" id="cover-ed047dd1-965a-47cf-9c74-c8fa4e3436d9" media-type="application/xhtml+xml"/>
</manifest>
<spine toc="ncx">
<itemref idref="cover-ed047dd1-965a-47cf-9c74-c8fa4e3436d9"/>
<itemref idref="c001"/>
<itemref idref="toc"/>
<itemref idref="c002"/>
<itemref idref="c003"/>
<itemref idref="c004"/>
<itemref idref="c005"/>
<itemref idref="c006"/>
<itemref idref="c007"/>
<itemref idref="c008"/>
<itemref idref="c009"/>
<itemref idref="c010"/>
<itemref idref="c011"/>
<itemref idref="c012"/>
<itemref idref="c013"/>
<itemref idref="c014"/>
<itemref idref="c015"/>
<itemref idref="c016"/>
<itemref idref="c017"/>
<itemref idref="c018"/>
<itemref idref="c019"/>
<itemref idref="c020"/>
<itemref idref="c021"/>
<itemref idref="c022"/>
<itemref idref="c023"/>
<itemref idref="c024"/>
<itemref idref="c025"/>
<itemref idref="c026"/>
<itemref idref="c027"/>
<itemref idref="c028"/>
<itemref idref="c029"/>
<itemref idref="c030"/>
<itemref idref="c031"/>
<itemref idref="c032"/>
<itemref idref="c033"/>
<itemref idref="c034"/>
<itemref idref="c035"/>
<itemref idref="c036"/>
<itemref idref="c037"/>
<itemref idref="c038"/>
<itemref idref="c039"/>
<itemref idref="c040"/>
<itemref idref="c041"/>
<itemref idref="c042"/>
<itemref idref="c043"/>
<itemref idref="c044"/>
<itemref idref="c045"/>
</spine>
<guide>
<reference href="cover-ed047dd1-965a-47cf-9c74-c8fa4e3436d9.xhtml" type="cover" title="Cover"/>
<reference href="c001.xhtml" type="title-page" title="Title Page"/>
<reference href="toc.xhtml" type="toc" title="Table of Contents"/>
<reference href="c002.xhtml" type="text" title="Praise for Title"/>
</guide>
</package>

DiapDealer 02-21-2016 10:22 PM

Hi Carolyn,

Try the 0.1.1 version of the plugin now available in the first post. I _think_ I've adapted it to also check for a missing xml declaration in the epub's opf file and then add one if it's missing (regardless of the epub's package version).

Let me know if it gives you any trouble. Hopefully, it will work satisfactorily until we get a new version of Sigil released that addresses these issues.


All times are GMT -4. The time now is 08:30 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.