Skip to content

Commit b281a57

Browse files
committed
small refactoring
1 parent 9752841 commit b281a57

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

coffee/docUtils.coffee

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ DocUtils.defaultParser=(tag) ->
3939
if tag=='.' then return scope else return scope[tag]
4040
}
4141

42-
DocUtils.nl2br = (str,is_xhtml) ->
43-
(str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + '<br>' + '$2');
44-
4542
DocUtils.loadDoc= (path,options={}) ->
4643
noDocx= if options.docx? then !options.docx else false
4744
async=if options.async? then options.async else false
@@ -198,8 +195,7 @@ DocUtils.clone = (obj) ->
198195

199196
DocUtils.xml2Str = (xmlNode) ->
200197
a= new XMLSerializer()
201-
content= a.serializeToString(xmlNode)
202-
content.replace /\x20xmlns=""/g, '' #remove all added xmlns="" (these cause the file to be corrupt and was a problem for firefox)
198+
a.serializeToString(xmlNode)
203199

204200
DocUtils.Str2xml= (str,errorHandler) ->
205201
parser=new DOMParser({errorHandler})

coffee/docxgen.coffee

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ module.exports=class DocxGen
1818
@qrCodeNumCallBack=0 #This is the order of the qrcode
1919
@qrCodeWaitingFor= [] #The templater waits till all the qrcodes are decoded, This is the list of the remaining qrcodes to decode (only their order in the document is stored)
2020
if content? then if content.length>0 then @load(content)
21-
setOptions:(@options)->
22-
if @options?
23-
@intelligentTagging= if @options.intelligentTagging? then @options.intelligentTagging else on
24-
@qrCode= if @options.qrCode? then @options.qrCode else off
25-
if @qrCode==true then @qrCode=DocUtils.unsecureQrCode
26-
if @options.parser? then @parser=options.parser
21+
setOptions:(@options={})->
22+
@intelligentTagging= if @options.intelligentTagging? then @options.intelligentTagging else on
23+
@qrCode= if @options.qrCode? then @options.qrCode else off
24+
if @qrCode==true then @qrCode=DocUtils.unsecureQrCode
25+
if @options.parser? then @parser=options.parser
2726
this
2827
loadFromFile:(path,options={})->
2928
@setOptions(options)
@@ -79,7 +78,6 @@ module.exports=class DocxGen
7978
#When all files have been processed, check if the document is ready
8079
@testReady()
8180
setData:(fileName,data,options={})->
82-
@zip.remove(fileName)
8381
@zip.file(fileName,data,options)
8482
getTags:()->
8583
usedTags=[]

0 commit comments

Comments
 (0)