Commit 00f76531 by Edgar HIPP

Fix issue #32 : Multiple images in header fails

parent acb23e89
...@@ -75,10 +75,10 @@ class ImageModule ...@@ -75,10 +75,10 @@ class ImageModule
xmlTemplater=@manager.getInstance('xmlTemplater') xmlTemplater=@manager.getInstance('xmlTemplater')
imR=new ImgReplacer(xmlTemplater,@imgManager) imR=new ImgReplacer(xmlTemplater,@imgManager)
imR.getDataFromString=(result,cb)=> imR.getDataFromString=(result,cb)=>
if @getImageAsync? if @options.getImageAsync?
@getImageAsync(result,cb) @options.getImageAsync(result,cb)
else else
cb(null,@getImage(result)) cb(null,@options.getImage(result))
imR.pushQrQueue=(num)=> imR.pushQrQueue=(num)=>
@qrQueue.push(num) @qrQueue.push(num)
imR.popQrQueue=(num)=> imR.popQrQueue=(num)=>
...@@ -87,12 +87,16 @@ class ImageModule ...@@ -87,12 +87,16 @@ class ImageModule
@qrQueue.splice(found,1) @qrQueue.splice(found,1)
else @on('error',new Error("qrqueue #{num} is not in qrqueue")) else @on('error',new Error("qrqueue #{num} is not in qrqueue"))
if @qrQueue.length==0 then @finished() if @qrQueue.length==0 then @finished()
num=parseInt(Math.random()*10000)
imR.pushQrQueue("rendered-" + num)
try try
imR imR
.findImages() .findImages()
.replaceImages() .replaceImages()
catch e catch e
@on('error',e) @on('error',e)
f=()=>imR.popQrQueue("rendered-" + num)
setImmediate f
finished:-> finished:->
on:(event,data)-> on:(event,data)->
if event=='error' if event=='error'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment