ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* back-up.lua; mtx-epub.lua
@ 2012-06-05 19:09 Andy Thomas
  2012-06-06 22:00 ` Andy Thomas
  0 siblings, 1 reply; 17+ messages in thread
From: Andy Thomas @ 2012-06-05 19:09 UTC (permalink / raw)
  To: ntg-context

Hi all,

in my attempts to validate epub export from my context source, I made the following changes to back-up.lua and mtx-epub.lua

1) the actual context language is put in the epub
2) changed the OPS directory to OEBPS. The 2.0.1 Standard does not actually say that is has to have that name, but I only found examples using that one, including the sample documents in the 2.0.1 white paper. 
3) changed opf:scheme to UUID, since that is used and not a ISBN number
4) added the encoding info in the opf file
5) changed the single in double-quotes in the opf file manifest. I do not know if it is necessary, but this seams to be more consistent

Andy

diff back-exp_old.lua back-exp.lua 
2370a2371
>             language   = languagenames[tex.count.mainlanguagenumber],


diff mtx-epub_old.lua mtx-epub.lua 
46c46
< <?xml version="1.0" encoding="UTF-8" ?>
---
> <?xml version="1.0" encoding="UTF-8"?>
50c50
<         <rootfile full-path="OPS/%s" media-type="application/oebps-package+xml"/>
---
>         <rootfile full-path="OEBPS/%s" media-type="application/oebps-package+xml"/>
56c56
< <?xml version="1.0"?>
---
> <?xml version="1.0" encoding="UTF-8"?>
62,63c62,63
<         <dc:language>en</dc:language>
<         <dc:identifier id="%s" >urn:uuid:%s</dc:identifier>
---
>         <dc:language>%s</dc:language>
>         <dc:identifier id="%s" opf:scheme="UUID">urn:uuid:%s</dc:identifier>
79c79
< local item = [[        <item id='%s' href='%s' media-type='%s'/>]]
---
> local item = [[        <item id="%s" href="%s" media-type="%s"/>]]
196a197
>         local language   = specification.language   or "en"
211c212
<         lfs.mkdir(file.join(epubpath,"OPS"))
---
>         lfs.mkdir(file.join(epubpath,"OEBPS"))
220c221
<                 local target = file.join(epubpath,"OPS",filename)
---
>                 local target = file.join(epubpath,"OEBPS",filename)
256c257
<         package   = format(package,identifier,identifier,os.uuid(),os.date("!%Y-%m-%dT%H:%M:%SZ"),concat(used,"\n"),idmaker(root))
---
>         package   = format(package,identifier,language,identifier,os.uuid(),os.date("!%Y-%m-%dT%H:%M:%SZ"),concat(used,"\n"),idmaker(root))
261,262c262,263
<         io.savedata(file.join(epubpath,"OPS",epubroot),package)
<         io.savedata(file.join(epubpath,"OPS",epubtoc),toc)
---
>         io.savedata(file.join(epubpath,"OEBPS",epubroot),package)
>         io.savedata(file.join(epubpath,"OEBPS",epubtoc),toc)
275c276
<                 os.execute(format(zipper.compressed,epubfile,"OPS"))
---
>                 os.execute(format(zipper.compressed,epubfile,"OEBPS"))

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2012-06-11  7:35 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-05 19:09 back-up.lua; mtx-epub.lua Andy Thomas
2012-06-06 22:00 ` Andy Thomas
2012-06-07 12:48   ` Henning Hraban Ramm
2012-06-07 13:53     ` Hans Hagen
2012-06-07 14:51       ` luigi scarso
2012-06-08 18:08     ` Andy Thomas
2012-06-08 18:25       ` Aditya Mahajan
2012-06-08 21:02         ` Hans Hagen
2012-06-08 21:03       ` Hans Hagen
     [not found]         ` <8EC49686-C7B3-47A1-A646-17AEC310836C@web.de>
2012-06-08 23:31           ` Hans Hagen
2012-06-09  0:38             ` Aditya Mahajan
2012-06-09 10:44               ` Hans Hagen
2012-06-09 12:58             ` Andy Thomas
2012-06-10 22:21               ` Hans Hagen
2012-06-11  5:41                 ` Andy Thomas
2012-06-11  7:35                   ` Hans Hagen
2012-06-07 16:33   ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).