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

* Re: back-up.lua; mtx-epub.lua
  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 16:33   ` Hans Hagen
  0 siblings, 2 replies; 17+ messages in thread
From: Andy Thomas @ 2012-06-06 22:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello all,

I do not know, how many people are using the epub export, but here are two more changes in order to achieve a valid epub file with information from the context source:

On Jun 5, 2012, at 9:09 PM, Andy Thomas wrote:

> 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
6) the title is taken from \setupinteraction
7) the author is taken from \setupinteraction

Andy


The diff against the actual standalone is 
diff back-exp_old.lua back-exp_2.lua 
2364a2365,2378
>         local identity = interactions.general.getidentity()
>         local title
>         local author
>         for i=1,#fields do
>             local key   = fields[i]
>             local value = identity[key]
>             if value and value ~= "" then
>                 if key=="title" then
>                     title = value
>                 elseif key=="author" then
>                     author = value
>                 end
>             end
>         end
2370a2385,2387
>             language   = languagenames[tex.count.mainlanguagenumber],
>             title      = title,
>             author     = author,

and the epub make script
diff mtx-epub_old.lua mtx-epub_2.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"?>
61,64c61,64
<         <dc:title>My Title</dc:title>
<         <dc:language>en</dc:language>
<         <dc:identifier id="%s" >urn:uuid:%s</dc:identifier>
<         <dc:creator opf:file-as="Self, My" opf:role="aut">MySelf</dc:creator>
---
>         <dc:title>%s</dc:title>
>         <dc:language>%s</dc:language>
>         <dc:identifier id="%s" opf:scheme="UUID">urn:uuid:%s</dc:identifier>
>         <dc:creator>%s</dc:creator>
79c79
< local item = [[        <item id='%s' href='%s' media-type='%s'/>]]
---
> local item = [[        <item id="%s" href="%s" media-type="%s"/>]]
196a197,199
>         local language   = specification.language   or "en"
>         local creator    = specification.author     or "My Self"
>         local title      = specification.title      or "My Title"
211c214
<         lfs.mkdir(file.join(epubpath,"OPS"))
---
>         lfs.mkdir(file.join(epubpath,"OEBPS"))
220c223
<                 local target = file.join(epubpath,"OPS",filename)
---
>                 local target = file.join(epubpath,"OEBPS",filename)
256,257c259,260
<         package   = format(package,identifier,identifier,os.uuid(),os.date("!%Y-%m-%dT%H:%M:%SZ"),concat(used,"\n"),idmaker(root))
<         toc       = format(toc,identifier,"title",root)
---
>         package   = format(package,identifier,title,language,identifier,os.uuid(),creator,os.date("!%Y-%m-%dT%H:%M:%SZ"),concat(used,"\n"),idmaker(root))
>         toc       = format(toc,identifier,title,root)
261,262c264,265
<         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)
275c278
<                 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

* Re: back-up.lua; mtx-epub.lua
  2012-06-06 22:00 ` Andy Thomas
@ 2012-06-07 12:48   ` Henning Hraban Ramm
  2012-06-07 13:53     ` Hans Hagen
  2012-06-08 18:08     ` Andy Thomas
  2012-06-07 16:33   ` Hans Hagen
  1 sibling, 2 replies; 17+ messages in thread
From: Henning Hraban Ramm @ 2012-06-07 12:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 2012-06-07 um 00:00 schrieb Andy Thomas:

> Hello all,
> I do not know, how many people are using the epub export, but here  
> are two more changes in order to achieve a valid epub file with  
> information from the context source:

Since I need ePub for my current project (even if th eprint version is  
much more important), I’m very grateful for your enhancements! I hope  
they end up in the distro ASAP.


Greetlings, Hraban
---
http://www.fiee.net/texnique/
http://wiki.contextgarden.net
https://www.cacert.org (I'm an assurer)

___________________________________________________________________________________
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

* Re: back-up.lua; mtx-epub.lua
  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
  1 sibling, 1 reply; 17+ messages in thread
From: Hans Hagen @ 2012-06-07 13:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Henning Hraban Ramm

On 7-6-2012 14:48, Henning Hraban Ramm wrote:
> Am 2012-06-07 um 00:00 schrieb Andy Thomas:
>
>> Hello all,
>> I do not know, how many people are using the epub export, but here are
>> two more changes in order to achieve a valid epub file with
>> information from the context source:
>
> Since I need ePub for my current project (even if th eprint version is
> much more important), I’m very grateful for your enhancements! I hope
> they end up in the distro ASAP.

I wonder if Luigi already tested the patches (as he's sort of in charge 
of the epub device/viewer testing) ..

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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

* Re: back-up.lua; mtx-epub.lua
  2012-06-07 13:53     ` Hans Hagen
@ 2012-06-07 14:51       ` luigi scarso
  0 siblings, 0 replies; 17+ messages in thread
From: luigi scarso @ 2012-06-07 14:51 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users, Henning Hraban Ramm

On Thu, Jun 7, 2012 at 3:53 PM, Hans Hagen <pragma@wxs.nl> wrote:
> On 7-6-2012 14:48, Henning Hraban Ramm wrote:
>>
>> Am 2012-06-07 um 00:00 schrieb Andy Thomas:
>>
>>> Hello all,
>>> I do not know, how many people are using the epub export, but here are
>>> two more changes in order to achieve a valid epub file with
>>> information from the context source:
>>
>>
>> Since I need ePub for my current project (even if th eprint version is
>> much more important), I’m very grateful for your enhancements! I hope
>> they end up in the distro ASAP.
>
>
> I wonder if Luigi already tested the patches (as he's sort of in charge of
> the epub device/viewer testing) ..
no, still in my todo queue -- busy in other stuffs

-- 
luigi
___________________________________________________________________________________
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

* Re: back-up.lua; mtx-epub.lua
  2012-06-06 22:00 ` Andy Thomas
  2012-06-07 12:48   ` Henning Hraban Ramm
@ 2012-06-07 16:33   ` Hans Hagen
  1 sibling, 0 replies; 17+ messages in thread
From: Hans Hagen @ 2012-06-07 16:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 7-6-2012 00:00, Andy Thomas wrote:
> Hello all,
>
> I do not know, how many people are using the epub export, but here are two more changes in order to achieve a valid epub file with information from the context source:
>
> On Jun 5, 2012, at 9:09 PM, Andy Thomas wrote:
>
>> 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
> 6) the title is taken from \setupinteraction
> 7) the author is taken from \setupinteraction
>
> Andy
>
>
> The diff against the actual standalone is

Best send me a patched mtx-epub so that I can do a visible diff (handier 
than decyphering the mail).

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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

* Re: back-up.lua; mtx-epub.lua
  2012-06-07 12:48   ` Henning Hraban Ramm
  2012-06-07 13:53     ` Hans Hagen
@ 2012-06-08 18:08     ` Andy Thomas
  2012-06-08 18:25       ` Aditya Mahajan
  2012-06-08 21:03       ` Hans Hagen
  1 sibling, 2 replies; 17+ messages in thread
From: Andy Thomas @ 2012-06-08 18:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello all,

I am thinking about the best way to implement the cover image for the epub. This is a mandatory requirement to work properly. The cover image is not necessarily present in the pdf version of the document and it might be the only item where that is true. So I tried to sort out the options.

1) Always take cover.png in the current directory; not very elegant
2) add cover={…} to \setupinteraction; hijacks the pdf interaction macro
3) add a \setupepub; might be overkill, but maybe more options are added later 
4) ?

Then, the image is taken, renamed and copied in the image folder and finally a html page containing the cover is created. This part is straightforward.

It would be great, if someone could come up with an elegant idea how to add the cover image file that is compatible with the context style.

Andy

On Jun 7, 2012, at 2:48 PM, Henning Hraban Ramm wrote:

> Am 2012-06-07 um 00:00 schrieb Andy Thomas:
> 
>> Hello all,
>> I do not know, how many people are using the epub export, but here are two more changes in order to achieve a valid epub file with information from the context source:
> 
> Since I need ePub for my current project (even if th eprint version is much more important), I’m very grateful for your enhancements! I hope they end up in the distro ASAP.
> 
> 
> Greetlings, Hraban
> ---
> http://www.fiee.net/texnique/
> http://wiki.contextgarden.net
> https://www.cacert.org (I'm an assurer)
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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

* Re: back-up.lua; mtx-epub.lua
  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
  1 sibling, 1 reply; 17+ messages in thread
From: Aditya Mahajan @ 2012-06-08 18:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 893 bytes --]

> Hello all,
>
> I am thinking about the best way to implement the cover image for the epub. This is a mandatory requirement to work properly. The cover image is not necessarily present in the pdf version of the document and it might be the only item where that is true. So I tried to sort out the options.
>
> 1) Always take cover.png in the current directory; not very elegant
> 2) add cover={…} to \setupinteraction; hijacks the pdf interaction macro
> 3) add a \setupepub; might be overkill, but maybe more options are added later
> 4) ?

\setupbackend[coverimage={....}]

Backends other than epub can safely ignore the directive.

In one of your earlier threads, you had talked about taking title, author, 
etc from setupinteraction. It might be better to take then from 
\setupbackend as well (will work for both epub and xhtml backends, perhaps 
also for xml).

Aditya

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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

* Re: back-up.lua; mtx-epub.lua
  2012-06-08 18:25       ` Aditya Mahajan
@ 2012-06-08 21:02         ` Hans Hagen
  0 siblings, 0 replies; 17+ messages in thread
From: Hans Hagen @ 2012-06-08 21:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 8-6-2012 20:25, Aditya Mahajan wrote:
>> Hello all,
>>
>> I am thinking about the best way to implement the cover image for the
>> epub. This is a mandatory requirement to work properly. The cover
>> image is not necessarily present in the pdf version of the document
>> and it might be the only item where that is true. So I tried to sort
>> out the options.
>>
>> 1) Always take cover.png in the current directory; not very elegant
>> 2) add cover={…} to \setupinteraction; hijacks the pdf interaction macro
>> 3) add a \setupepub; might be overkill, but maybe more options are
>> added later
>> 4) ?
>
> \setupbackend[coverimage={....}]
>
> Backends other than epub can safely ignore the directive.

better is

\setupexport

(actually, we do have \setupdocument which makes een more sense:

(1) take from setupdocument
(2) if empty take from setupexport
(3) otherwise take from setupinteraction

> In one of your earlier threads, you had talked about taking title,
> author, etc from setupinteraction. It might be better to take then from
> \setupbackend as well (will work for both epub and xhtml backends,
> perhaps also for xml).

Indeed, I realized that this morning but had not time to look into it 
yet. The interaction title is normally a simplified one used for 
referencing or document info.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


___________________________________________________________________________________
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

* Re: back-up.lua; mtx-epub.lua
  2012-06-08 18:08     ` Andy Thomas
  2012-06-08 18:25       ` Aditya Mahajan
@ 2012-06-08 21:03       ` Hans Hagen
       [not found]         ` <8EC49686-C7B3-47A1-A646-17AEC310836C@web.de>
  1 sibling, 1 reply; 17+ messages in thread
From: Hans Hagen @ 2012-06-08 21:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 8-6-2012 20:08, Andy Thomas wrote:

> I am thinking about the best way to implement the cover image for the epub. This is a mandatory requirement to work properly. The cover image is not necessarily present in the pdf version of the document and it might be the only item where that is true. So I tried to sort out the options.

filter the first page of the pdf and convert it to svg or png (which is 
what I did a couple of times)

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


___________________________________________________________________________________
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

* Re: back-up.lua; mtx-epub.lua
       [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 12:58             ` Andy Thomas
  0 siblings, 2 replies; 17+ messages in thread
From: Hans Hagen @ 2012-06-08 23:31 UTC (permalink / raw)
  To: Andy Thomas, mailing list for ConTeXt users, Aditya Mahajan

On 8-6-2012 23:28, Andy Thomas wrote:
> Thank you for the suggestions. I will try to implement it, but might need until Sunday.

- I've added some keys to \setupexport:

   author
   title
   subtitle
   firstpage (also new key in mult)
   lastpage  (aso new key in mult)

- The title, subtitle and author inherit from \setupinteraction which 
already inherits from \setupdocument (metadata namespace).

- In mtx-epub these variables are picked up (from the epub job 
specification) and firstpage / lastpage are added to the images list.

Nothing has been checked and the firstpage/lastpage image names have to 
be pushed into some epub metadata blob I guess but that's for you to 
figure out in mtx-epub. It's probably best to assume that the images are 
present and suitable for epub.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


___________________________________________________________________________________
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

* Re: back-up.lua; mtx-epub.lua
  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
  1 sibling, 1 reply; 17+ messages in thread
From: Aditya Mahajan @ 2012-06-09  0:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, 9 Jun 2012, Hans Hagen wrote:

> On 8-6-2012 23:28, Andy Thomas wrote:
>> Thank you for the suggestions. I will try to implement it, but might need 
>> until Sunday.
>
> - I've added some keys to \setupexport:
>
>  author
>  title
>  subtitle
>  firstpage (also new key in mult)
>  lastpage  (aso new key in mult)
>
> - The title, subtitle and author inherit from \setupinteraction which already 
> inherits from \setupdocument (metadata namespace).

I never realized that there was a \setupdocument!

This might be the best way to have a document title in ConTeXt:

\startsetups document:start
  ....
  code to typeset document title
  ....
\stopsetups

\setupdocument
     [title={...},
      author={...},
      date={...},
     ]

\startdocument
....
\stopdocument

rather than the different custom solutions that are floating around.

Aditya
___________________________________________________________________________________
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

* Re: back-up.lua; mtx-epub.lua
  2012-06-09  0:38             ` Aditya Mahajan
@ 2012-06-09 10:44               ` Hans Hagen
  0 siblings, 0 replies; 17+ messages in thread
From: Hans Hagen @ 2012-06-09 10:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 9-6-2012 02:38, Aditya Mahajan wrote:

> I never realized that there was a \setupdocument!

it has been there for a while ... the idea is to set up some vars at the 
top (of whatever) and use them later (e.g. variables used in a title 
page or colofon). Nothing mandate, just convenience.

> This might be the best way to have a document title in ConTeXt:
>
> \startsetups document:start
>   ....
>   code to typeset document title
>   ....
> \stopsetups
>
> \setupdocument
>      [title={...},
>       author={...},
>       date={...},
>      ]

e.g. interaction's title is set up so that in inherits from documents
"metadata:title" etc

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


___________________________________________________________________________________
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

* Re: back-up.lua; mtx-epub.lua
  2012-06-08 23:31           ` Hans Hagen
  2012-06-09  0:38             ` Aditya Mahajan
@ 2012-06-09 12:58             ` Andy Thomas
  2012-06-10 22:21               ` Hans Hagen
  1 sibling, 1 reply; 17+ messages in thread
From: Andy Thomas @ 2012-06-09 12:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Jun 9, 2012, at 1:31 AM, Hans Hagen wrote:

> On 8-6-2012 23:28, Andy Thomas wrote:
>> Thank you for the suggestions. I will try to implement it, but might need until Sunday.
> 
> - I've added some keys to \setupexport:
> 
>  author
>  title
>  subtitle
>  firstpage (also new key in mult)
>  lastpage  (aso new key in mult)
> 
> - The title, subtitle and author inherit from \setupinteraction which already inherits from \setupdocument (metadata namespace).
> 
> - In mtx-epub these variables are picked up (from the epub job specification) and firstpage / lastpage are added to the images list.
> 
> Nothing has been checked and the firstpage/lastpage image names have to be pushed into some epub metadata blob I guess but that's for you to figure out in mtx-epub. It's probably best to assume that the images are present and suitable for epub.
> 

I took the new keys and added the cover (page) generator to mtx-epub.lua. The name is hard coded (cover.xhtml), so if a user decides on naming the original file cover.tex... 

The validator likes it, next is the hard part: generating a valid xhtml. Is the xhtml generator only for the epub, i.e. can it be changed or is another output file just for the epub appropriate?

Calibre is already happy with it and shows it just fine. Please note that some ebook readers (e.g. apple devices, calibre) have a nasty caching mechanism. If you want to see the new changes, I found that it is best to delete the old book before replacing it. 

Andy

https://dl.dropbox.com/u/9089117/mtx-epub_4.lua

P.S. I have no clue, why 'images[firstpage] = firstpage' works. I would expect 'images[#images+1] = firstpage'

> Hans
> 
> -----------------------------------------------------------------
>                                          Hans Hagen | PRAGMA ADE
>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>    tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
>                                             | www.pragma-pod.nl
> -----------------------------------------------------------------
> 
> 

___________________________________________________________________________________
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

* Re: back-up.lua; mtx-epub.lua
  2012-06-09 12:58             ` Andy Thomas
@ 2012-06-10 22:21               ` Hans Hagen
  2012-06-11  5:41                 ` Andy Thomas
  0 siblings, 1 reply; 17+ messages in thread
From: Hans Hagen @ 2012-06-10 22:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 9-6-2012 14:58, Andy Thomas wrote:
>
> On Jun 9, 2012, at 1:31 AM, Hans Hagen wrote:
>
>> On 8-6-2012 23:28, Andy Thomas wrote:
>>> Thank you for the suggestions. I will try to implement it, but might need until Sunday.
>>
>> - I've added some keys to \setupexport:
>>
>>   author
>>   title
>>   subtitle
>>   firstpage (also new key in mult)
>>   lastpage  (aso new key in mult)
>>
>> - The title, subtitle and author inherit from \setupinteraction which already inherits from \setupdocument (metadata namespace).
>>
>> - In mtx-epub these variables are picked up (from the epub job specification) and firstpage / lastpage are added to the images list.
>>
>> Nothing has been checked and the firstpage/lastpage image names have to be pushed into some epub metadata blob I guess but that's for you to figure out in mtx-epub. It's probably best to assume that the images are present and suitable for epub.
>>
>
> I took the new keys and added the cover (page) generator to mtx-epub.lua. The name is hard coded (cover.xhtml), so if a user decides on naming the original file cover.tex...
>
> The validator likes it, next is the hard part: generating a valid xhtml. Is the xhtml generator only for the epub, i.e. can it be changed or is another output file just for the epub appropriate?

the only issue is that css has no method for mapping a link which is why 
the exporter produces two files (xml and xhtml)

> Calibre is already happy with it and shows it just fine. Please note that some ebook readers (e.g. apple devices, calibre) have a nasty caching mechanism. If you want to see the new changes, I found that it is best to delete the old book before replacing it.
>
> Andy
>
> https://dl.dropbox.com/u/9089117/mtx-epub_4.lua

xmlns + doctype is probably a bit over the top for the coverpage

> P.S. I have no clue, why 'images[firstpage] = firstpage' works. I would expect 'images[#images+1] = firstpage'

it's a hash mapping names onto real names (as we can have converted images)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


___________________________________________________________________________________
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

* Re: back-up.lua; mtx-epub.lua
  2012-06-10 22:21               ` Hans Hagen
@ 2012-06-11  5:41                 ` Andy Thomas
  2012-06-11  7:35                   ` Hans Hagen
  0 siblings, 1 reply; 17+ messages in thread
From: Andy Thomas @ 2012-06-11  5:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen


On Jun 11, 2012, at 12:21 AM, Hans Hagen wrote:

>> The validator likes it, next is the hard part: generating a valid xhtml. Is the xhtml generator only for the epub, i.e. can it be changed or is another output file just for the epub appropriate?
> 
> the only issue is that css has no method for mapping a link which is why the exporter produces two files (xml and xhtml)

I get an error by the epub validator if I feed it the generated epub. The content file is:

-START------------
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>

<!-- input filename   : test_00           -->
<!-- processing date  : Mon Jun 11 07:03:39 2012 -->
<!-- context version  : 2012.06.11 00:21  -->
<!-- exporter version : 0.30              -->


<document xmlns:m="http://www.w3.org/1998/Math/MathML" version="0.30" language="de" date="Mon Jun 11 07:03:39 2012" file="test_00" context="2012.06.11 00:21" xmlns:xhtml="http://www.w3.org/1999/xhtml">
Hello world!
</document>
-END------------

the error is:

-START------------
Epubcheck Version 3.0b5

Validating against EPUB version 2.0
ERROR: test_00.epub/OEBPS/test_00.xhtml(9,202): elements from namespace "" are not allowed

Check finished with warnings or errors
-END------------

A possible validatable file would be

-START------------
<?xml version="1.0" encoding="UTF-8" ?>

<!-- input filename   : test_00           -->
<!-- processing date  : Sat Jun  9 14:36:39 2012 -->
<!-- context version  : 2012.06.09 01:22  -->
<!-- exporter version : 0.30              -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <title>TITLE</title>
  </head>
  <body>
      <div id="test_00">
          Hello world!
      </div>
  </body>
</html>
-END------------

It just wraps the filename without extension in title plus head and the main part in body plus a div. However, I did not try, yet, how many or which devices can read it just fine.

> 
>> Calibre is already happy with it and shows it just fine. Please note that some ebook readers (e.g. apple devices, calibre) have a nasty caching mechanism. If you want to see the new changes, I found that it is best to delete the old book before replacing it.
>> 
>> Andy
>> 
>> https://dl.dropbox.com/u/9089117/mtx-epub_4.lua
> 
> xmlns + doctype is probably a bit over the top for the coverpage

I slavishly follow the mandatory epub specification and then add some things to make common devices work. Calibre, Adobe Digital Editions and Apple devices want a xhtml cover page in a very special way and ignore the cover image otherwise. The next thing I would add is a toc.xhtml. Here, a Kindle ignores the toc.ncx and wants a html toc as well. Unfortunately, this blows up mtx-epub, but at least that is the last issue with reading devices that I know.

Andy




___________________________________________________________________________________
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

* Re: back-up.lua; mtx-epub.lua
  2012-06-11  5:41                 ` Andy Thomas
@ 2012-06-11  7:35                   ` Hans Hagen
  0 siblings, 0 replies; 17+ messages in thread
From: Hans Hagen @ 2012-06-11  7:35 UTC (permalink / raw)
  To: Andy Thomas; +Cc: mailing list for ConTeXt users

On 11-6-2012 07:41, Andy Thomas wrote:
>
> On Jun 11, 2012, at 12:21 AM, Hans Hagen wrote:
>
>>> The validator likes it, next is the hard part: generating a valid xhtml. Is the xhtml generator only for the epub, i.e. can it be changed or is another output file just for the epub appropriate?
>>
>> the only issue is that css has no method for mapping a link which is why the exporter produces two files (xml and xhtml)
>
> I get an error by the epub validator if I feed it the generated epub. The content file is:
>
> -START------------
> <?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
>
> <!-- input filename   : test_00           -->
> <!-- processing date  : Mon Jun 11 07:03:39 2012 -->
> <!-- context version  : 2012.06.11 00:21  -->
> <!-- exporter version : 0.30              -->
>
>
> <document xmlns:m="http://www.w3.org/1998/Math/MathML" version="0.30" language="de" date="Mon Jun 11 07:03:39 2012" file="test_00" context="2012.06.11 00:21" xmlns:xhtml="http://www.w3.org/1999/xhtml">
> Hello world!
> </document>
> -END------------
>
> the error is:
>
> -START------------
> Epubcheck Version 3.0b5
>
> Validating against EPUB version 2.0
> ERROR: test_00.epub/OEBPS/test_00.xhtml(9,202): elements from namespace "" are not allowed

maybe then mean that namespace mathml is not supported?

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


___________________________________________________________________________________
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).