Skip to content

Commit

Permalink
feat: add text and emphasis transformers - accordproject#397
Browse files Browse the repository at this point in the history
Declares OOXML as instance variable

Signed-off-by: k-kumar-01 <[email protected]>
  • Loading branch information
K-Kumar-01 committed Jun 11, 2021
1 parent f875a96 commit 77a0e00
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/markdown-docx/src/CiceroMarkToOOXMLTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,19 @@ const definedNodes = {
emphasize: 'org.accordproject.commonmark.Emph',
};

let globalOOXML = '';

/**
* Transforms the ciceromark to OOXML
*/
class CiceroMarkToOOXMLTransfomer {


/**
* Declares the OOXML variable
*/
constructor() {
this.globalOOXML = '';
}

/**
* Gets the class of a given CiceroMark node.
*
Expand Down Expand Up @@ -77,7 +83,7 @@ class CiceroMarkToOOXMLTransfomer {
node.nodes.forEach(subNode => {
ooxml += this.getNodes(subNode, counter,);
});
globalOOXML = `${globalOOXML}<w:p>${ooxml}</w:p>`;
this.globalOOXML = `${this.globalOOXML}<w:p>${ooxml}</w:p>`;
}
return '';
}
Expand All @@ -91,12 +97,12 @@ class CiceroMarkToOOXMLTransfomer {
* @returns {string} Converted OOXML string i.e. CicecoMark->OOXML
*/
toOOXML(ciceromark, counter, ooxml = '') {
globalOOXML = ooxml;
this.globalOOXML = ooxml;
ciceromark.nodes.forEach(node => {
this.getNodes(node, counter);
});
globalOOXML = wrapAroundDefaultDocxTags(globalOOXML);
return globalOOXML;
this.globalOOXML = wrapAroundDefaultDocxTags(this.globalOOXML);
return this.globalOOXML;
}
}

Expand Down

0 comments on commit 77a0e00

Please sign in to comment.