Commit 1f4b0ff5 by Edgar Hipp

added SubContent file

parent 436b42ac
SubContent=require('../node_modules/docxtemplater/js/subContent.js')
SubContent=require('./subContent')
ImgManager=require('./imgManager')
fs=require('fs')
......
#This class responsibility is to deal with parts of the document
module.exports=class SubContent
constructor:(@fullText="")->
@text=""
@start=0
@end=0
getInnerTag:(templaterState)->
@start=templaterState.calcPosition(templaterState.tagStart)
@end=templaterState.calcPosition(templaterState.tagEnd)+1
@refreshText()
refreshText:()->
@text=@fullText.substr(@start,@end-@start)
this
getOuterXml:(xmlTag)->
@end= @fullText.indexOf('</'+xmlTag+'>',@end)
if @end==-1 then throw new Error("can't find endTag #{@end}")
@end+=('</'+xmlTag+'>').length
@start = Math.max @fullText.lastIndexOf('<'+xmlTag+'>',@start), @fullText.lastIndexOf('<'+xmlTag+' ',@start)
if @start==-1 then throw new Error("can't find startTag")
@refreshText()
replace:(newText)->
@fullText=@fullText.substr(0,@start)+newText+@fullText.substr(@end)
@end=@start+newText.length
@refreshText()
......@@ -11,7 +11,7 @@ var server=null;
var config={uglify:false}
var paths = {
coffee: ['coffee/docxQrCode.coffee','coffee/xmlUtil.coffee','coffee/docUtils.coffee','coffee/imgManager.coffee','coffee/imgReplacer.coffee','coffee/index.coffee'],
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/'
......
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