Commit ebea6f31 by Edgar HIPP

Add convert scripts

parent 38a1132e
{
"presets": ["es2015"]
}
......@@ -2,3 +2,4 @@
test/
js/
node_modules
es6
......@@ -6,9 +6,3 @@ node_js:
- "0.10"
- "4"
- "iojs"
before_script:
- "npm install -g npm"
- "npm install -g gulp"
- "npm install -g mocha"
- "gulp allCoffee"
......@@ -34,11 +34,13 @@ DocUtils.pregMatchAll= (regex, content) ->
content=lolalolilala
returns: [{0:'la',offset:2},{0:'la',offset:8},{0:'la',offset:10}]
###
if typeof regex!='object'
regex = new RegExp(regex,'g')
if (typeof regex!='object')
regex= (new RegExp(regex,'g'))
matchArray= []
replacer = (match,pn..., offset, string)->
pn.unshift match #add match so that pn[0] = whole match, pn[1]= first parenthesis,...
replacer = (pn...)->
string = pn.pop()
offset = pn.pop()
#add match so that pn[0] = whole match, pn[1]= first parenthesis,...
pn.offset= offset
matchArray.push pn
content.replace regex,replacer
......
DocUtils=require('./docUtils')
imageExtensions=['gif','jpeg','jpg','emf','png']
module.exports = class ImgManager
imageExtensions=['gif','jpeg','jpg','emf','png']
constructor:(@zip,@fileName)->
@endFileName=@fileName.replace(/^.*?([a-z0-9]+)\.xml$/,"$1")
getImageList: () ->
regex= ///
[^.]+ #name
\. #dot
([^.]+) #extension
[^.]+
\.
([^.]+)
///
imageList= []
for index of @zip.files
......@@ -26,11 +27,13 @@ module.exports = class ImgManager
if file==undefined then return
content= DocUtils.decodeUtf8 file.asText()
@xmlDoc= DocUtils.Str2xml content
RidArray = ((parseInt tag.getAttribute("Id").substr(3)) for tag in @xmlDoc.getElementsByTagName('Relationship')) #Get all Rids
# Get all Rids
RidArray = []
for tag in @xmlDoc.getElementsByTagName('Relationship')
RidArray.push(parseInt tag.getAttribute("Id").substr(3))
@maxRid=DocUtils.maxArray(RidArray)
@imageRels=[]
this
addExtensionRels: (contentType,extension) -> #Add an extension type in the [Content_Types.xml], is used if for example you want word to be able to read png files (for every extension you add you need a contentType)
content = @zip.files["[Content_Types].xml"].asText()
xmlDoc= DocUtils.Str2xml content
......
......@@ -9,11 +9,7 @@ module.exports= class ImgReplacer
@xmlTemplater.numQrCode=0
this
findImages:() ->
@imgMatches= DocUtils.pregMatchAll ///
<w:drawing[^>]*>
.*?<a:blip.r:embed.*?
</w:drawing>
///g, @xmlTemplater.content
@imgMatches= DocUtils.pregMatchAll /<w:drawing[^>]*>.*?<a:blip.r:embed.*?<\/w:drawing>/g, @xmlTemplater.content
this
replaceImages: ()->
@qr=[]
......@@ -29,7 +25,29 @@ module.exports= class ImgReplacer
replaceImage:(match,u)->
num=parseInt(Math.random()*10000)
try
xmlImg= DocUtils.Str2xml '<?xml version="1.0" ?><w:document mc:Ignorable="w14 wp14" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">'+match[0]+'</w:document>',(_i,type)->if _i=='fatalError' then throw "fatalError"
baseDocument = """<?xml version="1.0" ?>
<w:document
mc:Ignorable="w14 wp14"
xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
xmlns:w10="urn:schemas-microsoft-com:office:word"
xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml"
xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing"
xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas"
xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"
xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk"
xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">#{match[0]}</w:document>
"""
f=(_i,type)->
if _i=='fatalError'
throw "fatalError"
xmlImg= DocUtils.Str2xml baseDocument,f
catch e
return
tagrId= xmlImg.getElementsByTagName("a:blip")[0]
......
......@@ -32,8 +32,8 @@ class ImageModule
xmlTemplater=@manager.getInstance('xmlTemplater')
templaterState=@manager.getInstance('templaterState')
subContent=new SubContent(xmlTemplater.content)
.getInnerTag(templaterState)
.getOuterXml(outsideElement)
subContent=subContent.getInnerTag(templaterState)
subContent=subContent.getOuterXml(outsideElement)
xmlTemplater.replaceXml(subContent,text)
convertPixelsToEmus:(pixel)->
Math.round(pixel * 9525)
......@@ -91,9 +91,7 @@ class ImageModule
num=parseInt(Math.random()*10000)
imR.pushQrQueue("rendered-" + num)
try
imR
.findImages()
.replaceImages()
imR.findImages().replaceImages()
catch e
@on('error',e)
f=()=>imR.popQrQueue("rendered-" + num)
......
......@@ -3,12 +3,13 @@ DocxGen=require('docxtemplater')
expect=require('chai').expect
fileNames=[
'imageAfterLoop.docx'
'imageExample.docx',
'imageLoopExample.docx',
'imageInlineExample.docx',
'imageHeaderFooterExample.docx',
'qrExample.docx',
'imageInlineExample.docx',
'imageLoopExample.docx',
'noImage.docx',
'qrExample.docx',
'qrExample2.docx',
'qrHeader.docx',
'qrHeaderNoImage.docx',
......@@ -27,6 +28,12 @@ ImageModule=require('../js/index.js')
docX={}
stripNonNormalCharacters = (string) =>
string.replace(/\n|\r|\t/g, "")
expectNormalCharacters = (string1, string2) =>
expect(stripNonNormalCharacters(string1)).to.be.equal(stripNonNormalCharacters(string2))
loadFile=(name)->
if fs.readFileSync? then return fs.readFileSync(__dirname+"/../examples/"+name,"binary")
xhrDoc= new XMLHttpRequest()
......@@ -36,6 +43,9 @@ loadFile=(name)->
xhrDoc.send()
xhrDoc.response
loadAndRender = (d, name, data)->
return d.load(docX[name].loadedContent).setData(data).render()
for name in fileNames
content=loadFile(name)
docX[name]=new DocxGen()
......@@ -46,10 +56,7 @@ describe 'image adding with {% image} syntax', ()->
name='imageExample.docx'
imageModule=new ImageModule(opts)
docX[name].attachModule(imageModule)
out=docX[name]
.load(docX[name].loadedContent)
.setData({image:'examples/image.png'})
.render()
out = loadAndRender(docX[name], name, {image:'examples/image.png'})
zip=out.getZip()
fs.writeFile("test7.docx",zip.generate({type:"nodebuffer"}))
......@@ -61,7 +68,7 @@ describe 'image adding with {% image} syntax', ()->
relsFile=zip.files['word/_rels/document.xml.rels']
expect(relsFile?, "No rels file found").to.equal(true)
relsFileContent=relsFile.asText()
expect(relsFileContent).to.equal("""<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" Target="numbering.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/><Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" Target="footnotes.xml"/><Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes" Target="endnotes.xml"/><Relationship Id="hId0" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header0.xml"/><Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image_generated_1.png"/></Relationships>""")
expectNormalCharacters(relsFileContent, """<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" Target="numbering.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/><Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" Target="footnotes.xml"/><Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes" Target="endnotes.xml"/><Relationship Id="hId0" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header0.xml"/><Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image_generated_1.png"/></Relationships>""")
documentFile=zip.files['word/document.xml']
expect(documentFile?, "No document file found").to.equal(true)
......@@ -74,10 +81,7 @@ describe 'image adding with {% image} syntax', ()->
opts.centered = true
imageModule=new ImageModule(opts)
d.attachModule(imageModule)
out=d
.load(docX[name].loadedContent)
.setData({image:'examples/image.png'})
.render()
out = loadAndRender(d, name, {image:'examples/image.png'})
zip=out.getZip()
fs.writeFile("test_center.docx",zip.generate({type:"nodebuffer"}))
......@@ -88,7 +92,7 @@ describe 'image adding with {% image} syntax', ()->
relsFile=zip.files['word/_rels/document.xml.rels']
expect(relsFile?).to.equal(true)
relsFileContent=relsFile.asText()
expect(relsFileContent).to.equal("""<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/><Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering\" Target=\"numbering.xml\"/><Relationship Id=\"rId3\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings\" Target=\"settings.xml\"/><Relationship Id=\"rId4\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes\" Target=\"footnotes.xml\"/><Relationship Id=\"rId5\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes\" Target=\"endnotes.xml\"/><Relationship Id=\"hId0\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header\" Target=\"header0.xml\"/><Relationship Id=\"rId6\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"media/image_generated_1.png\"/></Relationships>""")
expectNormalCharacters(relsFileContent, """<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/><Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering\" Target=\"numbering.xml\"/><Relationship Id=\"rId3\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings\" Target=\"settings.xml\"/><Relationship Id=\"rId4\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes\" Target=\"footnotes.xml\"/><Relationship Id=\"rId5\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes\" Target=\"endnotes.xml\"/><Relationship Id=\"hId0\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header\" Target=\"header0.xml\"/><Relationship Id=\"rId6\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"media/image_generated_1.png\"/></Relationships>""")
documentFile=zip.files['word/document.xml']
expect(documentFile?).to.equal(true)
......@@ -101,12 +105,7 @@ describe 'image adding with {% image} syntax', ()->
imageModule=new ImageModule(opts)
docX[name].attachModule(imageModule)
out=docX[name]
.load(docX[name].loadedContent)
.setData({images:['examples/image.png','examples/image2.png']})
out
.render()
out = loadAndRender(docX[name], name, {images:['examples/image.png','examples/image2.png']})
zip=out.getZip()
......@@ -121,7 +120,7 @@ describe 'image adding with {% image} syntax', ()->
relsFile=zip.files['word/_rels/document.xml.rels']
expect(relsFile?).to.equal(true)
relsFileContent=relsFile.asText()
expect(relsFileContent).to.equal("""<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/><Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering\" Target=\"numbering.xml\"/><Relationship Id=\"rId3\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings\" Target=\"settings.xml\"/><Relationship Id=\"rId4\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes\" Target=\"footnotes.xml\"/><Relationship Id=\"rId5\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes\" Target=\"endnotes.xml\"/><Relationship Id=\"hId0\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header\" Target=\"header0.xml\"/><Relationship Id=\"rId6\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"media/image_generated_1.png\"/><Relationship Id=\"rId7\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"media/image_generated_2.png\"/></Relationships>""")
expectNormalCharacters(relsFileContent, """<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/><Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering\" Target=\"numbering.xml\"/><Relationship Id=\"rId3\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings\" Target=\"settings.xml\"/><Relationship Id=\"rId4\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes\" Target=\"footnotes.xml\"/><Relationship Id=\"rId5\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes\" Target=\"endnotes.xml\"/><Relationship Id=\"hId0\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header\" Target=\"header0.xml\"/><Relationship Id=\"rId6\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"media/image_generated_1.png\"/><Relationship Id=\"rId7\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"media/image_generated_2.png\"/></Relationships>""")
documentFile=zip.files['word/document.xml']
expect(documentFile?).to.equal(true)
......@@ -134,10 +133,7 @@ describe 'image adding with {% image} syntax', ()->
name='imageHeaderFooterExample.docx'
imageModule=new ImageModule(opts)
docX[name].attachModule(imageModule)
out=docX[name]
.load(docX[name].loadedContent)
.setData({image:'examples/image.png'})
.render()
out = loadAndRender(docX[name], name, {image:'examples/image.png'})
zip=out.getZip()
......@@ -152,27 +148,23 @@ describe 'image adding with {% image} syntax', ()->
relsFile=zip.files['word/_rels/document.xml.rels']
expect(relsFile?).to.equal(true)
relsFileContent=relsFile.asText()
expect(relsFileContent).to.equal("""<?xml version="1.0" encoding="UTF-8"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header1.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" Target="footer1.xml"/><Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/><Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/>
</Relationships>""")
expectNormalCharacters(relsFileContent, """<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header1.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" Target="footer1.xml"/><Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/><Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/></Relationships>""")
headerRelsFile=zip.files['word/_rels/header1.xml.rels']
expect(headerRelsFile?).to.equal(true)
headerRelsFileContent=headerRelsFile.asText()
expect(headerRelsFileContent).to.equal("""<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header1.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" Target="footer1.xml"/><Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/><Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/>
<Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image_generated_2.png"/></Relationships>""")
expectNormalCharacters(headerRelsFileContent, """<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header1.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" Target="footer1.xml"/><Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/><Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/><Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image_generated_2.png"/>
</Relationships>""" )
footerRelsFile=zip.files['word/_rels/footer1.xml.rels']
expect(footerRelsFile?).to.equal(true)
footerRelsFileContent=footerRelsFile.asText()
expect(footerRelsFileContent).to.equal("""<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header1.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" Target="footer1.xml"/><Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/><Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/>
<Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image_generated_1.png"/></Relationships>""")
expectNormalCharacters(footerRelsFileContent, """<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header1.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" Target="footer1.xml"/><Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/><Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/><Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image_generated_1.png"/></Relationships>""")
documentFile=zip.files['word/document.xml']
expect(documentFile?).to.equal(true)
documentContent=documentFile.asText()
expect(documentContent).to.equal("""<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"><w:body><w:p><w:pPr><w:pStyle w:val="Normal"/><w:rPr></w:rPr></w:pPr><w:r><w:rPr></w:rPr></w:r></w:p><w:sectPr><w:headerReference w:type="default" r:id="rId2"/><w:footerReference w:type="default" r:id="rId3"/><w:type w:val="nextPage"/><w:pgSz w:w="12240" w:h="15840"/><w:pgMar w:left="1800" w:right="1800" w:header="720" w:top="2810" w:footer="1440" w:bottom="2003" w:gutter="0"/><w:pgNumType w:fmt="decimal"/><w:formProt w:val="false"/><w:textDirection w:val="lrTb"/><w:docGrid w:type="default" w:linePitch="249" w:charSpace="2047"/></w:sectPr></w:body></w:document>""")
expectNormalCharacters(documentContent, """<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"><w:body><w:p><w:pPr><w:pStyle w:val="Normal"/><w:rPr></w:rPr></w:pPr><w:r><w:rPr></w:rPr></w:r></w:p><w:sectPr><w:headerReference w:type="default" r:id="rId2"/><w:footerReference w:type="default" r:id="rId3"/><w:type w:val="nextPage"/><w:pgSz w:w="12240" w:h="15840"/><w:pgMar w:left="1800" w:right="1800" w:header="720" w:top="2810" w:footer="1440" w:bottom="2003" w:gutter="0"/><w:pgNumType w:fmt="decimal"/><w:formProt w:val="false"/><w:textDirection w:val="lrTb"/><w:docGrid w:type="default" w:linePitch="249" w:charSpace="2047"/></w:sectPr></w:body></w:document>""")
fs.writeFile("test_header_footer.docx",zip.generate({type:"nodebuffer"}))
......@@ -194,14 +186,9 @@ describe 'qrcode replacing',->
expect(images[1].asText().length).to.be.within(17417,17440)
done()
docX[name]=docX[name]
.load(docX[name].loadedContent)
.setData({image:'examples/image'})
docX[name].attachModule(imageModule)
out=loadAndRender(docX[name], name, {image:'examples/image'})
docX[name]
.render()
describe 'should work with two',->
......@@ -223,14 +210,9 @@ describe 'qrcode replacing',->
expect(images[3].asText().length).to.be.within(7177,7181)
done()
docX[name]=docX[name]
.load(docX[name].loadedContent)
.setData({image:'examples/image',image2:'examples/image2.png'})
docX[name].attachModule(imageModule)
docX[name]
.render()
loadAndRender(docX[name], name, {image:'examples/image',image2:'examples/image2.png'})
describe 'should work qr in headers without extra images',->
it 'should work in a header too',(done)->
......@@ -249,14 +231,8 @@ describe 'qrcode replacing',->
expect(images[2].asText().length).to.be.within(17417,17440)
done()
docX[name]=docX[name]
.load(docX[name].loadedContent)
.setData({image:'examples/image',image2:'examples/image2.png'})
docX[name].attachModule(imageModule)
docX[name]
.render()
loadAndRender(docX[name], name, {image:'examples/image',image2:'examples/image2.png'})
describe 'should work qr in headers with extra images',->
it 'should work in a header too',(done)->
......@@ -276,11 +252,27 @@ describe 'qrcode replacing',->
expect(images[2].asText().length).to.be.within(17417,17440)
done()
docX[name]=docX[name]
.load(docX[name].loadedContent)
.setData({image:'examples/image',image2:'examples/image2.png'})
docX[name].attachModule(imageModule)
loadAndRender(docX[name], name, {image:'examples/image',image2:'examples/image2.png'})
describe 'should work with image after loop',->
it 'should work with image after loop',(done)->
name='imageAfterLoop.docx'
opts.qrCode = true
imageModule=new ImageModule(opts)
imageModule.finished=()->
zip=docX[name].getZip()
buffer=zip.generate({type:"nodebuffer"})
fs.writeFile("test_image_after_loop.docx",buffer)
images=zip.file(/media\/.*.png/)
expect(images.length).to.equal(2)
expect(images[0].asText().length).to.be.within(7177,7181)
expect(images[1].asText().length).to.be.within(7177,7181)
done()
docX[name].attachModule(imageModule)
docX[name]
.render()
loadAndRender(docX[name], name, {image:'examples/image2.png', above: [{cell1:'foo', cell2:'bar'}], below: "foo"})
var gulp = require('gulp');
var watch= require('gulp-watch');
var coffee= require('gulp-coffee');
var uglify= require('gulp-uglify');
var config={uglify:false}
var paths = {
coffee: ['coffee/subContent.coffee','coffee/docxQrCode.coffee','coffee/xmlUtil.coffee','coffee/docUtils.coffee','coffee/imgManager.coffee','coffee/imgReplacer.coffee','coffee/index.coffee'],
coffeeTest: ['coffee/test.coffee'],
testDirectory:__dirname+'/test',
js:'js/'
};
gulp.task('allCoffee', function () {
gulp.src(paths.coffee)
.pipe(coffee({bare:true}))
.pipe(gulp.dest(paths.js))
a=gulp.src(paths.coffeeTest)
.pipe(coffee({map:true}))
if(config.uglify)
a=a.pipe(uglify())
a=a
.pipe(gulp.dest(paths.testDirectory));
});
gulp.task('watch', function () {
gulp.src(paths.coffee)
.pipe(watch(function(files) {
var f=files.pipe(coffee({bare:true}))
.pipe(gulp.dest(paths.js))
return f;
}));
gulp.watch(paths.coffeeTest,['coffeeTest']);
});
gulp.task('coffeeTest', function() {
a=gulp.src(paths.coffeeTest)
.pipe(coffee({map:true}))
if(config.uglify)
a=a.pipe(uglify())
a=a
.pipe(gulp.dest(paths.testDirectory));
return a;
});
gulp.task('default',['coffeeTest','watch']);
{
"name": "docxtemplater-image-module",
"version": "1.0.0",
"dependencies": {
"abbrev": {
"version": "1.0.7",
"from": "abbrev@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.7.tgz"
},
"amdefine": {
"version": "1.0.0",
"from": "amdefine@>=0.0.4",
"resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.0.tgz"
},
"ansi-regex": {
"version": "2.0.0",
"from": "ansi-regex@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz"
},
"ansi-styles": {
"version": "2.1.0",
"from": "ansi-styles@>=2.1.0 <3.0.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.1.0.tgz"
},
"assertion-error": {
"version": "1.0.1",
"from": "assertion-error@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.1.tgz"
},
"babel-code-frame": {
"version": "6.3.13",
"from": "babel-code-frame@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.3.13.tgz",
"dependencies": {
"esutils": {
"version": "2.0.2",
"from": "esutils@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz"
},
"repeating": {
"version": "1.1.3",
"from": "repeating@>=1.1.3 <2.0.0",
"resolved": "https://registry.npmjs.org/repeating/-/repeating-1.1.3.tgz"
}
}
},
"babel-core": {
"version": "6.4.5",
"from": "babel-core@>=6.3.26 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.4.5.tgz",
"dependencies": {
"source-map": {
"version": "0.5.3",
"from": "source-map@>=0.5.0 <0.6.0",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.3.tgz"
}
}
},
"babel-generator": {
"version": "6.4.5",
"from": "babel-generator@>=6.4.5 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.4.5.tgz",
"dependencies": {
"detect-indent": {
"version": "3.0.1",
"from": "detect-indent@>=3.0.1 <4.0.0",
"resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-3.0.1.tgz"
},
"repeating": {
"version": "1.1.3",
"from": "repeating@>=1.1.3 <2.0.0",
"resolved": "https://registry.npmjs.org/repeating/-/repeating-1.1.3.tgz"
},
"source-map": {
"version": "0.5.3",
"from": "source-map@>=0.5.0 <0.6.0",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.3.tgz"
}
}
},
"babel-helper-call-delegate": {
"version": "6.3.13",
"from": "babel-helper-call-delegate@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.3.13.tgz"
},
"babel-helper-define-map": {
"version": "6.4.5",
"from": "babel-helper-define-map@>=6.4.5 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.4.5.tgz"
},
"babel-helper-function-name": {
"version": "6.4.0",
"from": "babel-helper-function-name@>=6.4.0 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.4.0.tgz"
},
"babel-helper-get-function-arity": {
"version": "6.3.13",
"from": "babel-helper-get-function-arity@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.3.13.tgz"
},
"babel-helper-hoist-variables": {
"version": "6.3.13",
"from": "babel-helper-hoist-variables@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.3.13.tgz"
},
"babel-helper-optimise-call-expression": {
"version": "6.3.13",
"from": "babel-helper-optimise-call-expression@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.3.13.tgz"
},
"babel-helper-regex": {
"version": "6.3.13",
"from": "babel-helper-regex@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.3.13.tgz"
},
"babel-helper-replace-supers": {
"version": "6.3.13",
"from": "babel-helper-replace-supers@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.3.13.tgz"
},
"babel-helpers": {
"version": "6.4.5",
"from": "babel-helpers@>=6.4.5 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.4.5.tgz"
},
"babel-messages": {
"version": "6.3.18",
"from": "babel-messages@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.3.18.tgz"
},
"babel-plugin-check-es2015-constants": {
"version": "6.3.13",
"from": "babel-plugin-check-es2015-constants@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.3.13.tgz"
},
"babel-plugin-syntax-async-functions": {
"version": "6.3.13",
"from": "babel-plugin-syntax-async-functions@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.3.13.tgz"
},
"babel-plugin-transform-es2015-arrow-functions": {
"version": "6.4.0",
"from": "babel-plugin-transform-es2015-arrow-functions@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.4.0.tgz"
},
"babel-plugin-transform-es2015-block-scoped-functions": {
"version": "6.3.13",
"from": "babel-plugin-transform-es2015-block-scoped-functions@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.3.13.tgz"
},
"babel-plugin-transform-es2015-block-scoping": {
"version": "6.4.0",
"from": "babel-plugin-transform-es2015-block-scoping@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.4.0.tgz"
},
"babel-plugin-transform-es2015-classes": {
"version": "6.4.5",
"from": "babel-plugin-transform-es2015-classes@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.4.5.tgz"
},
"babel-plugin-transform-es2015-computed-properties": {
"version": "6.4.0",
"from": "babel-plugin-transform-es2015-computed-properties@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.4.0.tgz"
},
"babel-plugin-transform-es2015-destructuring": {
"version": "6.4.0",
"from": "babel-plugin-transform-es2015-destructuring@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.4.0.tgz"
},
"babel-plugin-transform-es2015-for-of": {
"version": "6.3.13",
"from": "babel-plugin-transform-es2015-for-of@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.3.13.tgz"
},
"babel-plugin-transform-es2015-function-name": {
"version": "6.4.0",
"from": "babel-plugin-transform-es2015-function-name@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.4.0.tgz"
},
"babel-plugin-transform-es2015-literals": {
"version": "6.3.13",
"from": "babel-plugin-transform-es2015-literals@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.3.13.tgz"
},
"babel-plugin-transform-es2015-modules-commonjs": {
"version": "6.4.5",
"from": "babel-plugin-transform-es2015-modules-commonjs@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.4.5.tgz"
},
"babel-plugin-transform-es2015-object-super": {
"version": "6.4.0",
"from": "babel-plugin-transform-es2015-object-super@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.4.0.tgz"
},
"babel-plugin-transform-es2015-parameters": {
"version": "6.4.5",
"from": "babel-plugin-transform-es2015-parameters@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.4.5.tgz"
},
"babel-plugin-transform-es2015-shorthand-properties": {
"version": "6.3.13",
"from": "babel-plugin-transform-es2015-shorthand-properties@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.3.13.tgz"
},
"babel-plugin-transform-es2015-spread": {
"version": "6.4.0",
"from": "babel-plugin-transform-es2015-spread@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.4.0.tgz"
},
"babel-plugin-transform-es2015-sticky-regex": {
"version": "6.3.13",
"from": "babel-plugin-transform-es2015-sticky-regex@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.3.13.tgz"
},
"babel-plugin-transform-es2015-template-literals": {
"version": "6.3.13",
"from": "babel-plugin-transform-es2015-template-literals@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.3.13.tgz"
},
"babel-plugin-transform-es2015-typeof-symbol": {
"version": "6.4.3",
"from": "babel-plugin-transform-es2015-typeof-symbol@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.4.3.tgz"
},
"babel-plugin-transform-es2015-unicode-regex": {
"version": "6.4.3",
"from": "babel-plugin-transform-es2015-unicode-regex@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.4.3.tgz"
},
"babel-plugin-transform-regenerator": {
"version": "6.4.4",
"from": "babel-plugin-transform-regenerator@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.4.4.tgz"
},
"babel-plugin-transform-strict-mode": {
"version": "6.3.13",
"from": "babel-plugin-transform-strict-mode@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.3.13.tgz"
},
"babel-register": {
"version": "6.4.3",
"from": "babel-register@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.4.3.tgz"
},
"babel-runtime": {
"version": "5.8.35",
"from": "babel-runtime@>=5.0.0 <6.0.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-5.8.35.tgz"
},
"babel-template": {
"version": "6.3.13",
"from": "babel-template@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.3.13.tgz"
},
"babel-traverse": {
"version": "6.4.5",
"from": "babel-traverse@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.4.5.tgz",
"dependencies": {
"repeating": {
"version": "1.1.3",
"from": "repeating@>=1.1.3 <2.0.0",
"resolved": "https://registry.npmjs.org/repeating/-/repeating-1.1.3.tgz"
}
}
},
"babel-types": {
"version": "6.4.5",
"from": "babel-types@>=6.4.0 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.4.5.tgz",
"dependencies": {
"esutils": {
"version": "2.0.2",
"from": "esutils@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz"
}
}
},
"babylon": {
"version": "6.4.5",
"from": "babylon@>=6.3.13 <7.0.0",
"resolved": "https://registry.npmjs.org/babylon/-/babylon-6.4.5.tgz"
},
"balanced-match": {
"version": "0.3.0",
"from": "balanced-match@>=0.3.0 <0.4.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz"
},
"brace-expansion": {
"version": "1.1.2",
"from": "brace-expansion@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.2.tgz"
},
"chalk": {
"version": "1.1.1",
"from": "chalk@>=1.1.0 <2.0.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.1.tgz"
},
"coffee-script-redux": {
"version": "2.0.0-beta9-dev",
"from": "git+https://github.com/michaelficarra/CoffeeScriptRedux.git",
"resolved": "git+https://github.com/michaelficarra/CoffeeScriptRedux.git#ab93dc34c64cd11853fb8cb5a4f02c6b8fc3b26b"
},
"concat-map": {
"version": "0.0.1",
"from": "concat-map@0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
},
"convert-source-map": {
"version": "1.1.3",
"from": "convert-source-map@>=1.1.0 <2.0.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz"
},
"core-js": {
"version": "1.2.6",
"from": "core-js@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.6.tgz"
},
"cscodegen": {
"version": "0.1.0",
"from": "git+https://github.com/michaelficarra/cscodegen.git#73fd7202ac086c26f18c9d56f025b18b3c6f5383",
"resolved": "git+https://github.com/michaelficarra/cscodegen.git#73fd7202ac086c26f18c9d56f025b18b3c6f5383"
},
"debug": {
"version": "2.2.0",
"from": "debug@>=2.2.0 <3.0.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz"
},
"decaffeinate": {
"version": "1.44.12",
"from": "decaffeinate@>=1.44.12 <2.0.0",
"resolved": "https://registry.npmjs.org/decaffeinate/-/decaffeinate-1.44.12.tgz"
},
"deep-eql": {
"version": "0.1.3",
"from": "deep-eql@>=0.1.3 <0.2.0",
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz",
"dependencies": {
"type-detect": {
"version": "0.1.1",
"from": "type-detect@0.1.1",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz"
}
}
},
"deep-is": {
"version": "0.1.3",
"from": "deep-is@>=0.1.2 <0.2.0",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz"
},
"detect-indent": {
"version": "4.0.0",
"from": "detect-indent@>=4.0.0 <5.0.0",
"resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz"
},
"docxtemplater": {
"version": "2.0.0",
"from": "docxtemplater@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/docxtemplater/-/docxtemplater-2.0.0.tgz"
},
"escape-string-regexp": {
"version": "1.0.4",
"from": "escape-string-regexp@>=1.0.2 <2.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.4.tgz"
},
"escodegen": {
"version": "1.2.0",
"from": "escodegen@>=1.2.0 <1.3.0",
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.2.0.tgz"
},
"escope": {
"version": "1.0.3",
"from": "escope@>=1.0.1 <1.1.0",
"resolved": "https://registry.npmjs.org/escope/-/escope-1.0.3.tgz",
"dependencies": {
"estraverse": {
"version": "2.0.0",
"from": "estraverse@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-2.0.0.tgz"
}
}
},
"esmangle": {
"version": "1.0.1",
"from": "esmangle@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/esmangle/-/esmangle-1.0.1.tgz",
"dependencies": {
"escodegen": {
"version": "1.3.3",
"from": "escodegen@>=1.3.2 <1.4.0",
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.3.3.tgz"
},
"esprima": {
"version": "1.1.1",
"from": "esprima@>=1.1.1 <1.2.0",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-1.1.1.tgz"
}
}
},
"esprima": {
"version": "1.0.4",
"from": "esprima@>=1.0.4 <1.1.0",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz"
},
"esshorten": {
"version": "1.1.1",
"from": "esshorten@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/esshorten/-/esshorten-1.1.1.tgz",
"dependencies": {
"estraverse": {
"version": "4.1.1",
"from": "estraverse@>=4.1.1 <4.2.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.1.1.tgz"
},
"esutils": {
"version": "2.0.2",
"from": "esutils@>=2.0.2 <2.1.0",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz"
}
}
},
"estraverse": {
"version": "1.5.1",
"from": "estraverse@>=1.5.0 <1.6.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.5.1.tgz"
},
"esutils": {
"version": "1.0.0",
"from": "esutils@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-1.0.0.tgz"
},
"fast-levenshtein": {
"version": "1.0.7",
"from": "fast-levenshtein@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-1.0.7.tgz"
},
"get-stdin": {
"version": "4.0.1",
"from": "get-stdin@>=4.0.1 <5.0.0",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz"
},
"globals": {
"version": "8.18.0",
"from": "globals@>=8.3.0 <9.0.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-8.18.0.tgz"
},
"has-ansi": {
"version": "2.0.0",
"from": "has-ansi@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz"
},
"home-or-tmp": {
"version": "1.0.0",
"from": "home-or-tmp@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-1.0.0.tgz"
},
"invariant": {
"version": "2.2.0",
"from": "invariant@>=2.2.0 <3.0.0",
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.0.tgz"
},
"is-finite": {
"version": "1.0.1",
"from": "is-finite@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.1.tgz"
},
"is-integer": {
"version": "1.0.6",
"from": "is-integer@>=1.0.4 <2.0.0",
"resolved": "https://registry.npmjs.org/is-integer/-/is-integer-1.0.6.tgz"
},
"js-tokens": {
"version": "1.0.2",
"from": "js-tokens@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-1.0.2.tgz"
},
"jsesc": {
"version": "0.5.0",
"from": "jsesc@>=0.5.0 <0.6.0",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz"
},
"json5": {
"version": "0.4.0",
"from": "json5@>=0.4.0 <0.5.0",
"resolved": "https://registry.npmjs.org/json5/-/json5-0.4.0.tgz"
},
"jszip": {
"version": "2.5.0",
"from": "jszip@>=2.4.0 <3.0.0",
"resolved": "https://registry.npmjs.org/jszip/-/jszip-2.5.0.tgz"
},
"left-pad": {
"version": "0.0.3",
"from": "left-pad@0.0.3",
"resolved": "https://registry.npmjs.org/left-pad/-/left-pad-0.0.3.tgz"
},
"levn": {
"version": "0.2.5",
"from": "levn@>=0.2.4 <0.3.0",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.2.5.tgz"
},
"line-numbers": {
"version": "0.2.0",
"from": "line-numbers@>=0.2.0 <0.3.0",
"resolved": "https://registry.npmjs.org/line-numbers/-/line-numbers-0.2.0.tgz"
},
"lodash": {
"version": "3.10.1",
"from": "lodash@>=3.10.0 <4.0.0",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz"
},
"loose-envify": {
"version": "1.1.0",
"from": "loose-envify@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.1.0.tgz"
},
"magic-string": {
"version": "0.10.2",
"from": "magic-string@>=0.10.2 <0.11.0",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.10.2.tgz"
},
"minimatch": {
"version": "2.0.10",
"from": "minimatch@>=2.0.3 <3.0.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz"
},
"minimist": {
"version": "1.2.0",
"from": "minimist@>=1.1.0 <2.0.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz"
},
"mkdirp": {
"version": "0.5.1",
"from": "mkdirp@>=0.5.1 <0.6.0",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"dependencies": {
"minimist": {
"version": "0.0.8",
"from": "minimist@0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz"
}
}
},
"ms": {
"version": "0.7.1",
"from": "ms@0.7.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz"
},
"nopt": {
"version": "2.1.2",
"from": "nopt@>=2.1.2 <2.2.0",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-2.1.2.tgz"
},
"number-is-nan": {
"version": "1.0.0",
"from": "number-is-nan@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.0.tgz"
},
"optionator": {
"version": "0.3.0",
"from": "optionator@>=0.3.0 <0.4.0",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.3.0.tgz"
},
"os-tmpdir": {
"version": "1.0.1",
"from": "os-tmpdir@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.1.tgz"
},
"pako": {
"version": "0.2.8",
"from": "pako@>=0.2.5 <0.3.0",
"resolved": "https://registry.npmjs.org/pako/-/pako-0.2.8.tgz"
},
"path-exists": {
"version": "1.0.0",
"from": "path-exists@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-1.0.0.tgz"
},
"path-is-absolute": {
"version": "1.0.0",
"from": "path-is-absolute@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz"
},
"png-js": {
"version": "0.1.1",
"from": "png-js@>=0.1.1 <0.2.0",
"resolved": "https://registry.npmjs.org/png-js/-/png-js-0.1.1.tgz"
},
"prelude-ls": {
"version": "1.1.2",
"from": "prelude-ls@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz"
},
"private": {
"version": "0.1.6",
"from": "private@>=0.1.5 <0.2.0",
"resolved": "https://registry.npmjs.org/private/-/private-0.1.6.tgz"
},
"qrcode-reader": {
"version": "0.0.7",
"from": "qrcode-reader@0.0.7",
"resolved": "https://registry.npmjs.org/qrcode-reader/-/qrcode-reader-0.0.7.tgz"
},
"regenerate": {
"version": "1.2.1",
"from": "regenerate@>=1.2.1 <2.0.0",
"resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.2.1.tgz"
},
"regexpu-core": {
"version": "1.0.0",
"from": "regexpu-core@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz"
},
"regjsgen": {
"version": "0.2.0",
"from": "regjsgen@>=0.2.0 <0.3.0",
"resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz"
},
"regjsparser": {
"version": "0.1.5",
"from": "regjsparser@>=0.1.4 <0.2.0",
"resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz"
},
"repeating": {
"version": "2.0.0",
"from": "repeating@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.0.tgz"
},
"shebang-regex": {
"version": "1.0.0",
"from": "shebang-regex@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz"
},
"slash": {
"version": "1.0.0",
"from": "slash@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz"
},
"source-map": {
"version": "0.1.43",
"from": "source-map@>=0.1.0 <0.2.0",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz"
},
"source-map-support": {
"version": "0.2.10",
"from": "source-map-support@>=0.2.10 <0.3.0",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.2.10.tgz",
"dependencies": {
"source-map": {
"version": "0.1.32",
"from": "source-map@0.1.32",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.32.tgz"
}
}
},
"StringScanner": {
"version": "0.0.3",
"from": "StringScanner@>=0.0.3 <0.1.0",
"resolved": "https://registry.npmjs.org/StringScanner/-/StringScanner-0.0.3.tgz"
},
"strip-ansi": {
"version": "3.0.0",
"from": "strip-ansi@>=3.0.0 <4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.0.tgz"
},
"supports-color": {
"version": "2.0.0",
"from": "supports-color@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz"
},
"to-fast-properties": {
"version": "1.0.1",
"from": "to-fast-properties@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.1.tgz"
},
"trim-right": {
"version": "1.0.1",
"from": "trim-right@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz"
},
"type-check": {
"version": "0.3.2",
"from": "type-check@>=0.3.1 <0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz"
},
"type-detect": {
"version": "1.0.0",
"from": "type-detect@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-1.0.0.tgz"
},
"user-home": {
"version": "1.1.1",
"from": "user-home@>=1.1.1 <2.0.0",
"resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz"
},
"vlq": {
"version": "0.2.1",
"from": "vlq@>=0.2.1 <0.3.0",
"resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.1.tgz"
},
"wordwrap": {
"version": "0.0.3",
"from": "wordwrap@>=0.0.2 <0.1.0",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz"
},
"xmldom": {
"version": "0.1.19",
"from": "xmldom@0.1.19",
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.19.tgz"
}
}
}
......@@ -4,15 +4,17 @@
"description": "Image Module for docxtemplater v1.0",
"main": "js/index.js",
"scripts": {
"test": "mocha"
"convertto:es6": "rm es6 -rf; mkdir -p es6; for i in coffee/*.coffee; do echo \"$i\"; decaffeinate \"$i\"; mv \"${i%.coffee}.js\" \"${i%.coffee}.es6\"; done; for i in coffee/*.es6; do mv \"$i\" \"es6${i#coffee}\"; done ",
"convertto:es5": "rm js -rf ; mkdir -p test/spec; mkdir -p js; babel es6 --out-dir js; mv js/test.js test/test.js",
"test:compiled": "mocha",
"test": "npm run convertto:es6 && npm run convertto:es5 && npm run test:compiled"
},
"devDependencies": {
"chai": "^1.10.0",
"gulp": "~3.8.0",
"gulp-coffee": "~2.0.1",
"gulp-uglify": "~0.3.0",
"gulp-browserify": "^0.5.0",
"gulp-watch": "~0.6.5"
"babel-preset-es2015": "^6.3.13",
"chai": "^3.4.1",
"docxtemplater": "^2.0.0",
"eslint": "^1.10.3",
"mocha": "^2.4.5"
},
"repository": {
"type": "git",
......@@ -21,10 +23,11 @@
"author": "Edgar Hipp",
"license": "MIT",
"dependencies": {
"docxtemplater": "^1.0.8",
"decaffeinate": "^1.44.12",
"docxtemplater": "^2.0.0",
"jszip": "^2.4.0",
"png-js": "^0.1.1",
"qrcode-reader": "0.0.5",
"xmldom": "^0.1.19"
"qrcode-reader": "0.0.7",
"xmldom": "0.1.19"
}
}
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