ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Error in ePub script
@ 2015-08-06  4:33 Henning Hraban Ramm
  2015-08-06  7:36 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Henning Hraban Ramm @ 2015-08-06  4:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi, I’m at creating an ePub once again and run into an error:

$ mtxrun --script epub --make prd_MBL

resolvers       | caching | skipping 'files' for 'home:texmf' from '/Users/hraban/Library/texmf/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/trees/54be04d87dd160089f572b19cb5c97e9' (version mismatch)
mtx-epub        | using specification file 'prd_MBL-export/prd_MBL-pub.lua'
mtx-epub        | cover page image 'cover.xhtml' is not present
mtx-epub        | saving dummy coverpage to 'prd_MBL-export/cover.xhtml'
mtx-epub        | 17 images checked, 0 updated, 17 kept, 0 skipped
mtx-epub        | creating paths in tree 'prd_MBL-epub'
mtx-epub        | removing 'prd_MBL-epub/OEBPS/styles/prd_MBL-images.css'
mtx-epub        | checking image 'prd_MBL-export/images/MT-Logo_grau-page-1.svg' -> 'prd_MBL-epub/OEBPS/images/MT-Logo_grau-page-1.svg'
mtx-epub        | copying 'prd_MBL-export/images/MT-Logo_grau-page-1.svg' to 'prd_MBL-epub/OEBPS/images/MT-Logo_grau-page-1.svg'
mtx-epub        | checking image 'prd_MBL-export/images/blatt_esche.jpg' -> 'prd_MBL-epub/OEBPS/images/blatt_esche.jpg‘
...
mtx-epub        | checking image 'prd_MBL-export/styles/prd_MBL-defaults.css' -> 'prd_MBL-epub/OEBPS/styles/prd_MBL-defaults.css'
mtx-epub        | copying 'prd_MBL-export/styles/prd_MBL-defaults.css' to 'prd_MBL-epub/OEBPS/styles/prd_MBL-defaults.css'
mtx-epub        | checking image 'prd_MBL-export/styles/prd_MBL-images.css' -> 'prd_MBL-epub/OEBPS/styles/prd_MBL-images.css'
mtx-epub        | copying 'prd_MBL-export/styles/prd_MBL-images.css' to 'prd_MBL-epub/OEBPS/styles/prd_MBL-images.css'
mtx-epub        | checking image 'prd_MBL-export/styles/prd_MBL-styles.css' -> 'prd_MBL-epub/OEBPS/styles/prd_MBL-styles.css'
mtx-epub        | copying 'prd_MBL-export/styles/prd_MBL-styles.css' to 'prd_MBL-epub/OEBPS/styles/prd_MBL-styles.css'
mtx-epub        | copying 'prd_MBL-export/prd_MBL-div.xhtml' to 'prd_MBL-epub/OEBPS/prd_MBL-div.xhtml'
mtx-epub        | copying 'prd_MBL-export/cover.xhtml' to 'prd_MBL-epub/OEBPS/cover.xhtml'
mtx-epub        | relocating images...texmf/tex/texmf-context/scripts/context/lua/mtx-epub.lua:285: attempt to index field '?' (a nil value)

The error is in this function:

local function relocateimages(imagedata,oldname,newname,subpath,rename)
    local data = io.loaddata(oldname)
    if data then
        subpath = joinfile("..",subpath)
        report("relocating images")
        local n = 0
        local done = gsub(data,[[(id=")(.-)(".-background%-image *: *url%()(.-)(%))]], function(s1,id,s2,name,s3)
            local newname = imagedata[id].newname
-- #### imagedata[id].newname throws the above error
            if newname then
                if subpath then
                    name = joinfile(subpath,basename(newname))
                else
                    name = basename(newname)
                end
             -- name = url.addscheme(name)
            end
            if newname then
                n = n + 1
                if rename then
                    name = joinfile(subpath,addsuffix(id,suffix(name)))
                end
                return s1 .. id .. s2 .. name .. s3
            end
        end)
        report("%s images relocated in %a",n,newname)
        if newname then
            io.savedata(newname,done)
        end
    end
    return images
end

My prd_MBL-pub.lua looks like:

return {
 ["author"]="Henning Hraban Ramm",
 ["htmlfiles"]={ "prd_MBL-div.xhtml" },
 ["htmlroot"]="prd_MBL-div.xhtml",
 ["identifier"]="96f59e0d-454d-93e6-3fa9-5a126440a831",
 ["imagefile"]="styles/prd_MBL-images.css",
 ["imagepath"]="images",
 ["images"]={
  ["image>1"]={
   ["element"]="image",
   ["height"]="1.875cm",
   ["id"]="image-1",
   ["name"]="MT-Logo_grau",
   ["url"]="file:///MT-Logo_grau",
   ["used"]="img/MT-Logo_grau.pdf",
   ["width"]="2.671cm",
  },
  ["image>10"]={
   ["element"]="image",
   ["height"]="3.750cm",
   ["id"]="image-10",
   ["name"]="blatt_esche",
   ["url"]="file:///blatt_esche",
   ["used"]="img/blatt_esche.jpg",
   ["width"]="4.038cm",
  },
...
 },
 ["language"]="de",
 ["name"]="prd_MBL",
 ["stylepath"]="styles",
 ["styles"]={ "prd_MBL-defaults.css", "prd_MBL-images.css", "prd_MBL-styles.css" },
 ["title"]="MBL",
 ["xhtmlfiles"]={ "prd_MBL-tag.xhtml" },
 ["xmlfiles"]={ "prd_MBL-raw.xml" },
}

What’s wrong?

Greetlings, Hraban
---
http://www.fiee.net
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] 3+ messages in thread

* Re: Error in ePub script
  2015-08-06  4:33 Error in ePub script Henning Hraban Ramm
@ 2015-08-06  7:36 ` Hans Hagen
  2015-08-06 13:01   ` Henning Hraban Ramm
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2015-08-06  7:36 UTC (permalink / raw)
  To: ntg-context

On 8/6/2015 6:33 AM, Henning Hraban Ramm wrote:
> Hi, I’m at creating an ePub once again and run into an error:
>
> $ mtxrun --script epub --make prd_MBL
>
> resolvers       | caching | skipping 'files' for 'home:texmf' from '/Users/hraban/Library/texmf/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/trees/54be04d87dd160089f572b19cb5c97e9' (version mismatch)
> mtx-epub        | using specification file 'prd_MBL-export/prd_MBL-pub.lua'
> mtx-epub        | cover page image 'cover.xhtml' is not present
> mtx-epub        | saving dummy coverpage to 'prd_MBL-export/cover.xhtml'
> mtx-epub        | 17 images checked, 0 updated, 17 kept, 0 skipped
> mtx-epub        | creating paths in tree 'prd_MBL-epub'
> mtx-epub        | removing 'prd_MBL-epub/OEBPS/styles/prd_MBL-images.css'
> mtx-epub        | checking image 'prd_MBL-export/images/MT-Logo_grau-page-1.svg' -> 'prd_MBL-epub/OEBPS/images/MT-Logo_grau-page-1.svg'
> mtx-epub        | copying 'prd_MBL-export/images/MT-Logo_grau-page-1.svg' to 'prd_MBL-epub/OEBPS/images/MT-Logo_grau-page-1.svg'
> mtx-epub        | checking image 'prd_MBL-export/images/blatt_esche.jpg' -> 'prd_MBL-epub/OEBPS/images/blatt_esche.jpg‘
> ...
> mtx-epub        | checking image 'prd_MBL-export/styles/prd_MBL-defaults.css' -> 'prd_MBL-epub/OEBPS/styles/prd_MBL-defaults.css'
> mtx-epub        | copying 'prd_MBL-export/styles/prd_MBL-defaults.css' to 'prd_MBL-epub/OEBPS/styles/prd_MBL-defaults.css'
> mtx-epub        | checking image 'prd_MBL-export/styles/prd_MBL-images.css' -> 'prd_MBL-epub/OEBPS/styles/prd_MBL-images.css'
> mtx-epub        | copying 'prd_MBL-export/styles/prd_MBL-images.css' to 'prd_MBL-epub/OEBPS/styles/prd_MBL-images.css'
> mtx-epub        | checking image 'prd_MBL-export/styles/prd_MBL-styles.css' -> 'prd_MBL-epub/OEBPS/styles/prd_MBL-styles.css'
> mtx-epub        | copying 'prd_MBL-export/styles/prd_MBL-styles.css' to 'prd_MBL-epub/OEBPS/styles/prd_MBL-styles.css'
> mtx-epub        | copying 'prd_MBL-export/prd_MBL-div.xhtml' to 'prd_MBL-epub/OEBPS/prd_MBL-div.xhtml'
> mtx-epub        | copying 'prd_MBL-export/cover.xhtml' to 'prd_MBL-epub/OEBPS/cover.xhtml'
> mtx-epub        | relocating images...texmf/tex/texmf-context/scripts/context/lua/mtx-epub.lua:285: attempt to index field '?' (a nil value)
>
> The error is in this function:
>
> local function relocateimages(imagedata,oldname,newname,subpath,rename)
>      local data = io.loaddata(oldname)
>      if data then
>          subpath = joinfile("..",subpath)
>          report("relocating images")
>          local n = 0
>          local done = gsub(data,[[(id=")(.-)(".-background%-image *: *url%()(.-)(%))]], function(s1,id,s2,name,s3)
>              local newname = imagedata[id].newname
> -- #### imagedata[id].newname throws the above error
>              if newname then
>                  if subpath then
>                      name = joinfile(subpath,basename(newname))
>                  else
>                      name = basename(newname)
>                  end
>               -- name = url.addscheme(name)
>              end
>              if newname then
>                  n = n + 1
>                  if rename then
>                      name = joinfile(subpath,addsuffix(id,suffix(name)))
>                  end
>                  return s1 .. id .. s2 .. name .. s3
>              end
>          end)
>          report("%s images relocated in %a",n,newname)
>          if newname then
>              io.savedata(newname,done)
>          end
>      end
>      return images
> end
>
> My prd_MBL-pub.lua looks like:
>
> return {
>   ["author"]="Henning Hraban Ramm",
>   ["htmlfiles"]={ "prd_MBL-div.xhtml" },
>   ["htmlroot"]="prd_MBL-div.xhtml",
>   ["identifier"]="96f59e0d-454d-93e6-3fa9-5a126440a831",
>   ["imagefile"]="styles/prd_MBL-images.css",
>   ["imagepath"]="images",
>   ["images"]={
>    ["image>1"]={
>     ["element"]="image",
>     ["height"]="1.875cm",
>     ["id"]="image-1",
>     ["name"]="MT-Logo_grau",
>     ["url"]="file:///MT-Logo_grau",
>     ["used"]="img/MT-Logo_grau.pdf",
>     ["width"]="2.671cm",
>    },
>    ["image>10"]={
>     ["element"]="image",
>     ["height"]="3.750cm",
>     ["id"]="image-10",
>     ["name"]="blatt_esche",
>     ["url"]="file:///blatt_esche",
>     ["used"]="img/blatt_esche.jpg",
>     ["width"]="4.038cm",
>    },
> ...
>   },
>   ["language"]="de",
>   ["name"]="prd_MBL",
>   ["stylepath"]="styles",
>   ["styles"]={ "prd_MBL-defaults.css", "prd_MBL-images.css", "prd_MBL-styles.css" },
>   ["title"]="MBL",
>   ["xhtmlfiles"]={ "prd_MBL-tag.xhtml" },
>   ["xmlfiles"]={ "prd_MBL-raw.xml" },
> }
>
> What’s wrong?

looks like an old mtx-epub, the latest one has a check

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

* Re: Error in ePub script
  2015-08-06  7:36 ` Hans Hagen
@ 2015-08-06 13:01   ` Henning Hraban Ramm
  0 siblings, 0 replies; 3+ messages in thread
From: Henning Hraban Ramm @ 2015-08-06 13:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 2015-08-06 um 13:36 schrieb Hans Hagen <pragma@wxs.nl>:

> On 8/6/2015 6:33 AM, Henning Hraban Ramm wrote:
>> Hi, I’m at creating an ePub once again and run into an error:
>> mtx-epub        | relocating images...texmf/tex/texmf-context/scripts/context/lua/mtx-epub.lua:285: attempt to index field '?' (a nil value)
>> What’s wrong?
> 
> looks like an old mtx-epub, the latest one has a check

Thank you! I deleted the file and updated my installation (seems my usual routine didn’t do the job). Now it runs.

Greetlings, Hraban
---
http://www.fiee.net
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] 3+ messages in thread

end of thread, other threads:[~2015-08-06 13:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-06  4:33 Error in ePub script Henning Hraban Ramm
2015-08-06  7:36 ` Hans Hagen
2015-08-06 13:01   ` Henning Hraban Ramm

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