Skip to content

Commit 77a0e00

Browse files
committed
feat: add text and emphasis transformers - accordproject#397
Declares OOXML as instance variable Signed-off-by: k-kumar-01 <[email protected]>
1 parent f875a96 commit 77a0e00

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

packages/markdown-docx/src/CiceroMarkToOOXMLTransformer.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,19 @@ const definedNodes = {
3030
emphasize: 'org.accordproject.commonmark.Emph',
3131
};
3232

33-
let globalOOXML = '';
34-
3533
/**
3634
* Transforms the ciceromark to OOXML
3735
*/
3836
class CiceroMarkToOOXMLTransfomer {
3937

38+
39+
/**
40+
* Declares the OOXML variable
41+
*/
42+
constructor() {
43+
this.globalOOXML = '';
44+
}
45+
4046
/**
4147
* Gets the class of a given CiceroMark node.
4248
*
@@ -77,7 +83,7 @@ class CiceroMarkToOOXMLTransfomer {
7783
node.nodes.forEach(subNode => {
7884
ooxml += this.getNodes(subNode, counter,);
7985
});
80-
globalOOXML = `${globalOOXML}<w:p>${ooxml}</w:p>`;
86+
this.globalOOXML = `${this.globalOOXML}<w:p>${ooxml}</w:p>`;
8187
}
8288
return '';
8389
}
@@ -91,12 +97,12 @@ class CiceroMarkToOOXMLTransfomer {
9197
* @returns {string} Converted OOXML string i.e. CicecoMark->OOXML
9298
*/
9399
toOOXML(ciceromark, counter, ooxml = '') {
94-
globalOOXML = ooxml;
100+
this.globalOOXML = ooxml;
95101
ciceromark.nodes.forEach(node => {
96102
this.getNodes(node, counter);
97103
});
98-
globalOOXML = wrapAroundDefaultDocxTags(globalOOXML);
99-
return globalOOXML;
104+
this.globalOOXML = wrapAroundDefaultDocxTags(this.globalOOXML);
105+
return this.globalOOXML;
100106
}
101107
}
102108

0 commit comments

Comments
 (0)