Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
docxtemplater-image-module
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
npm
docxtemplater-image-module
Commits
1f4b0ff5
Commit
1f4b0ff5
authored
Dec 02, 2014
by
Edgar Hipp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added SubContent file
parent
436b42ac
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
coffee/index.coffee
+1
-1
coffee/subContent.coffee
+25
-0
gulpfile.js
+1
-1
No files found.
coffee/index.coffee
View file @
1f4b0ff5
SubContent
=
require
(
'.
./node_modules/docxtemplater/js/subContent.js
'
)
SubContent
=
require
(
'.
/subContent
'
)
ImgManager
=
require
(
'./imgManager'
)
fs
=
require
(
'fs'
)
...
...
coffee/subContent.coffee
0 → 100644
View file @
1f4b0ff5
#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
()
gulpfile.js
View file @
1f4b0ff5
...
...
@@ -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/'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment