Skip to content

Commit

Permalink
fix(nested) Nested Clause bug fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Jerome Simeon <[email protected]>
  • Loading branch information
jeromesimeon committed Sep 11, 2019
1 parent ab7c654 commit 803b2a2
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ require('yargs')
type: 'boolean',
default: false
});
yargs.option('--withAP', {
describe: 'further transform for AP',
yargs.option('--withCicero', {
describe: 'further transform for Cicero',
type: 'boolean',
default: false
});
Expand All @@ -45,7 +45,7 @@ require('yargs')

try {
argv = Commands.validateParseArgs(argv);
return Commands.parse(argv.sample, argv.out, argv.generateMarkdown, argv.withAP)
return Commands.parse(argv.sample, argv.out, argv.generateMarkdown, argv.withCicero)
.then((result) => {
if(result) {Logger.info('\n'+result);}
})
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions src/ToCiceroVisitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class ToCiceroVisitor {
thing.src = tag.attributes[0].value;
thing.clauseid = tag.attributes[1].value;

const parsedNodes = parameters.commonMark.fromString(tag.content).nodes;
thing.nodes = parsedNodes ? ToCiceroVisitor.visitNodes(this, parsedNodes, parameters) : []; // Parse text as markdown (in the nodes for the root)
thing.nodes = parameters.commonMark.fromString(tag.content).nodes;
ToCiceroVisitor.visitNodes(this, thing.nodes, parameters);
thing.text = null; // Remove text
delete thing.tag;
}
Expand All @@ -77,8 +77,8 @@ class ToCiceroVisitor {
thing.clauseid = tag.attributes[0].value;
thing.src = tag.attributes[1].value;

const parsedNodes = parameters.commonMark.fromString(tag.content).nodes;
thing.nodes = parsedNodes ? ToCiceroVisitor.visitNodes(this, parsedNodes, parameters) : []; // Parse text as markdown (in the nodes for the root)
thing.nodes = parameters.commonMark.fromString(tag.content).nodes;
ToCiceroVisitor.visitNodes(this, thing.nodes, parameters);
thing.text = null; // Remove text
delete thing.tag;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/__snapshots__/CiceroMark.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Object {
},
Object {
"$class": "org.accordproject.commonmark.CodeBlock",
"info": "<clause src=ap://[email protected]#721d1aa0999a5d278653e211ae2a64b75fdd8ca6fa1f34255533c942404c5c1f clauseid=479adbb4-dc55-4d1a-ab12-b6c5e16900c0>",
"info": "<clause src=\\"ap://[email protected]#721d1aa0999a5d278653e211ae2a64b75fdd8ca6fa1f34255533c942404c5c1f\\" clauseid=\\"479adbb4-dc55-4d1a-ab12-b6c5e16900c0\\">",
"tag": Object {
"$class": "org.accordproject.commonmark.TagInfo",
"attributeString": "id = \\"shipper\\" value = \\"%22Party%20A%22\\" ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Object {
},
Object {
"$class": "org.accordproject.commonmark.CodeBlock",
"info": "<clause src=ap://[email protected]#721d1aa0999a5d278653e211ae2a64b75fdd8ca6fa1f34255533c942404c5c1f clauseid=479adbb4-dc55-4d1a-ab12-b6c5e16900c0>",
"info": "<clause src=\\"ap://[email protected]#721d1aa0999a5d278653e211ae2a64b75fdd8ca6fa1f34255533c942404c5c1f\\" clauseid=\\"479adbb4-dc55-4d1a-ab12-b6c5e16900c0\\">",
"tag": Object {
"$class": "org.accordproject.commonmark.TagInfo",
"attributeString": "id = \\"shipper\\" value = \\"%22Party%20A%22\\" ",
Expand Down
2 changes: 1 addition & 1 deletion test/acceptance.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

And below is a **clause**.

``` <clause src=ap://[email protected]#721d1aa0999a5d278653e211ae2a64b75fdd8ca6fa1f34255533c942404c5c1f clauseid=479adbb4-dc55-4d1a-ab12-b6c5e16900c0>
``` <clause src="ap://[email protected]#721d1aa0999a5d278653e211ae2a64b75fdd8ca6fa1f34255533c942404c5c1f" clauseid="479adbb4-dc55-4d1a-ab12-b6c5e16900c0">
Acceptance of Delivery. <variable id="shipper" value="%22Party%20A%22"/> will be deemed to have completed its delivery obligations if in <variable id="receiver" value="%22Party%20B%22"/>'s opinion, the <variable id="deliverable" value="%22Widgets%22"/> satisfies the Acceptance Criteria, and <variable id="receiver" value="%22Party%20B%22"/> notifies <variable id="shipper" value="%22Party%20A%22"/> in writing that it is accepting the <variable id="deliverable" value="%22Widgets%22"/>.
Inspection and Notice. <variable id="receiver" value="%22Party%20B%22"/> will have <variable id="businessDays" value="10"/> Business Days' to inspect and evaluate the <variable id="deliverable" value="%22Widgets%22"/> on the delivery date before notifying <variable id="shipper" value="%22Party%20A%22"/> that it is either accepting or rejecting the <variable id="deliverable" value="%22Widgets%22"/>.
Expand Down

0 comments on commit 803b2a2

Please sign in to comment.