Comments (4)
This could be best handled by adding a notion of optional
block which would correspond to the optional
type in Concerto. An example could look as follows:
CTO Model:
concept ForceMajeure {
o Duration window
}
concept TemplateModel {
o ForceMajeure forceMajeure optional
}
With the following block:
In case of delayed delivery {{#optional forceMajeure}} except for Force Majeure cases in the {{window}} before the delivery date,{{/optional}}
Note that the new notion of blocks and scoping make this very natural, and allows the template to distinguish between: presence or absence of the optional field, and if present to indicate variables inside the text.
from cicero.
This feature did not make it into 0.20
but should be relatively easy to add now that we have the block syntax support, and could be considered for 0.21
.
from cicero.
This is now supported in the upcoming new parser:
bash-3.2$ more grammar.tem.md
This is a contract between {{seller}} and {{buyer}} for the amount of {{amount}} {{currency}}.{{#optional forceMajeure}}
This applies even in the presence of force majeure with a discount of {{rate}}%.{{/optional}}
bash-3.2$ more sample.md
This is a contract between "Steve" and "Betty" for the amount of 3131.0 EUR.
This applies even in the presence of force majeure with a discount of 10.5%.
bash-3.2$ more model.cto
namespace org.test
import org.accordproject.cicero.contract.* from https://models.accordproject.org/cicero/contract.cto
import org.accordproject.money.CurrencyCode from https://models.accordproject.org/[email protected]
/**
* The template model
*/
concept DiscountRate {
o Double rate
}
asset MyClause extends AccordClause {
o String seller
o String buyer
o Double amount
o CurrencyCode currency
o DiscountRate forceMajeure optional
}
bash-3.2$ ~/git/markdown-transform/packages/markdown-cli/index.js transform --to data --grammar grammar.tem.md --ctoFiles model.cto --input sample.md
5:17:14 PM - info:
{
"$class": "org.test.MyClause",
"seller": "Steve",
"buyer": "Betty",
"amount": 3131,
"currency": "EUR",
"forceMajeure": {
"$class": "org.test.DiscountRate",
"rate": 10.5
},
"clauseId": "049f70d6-feff-4c11-99df-d43076d3dff3"
}
bash-3.2$
from cicero.
This issue has been finally resolved with the release of cicero 0.21
.
from cicero.
Related Issues (20)
- Support for Concerto Vocabularies HOT 2
- CICERO_PORT does not set Cicero Server port properly
- cicero verify does not report errors properly HOT 2
- Cicero-server not working offline: options are not passed to "Template.fromDirectory()" in "initTemplateInstance()" HOT 7
- Outdated Contributing.md Doc HOT 1
- Cicero-CLI: utcOffset and currentTime concurrent usage gives error HOT 6
- Cicero-core: Failing mocha tests
- Failed Curl Request in Cicero-server package HOT 2
- Cicero-core: Provide custom loadfilecontents and loadfilebuffer options in ``Template.fromDirectory()`` HOT 2
- Template archive .cta file imported on VS Code extension - Model and parse error
- cicero-server: Missing tmp-promise dependency
- Replacement expression language for TemplateMark HOT 1
- Cicero DRAFT error when executed against compressed .CTA archive templates. HOT 3
- Lerna Bootstrap no longer supported as of Lerna v7.0
- Some package.json attributes within Template archive need rethinking. HOT 1
- Archive command fails when model contains versioned imports.
- Extending Asset with Contract or Clause causes Archive error HOT 2
- CLI: `cicero get` command pulls in obsolete external models. HOT 2
- New name for `cicero` command line tool HOT 4
- CLI: Reimplement "draft" command HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cicero.