ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* mtx-epub.lua
@ 2012-06-04 21:58 Andy Thomas
  2012-06-04 22:17 ` mtx-epub.lua Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Thomas @ 2012-06-04 21:58 UTC (permalink / raw)
  To: ntg-context

Hello all,

while working on my ebook, I found the following issues in mtx-epub.lua. Once a successful run is done, there is no need to try the other zippers. It also gives error messages, although everything is already done. Fix is attached.

Then, I got confused about the error messages appearing 3 times and found an issue in texlua of TL2011 (beta-0.70.1-2011062107) as well as the newest standalone (beta-0.70.2-2012052309). Consider the following example:

print(os.execute("abcxyz"))

This gives in Lua 5.2: sh: abcxyz: command not found
nil	exit	127

But in texlua it does: sh: abcxyz: command not found
32512

This breaks the if conditional which becomes true, although there is no abcxyz command. If there are if statements such as this one in other places, they would not work as intended either.

Andy



274,279c274,281
<             if os.execute(format(zipper.uncompressed,epubfile,"mimetype")) then
<                 os.execute(format(zipper.compressed,epubfile,"META-INF"))
<                 os.execute(format(zipper.compressed,epubfile,"OPS"))
<                 done = zipper.name
<             else
<                 list[#list+1] = zipper.name
---
>             if not done then
>                 if os.execute(format(zipper.uncompressed,epubfile,"mimetype")) then
>                     os.execute(format(zipper.compressed,epubfile,"META-INF"))
>                     os.execute(format(zipper.compressed,epubfile,"OPS"))
>                     done = zipper.name
>                 else
>                     list[#list+1] = zipper.name
>                 end


___________________________________________________________________________________
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] 2+ messages in thread

* Re: mtx-epub.lua
  2012-06-04 21:58 mtx-epub.lua Andy Thomas
@ 2012-06-04 22:17 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2012-06-04 22:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 4-6-2012 23:58, Andy Thomas wrote:

> 274,279c274,281
> <              if os.execute(format(zipper.uncompressed,epubfile,"mimetype")) then
> <                  os.execute(format(zipper.compressed,epubfile,"META-INF"))
> <                  os.execute(format(zipper.compressed,epubfile,"OPS"))
> <                  done = zipper.name
> <              else
> <                  list[#list+1] = zipper.name
> ---
>>              if not done then
>>                  if os.execute(format(zipper.uncompressed,epubfile,"mimetype")) then
>>                      os.execute(format(zipper.compressed,epubfile,"META-INF"))
>>                      os.execute(format(zipper.compressed,epubfile,"OPS"))
>>                      done = zipper.name
>>                  else
>>                      list[#list+1] = zipper.name
>>                  end

As we give a list of zippers on failure, the following might be better:

         local done = false

         for i=1,#zippers do
             local zipper = zippers[i]
             if 
os.execute(format(zipper.uncompressed,epubfile,"mimetype")) then
                 os.execute(format(zipper.compressed,epubfile,"META-INF"))
                 os.execute(format(zipper.compressed,epubfile,"OPS"))
                 done = zipper.name
                 break
             end
         end

         lfs.chdir("..")

         if done then
             application.report("epub archive made using %s: 
%s",done,file.join(epubpath,epubfile))
         else
             local list = { }
             for i=1,#zippers do
                 list[#list+1] = zipper.name
             end
             application.report("no epub archive made, install one of: 
%s",concat(list," "))
         end

(I will look into the os.execute later .. remind me if needed.)

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] 2+ messages in thread

end of thread, other threads:[~2012-06-04 22:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-04 21:58 mtx-epub.lua Andy Thomas
2012-06-04 22:17 ` mtx-epub.lua 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).