diff --git a/packages/markdown-cli/test/cli.js b/packages/markdown-cli/test/cli.js
index 5f88a6f8..86f747cc 100644
--- a/packages/markdown-cli/test/cli.js
+++ b/packages/markdown-cli/test/cli.js
@@ -148,3 +148,21 @@ describe('markdown-cli (docx)', () => {
});
});
});
+
+describe('markdown-cli (ooxml)', () => {
+ // Omitted Acceptance test
+ const inputOOXMLFile = path.resolve(__dirname, 'data/acceptance', 'omitted-acceptance-of-delivery.xml');
+ const inputCiceroMarkFile = path.resolve(__dirname, 'data/acceptance', 'omitted-acceptance-of-delivery.json');
+
+ describe('#parse', () => {
+ it('should roundtrip ooxml <-> ciceromark_parsed ', async () => {
+ const result = await Commands.transform(inputOOXMLFile, 'ooxml', [], 'ciceromark_parsed', null, {}, { roundtrip: true });
+ result.should.equal(fs.readFileSync(inputOOXMLFile, 'utf-8'));
+ });
+ it('should roundtrip ciceromark_parsed <-> ooxml', async () => {
+ const result = await Commands.transform(inputCiceroMarkFile, 'ciceromark_parsed', [], 'ooxml', null, {}, { roundtrip: true });
+ JSON.parse(result).should.deep.eql(JSON.parse(fs.readFileSync(inputCiceroMarkFile, 'utf-8')));
+ });
+ });
+});
+
diff --git a/packages/markdown-cli/test/data/acceptance/omitted-acceptance-of-delivery.json b/packages/markdown-cli/test/data/acceptance/omitted-acceptance-of-delivery.json
new file mode 100644
index 00000000..fd1883c1
--- /dev/null
+++ b/packages/markdown-cli/test/data/acceptance/omitted-acceptance-of-delivery.json
@@ -0,0 +1 @@
+{"$class":"org.accordproject.commonmark.Document","xmlns":"http://commonmark.org/xml/1.0","nodes":[{"$class":"org.accordproject.commonmark.Heading","level":"2","nodes":[{"$class":"org.accordproject.commonmark.Text","text":"Acceptance of Delivery."}]},{"$class":"org.accordproject.commonmark.Paragraph","nodes":[{"$class":"org.accordproject.ciceromark.Variable","value":"\"Party A\"","name":"shipper","elementType":"org.accordproject.organization.Organization"},{"$class":"org.accordproject.commonmark.Text","text":" will be deemed to have completed its delivery obligations"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.commonmark.Text","text":"if in "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Party B\"","name":"receiver","elementType":"org.accordproject.organization.Organization"},{"$class":"org.accordproject.commonmark.Text","text":"'s opinion, the "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Widgets\"","name":"deliverable","elementType":"String"},{"$class":"org.accordproject.commonmark.Text","text":" satisfies the"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.commonmark.Text","text":"Acceptance Criteria, and "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Party B\"","name":"receiver","elementType":"org.accordproject.organization.Organization"},{"$class":"org.accordproject.commonmark.Text","text":" notifies "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Party A\"","name":"shipper","elementType":"org.accordproject.organization.Organization"},{"$class":"org.accordproject.commonmark.Text","text":" in writing"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.commonmark.Text","text":"that it is accepting the "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Widgets\"","name":"deliverable","elementType":"String"},{"$class":"org.accordproject.commonmark.Text","text":"."}]},{"$class":"org.accordproject.commonmark.Heading","level":"2","nodes":[{"$class":"org.accordproject.commonmark.Text","text":"Inspection and Notice."}]},{"$class":"org.accordproject.commonmark.Paragraph","nodes":[{"$class":"org.accordproject.ciceromark.Variable","value":"\"Party B\"","name":"receiver","elementType":"org.accordproject.organization.Organization"},{"$class":"org.accordproject.commonmark.Text","text":" will have "},{"$class":"org.accordproject.ciceromark.Variable","value":"10","name":"businessDays","elementType":"Long"},{"$class":"org.accordproject.commonmark.Text","text":" Business Days to inspect and"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.commonmark.Text","text":"evaluate the "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Widgets\"","name":"deliverable","elementType":"String"},{"$class":"org.accordproject.commonmark.Text","text":" on the delivery date before notifying"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Party A\"","name":"shipper","elementType":"org.accordproject.organization.Organization"},{"$class":"org.accordproject.commonmark.Text","text":" that it is either accepting or rejecting the"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Widgets\"","name":"deliverable","elementType":"String"},{"$class":"org.accordproject.commonmark.Text","text":"."}]},{"$class":"org.accordproject.commonmark.Heading","level":"2","nodes":[{"$class":"org.accordproject.commonmark.Text","text":"Acceptance Criteria."}]},{"$class":"org.accordproject.commonmark.Paragraph","nodes":[{"$class":"org.accordproject.commonmark.Text","text":"The \"Acceptance Criteria\" are the specifications the "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Widgets\"","name":"deliverable","elementType":"String"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.commonmark.Text","text":"must meet for the "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Party A\"","name":"shipper","elementType":"org.accordproject.organization.Organization"},{"$class":"org.accordproject.commonmark.Text","text":" to comply with its requirements and"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.commonmark.Text","text":"obligations under this agreement, detailed in "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Attachment X\"","name":"attachment","elementType":"String"},{"$class":"org.accordproject.commonmark.Text","text":", attached"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.commonmark.Text","text":"to this agreement."}]}]}
\ No newline at end of file
diff --git a/packages/markdown-cli/test/data/acceptance/omitted-acceptance-of-delivery.xml b/packages/markdown-cli/test/data/acceptance/omitted-acceptance-of-delivery.xml
new file mode 100644
index 00000000..43be0550
--- /dev/null
+++ b/packages/markdown-cli/test/data/acceptance/omitted-acceptance-of-delivery.xml
@@ -0,0 +1,681 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Acceptance of Delivery.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Party A"
+
+
+
+
+
+
+
+ will be deemed to have completed its delivery obligations
+
+
+
+
+
+
+
+
+
+ if in
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Party B"
+
+
+
+
+
+
+
+ 's opinion, the
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Widgets"
+
+
+
+
+
+
+
+ satisfies the
+
+
+
+
+
+
+
+
+
+ Acceptance Criteria, and
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Party B"
+
+
+
+
+
+
+
+ notifies
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Party A"
+
+
+
+
+
+
+
+ in writing
+
+
+
+
+
+
+
+
+
+ that it is accepting the
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Widgets"
+
+
+
+
+
+
+
+ .
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inspection and Notice.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Party B"
+
+
+
+
+
+
+
+ will have
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 10
+
+
+
+
+
+
+
+ Business Days to inspect and
+
+
+
+
+
+
+
+
+
+ evaluate the
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Widgets"
+
+
+
+
+
+
+
+ on the delivery date before notifying
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Party A"
+
+
+
+
+
+
+
+ that it is either accepting or rejecting the
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Widgets"
+
+
+
+
+
+
+
+ .
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Acceptance Criteria.
+
+
+
+
+
+
+
+
+
+ The "Acceptance Criteria" are the specifications the
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Widgets"
+
+
+
+
+
+
+
+
+
+
+
+ must meet for the
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Party A"
+
+
+
+
+
+
+
+ to comply with its requirements and
+
+
+
+
+
+
+
+
+
+ obligations under this agreement, detailed in
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Attachment X"
+
+
+
+
+
+
+
+ , attached
+
+
+
+
+
+
+
+
+
+ to this agreement.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/markdown-docx/src/ToCiceroMarkVisitor.js b/packages/markdown-docx/src/ToCiceroMarkVisitor.js
index 997c8932..a179a3d4 100644
--- a/packages/markdown-docx/src/ToCiceroMarkVisitor.js
+++ b/packages/markdown-docx/src/ToCiceroMarkVisitor.js
@@ -83,6 +83,35 @@ class ToCiceroMarkVisitor {
}
}
+ /**
+ * Checks if the node is a thematic break or not
+ *
+ * @param {Array} paragraphProperties paragraph styling properties
+ * @returns {boolean} true if the node is of type thematic break or else, false
+ */
+ checkThematicBreakProperties(paragraphProperties) {
+ if (!paragraphProperties) {
+ return false;
+ }
+
+ let isBorderPresent = false;
+
+ for (const property of paragraphProperties) {
+ if (property.name === 'w:pBdr') {
+ for (const subProperty of property.elements) {
+ if (subProperty.name === 'w:bottom') {
+ const attributes = subProperty.attributes;
+ if (attributes['w:val'] === 'single' && attributes['w:sz'] === '6') {
+ isBorderPresent = true;
+ }
+ }
+ }
+ }
+ }
+
+ return isBorderPresent;
+ }
+
/**
* Constructs a ciceroMark Node for inline element from the information.
*
@@ -234,14 +263,26 @@ class ToCiceroMarkVisitor {
traverseElements(node, parent = '') {
for (const subNode of node) {
if (subNode.name === 'w:p') {
+ if (!subNode.elements) {
+ continue;
+ }
+
const { isHeading, level } = this.getHeading(
- subNode.elements && subNode.elements[0].elements && subNode.elements[0].elements[0]
+ subNode.elements[0].elements && subNode.elements[0].elements[0]
);
- if (subNode.elements) {
- this.traverseElements(subNode.elements);
+ const isThematicBreak = this.checkThematicBreakProperties(subNode.elements[0].elements);
+
+ if (isThematicBreak) {
+ const thematicBreakNode = {
+ $class: TRANSFORMED_NODES.thematicBreak,
+ };
+ this.nodes = [...this.nodes, thematicBreakNode];
+ continue;
}
+ this.traverseElements(subNode.elements);
+
if (isHeading) {
let headingNode = {
$class: TRANSFORMED_NODES.heading,
diff --git a/packages/markdown-docx/src/ToOOXMLVisitor/index.js b/packages/markdown-docx/src/ToOOXMLVisitor/index.js
index 21b69a98..8b52a4a6 100644
--- a/packages/markdown-docx/src/ToOOXMLVisitor/index.js
+++ b/packages/markdown-docx/src/ToOOXMLVisitor/index.js
@@ -25,6 +25,7 @@ const {
SOFTBREAK_RULE,
STRONG_RULE,
CODE_PROPERTIES_RULE,
+ THEMATICBREAK_RULE,
} = require('./rules');
const { wrapAroundDefaultDocxTags } = require('./helpers');
const { TRANSFORMED_NODES } = require('../constants');
@@ -121,6 +122,8 @@ class ToOOXMLVisitor {
this.tags = [...this.tags, VARIABLE_RULE(title, tag, value, type)];
} else if (this.getClass(subNode) === TRANSFORMED_NODES.softbreak) {
this.tags = [...this.tags, SOFTBREAK_RULE()];
+ } else if(this.getClass(subNode) === TRANSFORMED_NODES.thematicBreak){
+ this.globalOOXML += THEMATICBREAK_RULE();
} else {
if (subNode.nodes) {
if (this.getClass(subNode) === TRANSFORMED_NODES.paragraph) {
@@ -163,13 +166,13 @@ class ToOOXMLVisitor {
* Transforms the given CiceroMark JSON to OOXML
*
* @param {Object} ciceromark CiceroMark JSON to be converted
- * @returns {object} { Converted OOXML string i.e. CiceroMark->OOXML, Frequency of variables }
+ * @returns {string} OOXML string
*/
toOOXML(ciceromark) {
this.traverseNodes(ciceromark, []);
this.globalOOXML = wrapAroundDefaultDocxTags(this.globalOOXML);
- return { ooxml: this.globalOOXML, counter: this.counter };
+ return this.globalOOXML;
}
}
diff --git a/packages/markdown-docx/src/ToOOXMLVisitor/rules.js b/packages/markdown-docx/src/ToOOXMLVisitor/rules.js
index dbc22ea4..919e18c3 100644
--- a/packages/markdown-docx/src/ToOOXMLVisitor/rules.js
+++ b/packages/markdown-docx/src/ToOOXMLVisitor/rules.js
@@ -169,6 +169,23 @@ const CODE_PROPERTIES_RULE = () => {
`;
};
+const LINEBREAK_RULE = () => {
+ return '';
+};
+
+const THEMATICBREAK_RULE = () => {
+ return `
+
+
+
+
+
+
+
+ ${LINEBREAK_RULE()}
+ `;
+};
+
module.exports = {
TEXT_RULE,
EMPHASIS_RULE,
@@ -179,5 +196,6 @@ module.exports = {
VARIABLE_RULE,
SOFTBREAK_RULE,
STRONG_RULE,
- CODE_PROPERTIES_RULE
+ CODE_PROPERTIES_RULE,
+ THEMATICBREAK_RULE,
};
diff --git a/packages/markdown-docx/src/constants.js b/packages/markdown-docx/src/constants.js
index fd2d48b1..84666929 100644
--- a/packages/markdown-docx/src/constants.js
+++ b/packages/markdown-docx/src/constants.js
@@ -28,6 +28,7 @@ const TRANSFORMED_NODES = {
softbreak: `${NS_PREFIX_CommonMarkModel}Softbreak`,
strong: `${NS_PREFIX_CommonMarkModel}Strong`,
text: `${NS_PREFIX_CommonMarkModel}Text`,
+ thematicBreak: `${NS_PREFIX_CommonMarkModel}ThematicBreak`,
variable: `${NS_PREFIX_CiceroMarkModel}Variable`,
};
diff --git a/packages/markdown-docx/test/data/ciceroMark/alternate-thematic-break.json b/packages/markdown-docx/test/data/ciceroMark/alternate-thematic-break.json
new file mode 100644
index 00000000..60e7f90b
--- /dev/null
+++ b/packages/markdown-docx/test/data/ciceroMark/alternate-thematic-break.json
@@ -0,0 +1 @@
+{"$class":"org.accordproject.commonmark.Document","xmlns":"http://commonmark.org/xml/1.0","nodes":[{"$class":"org.accordproject.commonmark.Paragraph","nodes":[{"$class":"org.accordproject.commonmark.Text","text":"First paragraph"}]},{"$class":"org.accordproject.commonmark.ThematicBreak"},{"$class":"org.accordproject.commonmark.Paragraph","nodes":[{"$class":"org.accordproject.commonmark.Text","text":"Second paragraph"}]},{"$class":"org.accordproject.commonmark.ThematicBreak"},{"$class":"org.accordproject.commonmark.Paragraph","nodes":[{"$class":"org.accordproject.commonmark.Text","text":"Third paragraph"}]}]}
\ No newline at end of file
diff --git a/packages/markdown-docx/test/data/ciceroMark/continuous-thematic-break.json b/packages/markdown-docx/test/data/ciceroMark/continuous-thematic-break.json
new file mode 100644
index 00000000..c3033820
--- /dev/null
+++ b/packages/markdown-docx/test/data/ciceroMark/continuous-thematic-break.json
@@ -0,0 +1 @@
+{"$class":"org.accordproject.commonmark.Document","xmlns":"http://commonmark.org/xml/1.0","nodes":[{"$class":"org.accordproject.commonmark.Paragraph","nodes":[{"$class":"org.accordproject.commonmark.Text","text":"First paragraph"}]},{"$class":"org.accordproject.commonmark.ThematicBreak"},{"$class":"org.accordproject.commonmark.ThematicBreak"},{"$class":"org.accordproject.commonmark.Paragraph","nodes":[{"$class":"org.accordproject.commonmark.Text","text":"Third paragraph"}]}]}
\ No newline at end of file
diff --git a/packages/markdown-docx/test/data/ciceroMark/thematic-break.json b/packages/markdown-docx/test/data/ciceroMark/thematic-break.json
new file mode 100644
index 00000000..b27fc62c
--- /dev/null
+++ b/packages/markdown-docx/test/data/ciceroMark/thematic-break.json
@@ -0,0 +1 @@
+{"$class":"org.accordproject.commonmark.Document","xmlns":"http://commonmark.org/xml/1.0","nodes":[{"$class":"org.accordproject.commonmark.Paragraph","nodes":[{"$class":"org.accordproject.commonmark.Text","text":"hello"}]},{"$class":"org.accordproject.commonmark.ThematicBreak"},{"$class":"org.accordproject.commonmark.Paragraph","nodes":[{"$class":"org.accordproject.commonmark.Text","text":"hello"}]}]}
\ No newline at end of file
diff --git a/packages/markdown-docx/test/helper.js b/packages/markdown-docx/test/helper.js
index 9473a953..c279e969 100644
--- a/packages/markdown-docx/test/helper.js
+++ b/packages/markdown-docx/test/helper.js
@@ -31,7 +31,7 @@ const checkRoundTripEquality = async filePath => {
ciceroMark = JSON.parse(ciceroMark);
const ooxmlTransformer = new OOXMLTransformer();
- const { ooxml } = ooxmlTransformer.toOOXML(ciceroMark);
+ const ooxml = ooxmlTransformer.toOOXML(ciceroMark);
const convertedCiceroMark = ooxmlTransformer.toCiceroMark(ooxml);
expect(convertedCiceroMark).to.deep.equal(ciceroMark);
diff --git a/packages/markdown-transform/lib/transform.js b/packages/markdown-transform/lib/transform.js
index b3e39a11..d9e77a40 100644
--- a/packages/markdown-transform/lib/transform.js
+++ b/packages/markdown-transform/lib/transform.js
@@ -26,6 +26,7 @@ const SlateTransformer = require('@accordproject/markdown-slate').SlateTransform
const HtmlTransformer = require('@accordproject/markdown-html').HtmlTransformer;
const PdfTransformer = require('@accordproject/markdown-pdf').PdfTransformer;
const DocxTransformer = require('@accordproject/markdown-docx').DocxTransformer;
+const OOXMLTransformer = require('@accordproject/markdown-docx').OOXMLTransformer;
/**
* The graph of transformation supported
@@ -165,6 +166,10 @@ const transformationGraph = {
pdfmake: (input, parameters, options) => {
return PdfTransformer.ciceroMarkToPdfMake(input, options);
},
+ ooxml: (input) => {
+ const t = new OOXMLTransformer();
+ return t.toOOXML(input);
+ }
},
data: {
docs: 'Contract Data (JSON)',
@@ -221,6 +226,14 @@ const transformationGraph = {
return t.toCiceroMark(input, options);
},
},
+ ooxml: {
+ docs: 'OOXML',
+ fileFormat: 'utf8',
+ ciceromark_parsed: async(input) => {
+ const t = new OOXMLTransformer();
+ return t.toCiceroMark(input);
+ }
+ },
html: {
docs: 'HTML (string)',
fileFormat: 'utf8',
diff --git a/packages/markdown-transform/test/data/acceptance/omitted-acceptance-of-delivery.json b/packages/markdown-transform/test/data/acceptance/omitted-acceptance-of-delivery.json
new file mode 100644
index 00000000..fd1883c1
--- /dev/null
+++ b/packages/markdown-transform/test/data/acceptance/omitted-acceptance-of-delivery.json
@@ -0,0 +1 @@
+{"$class":"org.accordproject.commonmark.Document","xmlns":"http://commonmark.org/xml/1.0","nodes":[{"$class":"org.accordproject.commonmark.Heading","level":"2","nodes":[{"$class":"org.accordproject.commonmark.Text","text":"Acceptance of Delivery."}]},{"$class":"org.accordproject.commonmark.Paragraph","nodes":[{"$class":"org.accordproject.ciceromark.Variable","value":"\"Party A\"","name":"shipper","elementType":"org.accordproject.organization.Organization"},{"$class":"org.accordproject.commonmark.Text","text":" will be deemed to have completed its delivery obligations"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.commonmark.Text","text":"if in "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Party B\"","name":"receiver","elementType":"org.accordproject.organization.Organization"},{"$class":"org.accordproject.commonmark.Text","text":"'s opinion, the "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Widgets\"","name":"deliverable","elementType":"String"},{"$class":"org.accordproject.commonmark.Text","text":" satisfies the"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.commonmark.Text","text":"Acceptance Criteria, and "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Party B\"","name":"receiver","elementType":"org.accordproject.organization.Organization"},{"$class":"org.accordproject.commonmark.Text","text":" notifies "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Party A\"","name":"shipper","elementType":"org.accordproject.organization.Organization"},{"$class":"org.accordproject.commonmark.Text","text":" in writing"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.commonmark.Text","text":"that it is accepting the "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Widgets\"","name":"deliverable","elementType":"String"},{"$class":"org.accordproject.commonmark.Text","text":"."}]},{"$class":"org.accordproject.commonmark.Heading","level":"2","nodes":[{"$class":"org.accordproject.commonmark.Text","text":"Inspection and Notice."}]},{"$class":"org.accordproject.commonmark.Paragraph","nodes":[{"$class":"org.accordproject.ciceromark.Variable","value":"\"Party B\"","name":"receiver","elementType":"org.accordproject.organization.Organization"},{"$class":"org.accordproject.commonmark.Text","text":" will have "},{"$class":"org.accordproject.ciceromark.Variable","value":"10","name":"businessDays","elementType":"Long"},{"$class":"org.accordproject.commonmark.Text","text":" Business Days to inspect and"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.commonmark.Text","text":"evaluate the "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Widgets\"","name":"deliverable","elementType":"String"},{"$class":"org.accordproject.commonmark.Text","text":" on the delivery date before notifying"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Party A\"","name":"shipper","elementType":"org.accordproject.organization.Organization"},{"$class":"org.accordproject.commonmark.Text","text":" that it is either accepting or rejecting the"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Widgets\"","name":"deliverable","elementType":"String"},{"$class":"org.accordproject.commonmark.Text","text":"."}]},{"$class":"org.accordproject.commonmark.Heading","level":"2","nodes":[{"$class":"org.accordproject.commonmark.Text","text":"Acceptance Criteria."}]},{"$class":"org.accordproject.commonmark.Paragraph","nodes":[{"$class":"org.accordproject.commonmark.Text","text":"The \"Acceptance Criteria\" are the specifications the "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Widgets\"","name":"deliverable","elementType":"String"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.commonmark.Text","text":"must meet for the "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Party A\"","name":"shipper","elementType":"org.accordproject.organization.Organization"},{"$class":"org.accordproject.commonmark.Text","text":" to comply with its requirements and"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.commonmark.Text","text":"obligations under this agreement, detailed in "},{"$class":"org.accordproject.ciceromark.Variable","value":"\"Attachment X\"","name":"attachment","elementType":"String"},{"$class":"org.accordproject.commonmark.Text","text":", attached"},{"$class":"org.accordproject.commonmark.Softbreak"},{"$class":"org.accordproject.commonmark.Text","text":"to this agreement."}]}]}
\ No newline at end of file
diff --git a/packages/markdown-transform/test/data/acceptance/omitted-acceptance-of-delivery.xml b/packages/markdown-transform/test/data/acceptance/omitted-acceptance-of-delivery.xml
new file mode 100644
index 00000000..43be0550
--- /dev/null
+++ b/packages/markdown-transform/test/data/acceptance/omitted-acceptance-of-delivery.xml
@@ -0,0 +1,681 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Acceptance of Delivery.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Party A"
+
+
+
+
+
+
+
+ will be deemed to have completed its delivery obligations
+
+
+
+
+
+
+
+
+
+ if in
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Party B"
+
+
+
+
+
+
+
+ 's opinion, the
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Widgets"
+
+
+
+
+
+
+
+ satisfies the
+
+
+
+
+
+
+
+
+
+ Acceptance Criteria, and
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Party B"
+
+
+
+
+
+
+
+ notifies
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Party A"
+
+
+
+
+
+
+
+ in writing
+
+
+
+
+
+
+
+
+
+ that it is accepting the
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Widgets"
+
+
+
+
+
+
+
+ .
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inspection and Notice.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Party B"
+
+
+
+
+
+
+
+ will have
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 10
+
+
+
+
+
+
+
+ Business Days to inspect and
+
+
+
+
+
+
+
+
+
+ evaluate the
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Widgets"
+
+
+
+
+
+
+
+ on the delivery date before notifying
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Party A"
+
+
+
+
+
+
+
+ that it is either accepting or rejecting the
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Widgets"
+
+
+
+
+
+
+
+ .
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Acceptance Criteria.
+
+
+
+
+
+
+
+
+
+ The "Acceptance Criteria" are the specifications the
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Widgets"
+
+
+
+
+
+
+
+
+
+
+
+ must meet for the
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Party A"
+
+
+
+
+
+
+
+ to comply with its requirements and
+
+
+
+
+
+
+
+
+
+ obligations under this agreement, detailed in
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Attachment X"
+
+
+
+
+
+
+
+ , attached
+
+
+
+
+
+
+
+
+
+ to this agreement.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/markdown-transform/test/transform.js b/packages/markdown-transform/test/transform.js
index 709c4b26..6c106076 100644
--- a/packages/markdown-transform/test/transform.js
+++ b/packages/markdown-transform/test/transform.js
@@ -55,6 +55,8 @@ const acceptanceCiceroMarkUnquoted = JSON.parse(fs.readFileSync(path.resolve(__d
const acceptanceSlate = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'data/acceptance', 'slate.json'), 'utf8'));
const acceptancePlainText = normalizeNLs(fs.readFileSync(path.resolve(__dirname, 'data/acceptance', 'sample.txt'), 'utf8'));
const acceptanceHtml = normalizeNLs(fs.readFileSync(path.resolve(__dirname, 'data/acceptance', 'sample.html'), 'utf8'));
+const omittedAcceptanceXML = fs.readFileSync(path.resolve(__dirname, 'data/acceptance', 'omitted-acceptance-of-delivery.xml'), 'utf8');
+const omittedAcceptanceCiceroMarkParsed = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'data/acceptance', 'omitted-acceptance-of-delivery.json'), 'utf8'));
// Sample test
const samplePdf = fs.readFileSync(path.resolve(__dirname, 'data/sample', 'sample.pdf'));
@@ -166,6 +168,11 @@ describe('#acceptance', () => {
const result = await transform(acceptanceCiceroMarkParsed, 'ciceromark_parsed', ['html'], {}, {verbose: true});
result.should.equal(acceptanceHtml);
});
+
+ it('ciceromark_parsed -> ooxml', async () => {
+ const result = await transform(omittedAcceptanceCiceroMarkParsed, 'ciceromark_parsed', ['ooxml'], {}, {});
+ result.should.equal(omittedAcceptanceXML);
+ });
});
describe('#ciceroedit', () => {
@@ -312,3 +319,10 @@ describe('#formatDescriptor', () => {
(() => formatDescriptor('foobar')).should.throw('Unknown format foobar');
});
});
+
+describe('#ooxml', () => {
+ it('ooxml -> ciceromark_parsed', async () => {
+ const result = await transform(omittedAcceptanceXML, 'ooxml' , ['ciceromark_parsed'], {}, {});
+ chai.expect(result).to.deep.equal(omittedAcceptanceCiceroMarkParsed);
+ });
+});
diff --git a/packages/markdown-transform/transformations.png b/packages/markdown-transform/transformations.png
index 76580afa..2a05f17e 100644
Binary files a/packages/markdown-transform/transformations.png and b/packages/markdown-transform/transformations.png differ