Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templates with tab characters do not roundtrip between parse and generateText #441

Closed
dselman opened this issue Oct 15, 2019 · 5 comments
Closed

Comments

@dselman
Copy link
Contributor

dselman commented Oct 15, 2019

If a template contains the tab character (\t) then we when parse is called a JSON data is created, however if you subsequently call generateText with the JSON data then tab characters in the template are expanded as \t.

To Reproduce

  1. Download the attached template
  2. Unzip
  3. Install Cicero CLI
  4. cicero parse --out data.json
  5. cicero generateText --data data.json

Expected behavior
Should roundtrip, or somehow strip tabs.

@dselman
Copy link
Contributor Author

dselman commented Oct 15, 2019

@jeromesimeon another whitespace issue in 0.13.4

@dselman
Copy link
Contributor Author

dselman commented Oct 15, 2019

@jeromesimeon
Copy link
Member

jeromesimeon commented Oct 15, 2019

This specific sample works on the 0.20-alpha branch, in the sense that the result of generateText can be parsed again and yields the same JSON:

bash-3.2$ ~/git/cicero/packages/cicero-cli/index.js --version 
0.20.0-alpha.2
bash-3.2$ ~/git/cicero/packages/cicero-cli/index.js parse --out data.json
08:44:59 - info: Using current directory as template folder
08:44:59 - info: Loading a default sample.md file.
08:45:01 - info: Creating file: data.json
08:45:01 - info:
{
  "$class": "io.clause.demo.nda.GoldmanNDAClause",
  "contractId": "e3f4fd80-d405-4357-bee0-18c33d207bc7",
  "clideNumber": "CPIP-2019-004991",
  "tvetNumber": "36917",
  "vendorName": {
    "$class": "org.accordproject.cicero.contract.AccordParty",
    "partyId": "Bar"
  },
  "vendorAddress": "Baz",
  "accountName": {
    "$class": "org.accordproject.cicero.contract.AccordParty",
    "partyId": "Boop"
  },
  "accountAddress": "Betty",
  "effectiveDate": "2019-10-03T00:00:00.000-04:00"
}
bash-3.2$ ~/git/cicero/packages/cicero-cli/index.js generateText --out sample2.md 
08:45:13 - info: Using current directory as template folder
08:45:13 - info: Loading a default data.json file.
08:45:14 - info: Creating file: sample2.md
08:45:14 - info: Clide#: "CPIP-2019-004991"
Tvet#: "36917"

Vendor:	"Bar"
"Baz"

Foo:	"Boop"
"Betty"

Effective Date: 10/03/2019
bash-3.2$ ~/git/cicero/packages/cicero-cli/index.js parse --sample sample2.md 
08:45:21 - info: Using current directory as template folder
08:45:23 - info:
{
  "$class": "io.clause.demo.nda.GoldmanNDAClause",
  "contractId": "4b13d975-83bd-4f52-ad8c-a28dce2011dc",
  "clideNumber": "CPIP-2019-004991",
  "tvetNumber": "36917",
  "vendorName": {
    "$class": "org.accordproject.cicero.contract.AccordParty",
    "partyId": "Bar"
  },
  "vendorAddress": "Baz",
  "accountName": {
    "$class": "org.accordproject.cicero.contract.AccordParty",
    "partyId": "Boop"
  },
  "accountAddress": "Betty",
  "effectiveDate": "2019-10-03T00:00:00.000-04:00"
}
bash-3.2$

In fact in this case, the exact same .md:

bash-3.2$ diff sample.md sample2.md 
bash-3.2$ 

@jeromesimeon
Copy link
Member

Fixed in master now.

@jeromesimeon
Copy link
Member

Duplicate of #353

@jeromesimeon jeromesimeon marked this as a duplicate of #353 Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants