From 804d85353ba1ec525cffed27336a53a83c5e6638 Mon Sep 17 00:00:00 2001 From: Chibuezem Marvinrose Date: Sat, 1 Mar 2025 18:39:52 +0100 Subject: [PATCH] Fixes issue #7 Update Documentation in accordproject/template-engine. Signed-off-by: Chibuezem Marvinrose --- docs/markup-templatemark.md | 111 +++++++++++++++++++++++++++--------- 1 file changed, 85 insertions(+), 26 deletions(-) diff --git a/docs/markup-templatemark.md b/docs/markup-templatemark.md index 5b11cdc..651e403 100644 --- a/docs/markup-templatemark.md +++ b/docs/markup-templatemark.md @@ -24,8 +24,9 @@ The way variables are handled (both during parsing and drafting) is based on the #### Description If the variable `variableName` has type `String` in the model: -```ergo + o String variableName + ``` The corresponding instance should contain text between quotes (`"`). @@ -33,7 +34,7 @@ The corresponding instance should contain text between quotes (`"`). For example, consider the following model: -```ergo + asset Template extends AccordClause { o String buyer o String supplier @@ -41,20 +42,25 @@ asset Template extends AccordClause { ``` the following instance text: + ```md This Supply Sales Agreement is made between "Steve Supplier" and "Betty Byer". ``` matches the template: + ```tem This Supply Sales Agreement is made between {{supplier}} and {{buyer}}. ``` while the following instance texts do not match: + ```md This Supply Sales Agreement is made between 2019 and 2020. ``` + or + ```md This Supply Sales Agreement is made between Steve Supplier and Betty Byer. ``` @@ -64,10 +70,11 @@ This Supply Sales Agreement is made between Steve Supplier and Betty Byer. #### Description If the variable `variableName` has type `Double`, `Integer` or `Long` in the model: -```ergo + o Double variableName o Integer variableName2 o Long variableName3 + ``` The corresponding instance should contain the corresponding number. @@ -75,27 +82,32 @@ The corresponding instance should contain the corresponding number. For example, consider the following model: -```ergo + asset Template extends AccordClause { o Double penaltyPercentage } ``` the following instance text: + ```md The penalty amount is 10.5% of the total value of the Equipment whose delivery has been delayed. ``` matches the template: + ```tem The penalty amount is {{penaltyPercentage}}% of the total value of the Equipment whose delivery has been delayed. ``` while the following instance texts do not match: + ```md The penalty amount is ten% of the total value of the Equipment whose delivery has been delayed. ``` + or + ```md The penalty amount is "10.5"% of the total value of the Equipment whose delivery has been delayed. ``` @@ -105,8 +117,9 @@ The penalty amount is "10.5"% of the total value of the Equipment whose delivery #### Description If the variable `variableName` has an enumerated type: -```ergo + o EnumType variableName + ``` The corresponding instance should contain a corresponding enumerated value without quotes. @@ -114,28 +127,34 @@ The corresponding instance should contain a corresponding enumerated value witho #### Examples For example, consider the following model: -```ergo + import org.accordproject.money.CurrencyCode from https://models.accordproject.org/money.cto asset Template extends AccordClause { o CurrencyCode currency } ``` + the following instance text: + ```md Monetary amounts in this contract are denominated in USD. ``` matches the template: + ```tem Monetary amounts in this contract are denominated in {{currency}}. ``` while the following instance texts do not match: + ```md Monetary amounts in this contract are denominated in "USD". ``` + or + ```md Monetary amounts in this contract are denominated in $. ``` @@ -155,9 +174,10 @@ The contract was signed on {{contractDate as "DD/MM/YYYY"}}. #### Description If the variable `variableName` has type `DateTime`: -```ergo + o DateTime variableName -``` + +```` The corresponding instance should be a date and time, and can optionally be formatted. The default format is `MM/DD/YYYY`, commonly used in the US. #### DateTime Formats @@ -197,7 +217,7 @@ The format of the `contractDate` variable of type `DateTime` can be specified wi ```tem The contract was signed on {{contractDate as "DD/MM/YYYY"}}. The contract was signed on 26/04/2019. -``` +```` Other examples: @@ -231,11 +251,12 @@ dateTimeProperty: 04-Jan-2019 2 59:01.001+01:01 #### Description If the variable `variableName` is of type `Integer`, `Long`, `Double` or `MonetaryAmount`: -```ergo + o Integer integerVariable o Long longVariable o Double doubleVariable o MonetaryAmount monetaryVariable + ``` The corresponding instance should be a numeric value (with a currency code in the case of monetary amounts), and can optionally be formatted. @@ -264,42 +285,56 @@ The general format for the amount is `0{sep}0({sep}0+)?` where `{sep}` is a sing The following examples show formating for `Integer` or `Long` values. ``` + The manuscript shall be completed within {{days as "0,0"}} days. The manuscript shall be completed within 1,001 days. + ``` ``` + The manuscript shall contain at most {{words as "0 0"}} words. The manuscript shall contain at most 1 500 001 words. + ``` The following examples show formatting for `Double` values. ``` + The effective range of the device should be at least {{distance as "0,0.00mm"}}. The effective range of the device should be at least 1,250,400.99mm. + ``` ``` + The effective range of the device should be at least {{distance as "0 0,0000mm"}}. The effective range of the device should be at least 1 250 400,9900mm. + ``` The following examples show formatting for `MonetaryAmount` values. ``` + The loan principal is {{principal as "0,0.00 CCC"}}. The loan principal is 2,000,500,000.00 GBP. + ``` ``` + The loan principal is {{principal as "K0,0.00"}}. The loan principal is £2,000,500,000.00. + ``` ``` + The loan principal is {{principal as "0 0,00 K"}}. The loan principal is 2 000 500 000,00 €. + ``` ## Complex Types Variables @@ -309,7 +344,7 @@ The loan principal is 2 000 500 000,00 €. #### Description If the variable `variableName` has type `Duration`: -```ergo + import org.accordproject.time.Duration o Duration variableName ``` @@ -319,31 +354,38 @@ The corresponding instance should contain the corresponding duration written wit #### Examples For example, consider the following model: -```ergo + asset Template extends AccordClause { - o Duration termination +o Duration termination } -``` + +```` the following instance texts: ```md If the delay is more than 15 days, the Buyer is entitled to terminate this Contract. -``` +```` + and + ```md If the delay is more than 1 week, the Buyer is entitled to terminate this Contract. ``` both match the template: + ```tem If the delay is more than {{termination}}, the Buyer is entitled to terminate this Contract. ``` while the following instance texts do not match: + ```md If the delay is more than a month, the Buyer is entitled to terminate this Contract. ``` + or + ```md If the delay is more than "two weeks", the Buyer is entitled to terminate this Contract. ``` @@ -353,8 +395,9 @@ If the delay is more than "two weeks", the Buyer is entitled to terminate this C #### Description If the variable `variableName` has a complex type `ComplexType` (such as an `asset`, a `concept`, etc.) -```ergo + o ComplexType variableName + ``` The corresponding instance should contain all fields in the corresponding complex type in the order they occur in the model, separated by a single white space character. @@ -362,7 +405,7 @@ The corresponding instance should contain all fields in the corresponding comple #### Examples For example, consider the following model: -```ergo + import org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto asset Template extends AccordClause { o PostalAddress address @@ -370,29 +413,34 @@ asset Template extends AccordClause { ``` the following instance text: + ```md Address of the supplier: "555 main street" "10290" "" "NY" "New York" "10001". ``` matches the template: + ```tem Address of the supplier: {{address}}. ``` Consider the following model: + ```md import org.accordproject.money.MonetaryAmount from https://models.accordproject.org/money.cto asset Template extends AccordClause { - o MonetaryAmount amount +o MonetaryAmount amount } ``` the following instance text: + ```md Total value of the goods: 50.0 USD. ``` matches the template: + ```tem Total value of the goods: {{amount}}. ``` @@ -401,7 +449,7 @@ Total value of the goods: {{amount}}. CiceroMark uses blocks to enable more advanced scenarios, to handle optional or repeated text (e.g., lists), to change the variables in scope for a given section of the text, etc. Inline blocks correspond to inline elements in the markdown. -Inline blocks always have the following syntactic structure: +Inline blocks always have the following syntactic structure: ```tem {{#blockName variableName parameters}}...{{/blockName}} @@ -426,6 +474,7 @@ Conditional blocks can also include an `else` branch to indicate that some other #### Examples Drafting text with the first conditional block above using the following JSON data: + ```json { "$class": "org.accordproject.foo.Status", @@ -440,6 +489,7 @@ This is a force majeure ``` Drafting text with this block using the following JSON data: + ```json { "$class": "org.accordproject.foo.Status", @@ -470,6 +520,7 @@ Optional blocks can also include an `else` branch to indicate that some other te #### Examples Drafting text with the second optional block above using the following JSON data: + ```json { "$class": "org.accordproject.foo.Status", @@ -487,6 +538,7 @@ This applies except for Force Majeure cases in a 250 miles radius. ``` Drafting text with this block using the following JSON data: + ```json { "$class": "org.accordproject.foo.Status", @@ -512,6 +564,7 @@ For the Landlord: {{#with landlord}}{{partyId}}, domiciled at {{address}}{{/with #### Example Drafting text with this block using the following JSON data: + ```json { "$class": "org.accordproject.rentaldeposit.RentalDepositClause", @@ -543,19 +596,23 @@ Discount applies to the following items: {{#join items separator=", "}}{{name}} #### Example Drafting text with this block using the following JSON data: + ```json { "$class": "org.accordproject.sale.Order", "contractId": "31d817e2-d62a-4b70-b395-acd0d5da09f5", - "items": [{ + "items": [ + { "$class": "org.accordproject.slate.Item", "id": "111", "name": "Pineapple" - },{ + }, + { "$class": "org.accordproject.slate.Item", "id": "222", "name": "Strawberries" - },{ + }, + { "$class": "org.accordproject.slate.Item", "id": "333", "name": "Pomegranate" @@ -574,7 +631,7 @@ Discount applies to the following items: Pineapple (111), Strawberries (222), Po CiceroMark uses block expressions to enable more advanced scenarios, to handle optional or repeated text (e.g., lists), to change the variables in scope for a given section of the text, etc. -Container blocks always have the following syntactic structure: +Container blocks always have the following syntactic structure: ```tem {{#blockName variableName parameters}} @@ -595,6 +652,7 @@ where `blockName` indicates which kind of block it is (e.g., conditional block o #### Example Drafting text with this block using the following JSON data: + ```json { "$class": "org.accordproject.volumediscountlist.VolumeDiscountContract", @@ -641,6 +699,7 @@ results in the following markdown text: #### Example Drafting text with this block using the following JSON data: + ```json { "$class": "org.accordproject.volumediscountlist.VolumeDiscountContract", @@ -669,6 +728,7 @@ Drafting text with this block using the following JSON data: ``` results in the following markdown text: + ```md 1. 0.0$ M <= Volume < 1.0$ M : 3.1% 2. 1.0$ M <= Volume < 10.0$ M : 3.1% @@ -692,6 +752,7 @@ follows: {{paymentProcedure}}. #### Example Drafting text with this block using the following JSON data: + ```json { "$class": "org.accordproject.copyrightlicense.CopyrightLicenseContract", @@ -714,11 +775,9 @@ Drafting text with this block using the following JSON data: results in the following markdown text: ```md -Payment ----- +## Payment As consideration in full for the rights granted herein, Licensee shall pay Licensor a one-time fee in the amount of "one hundred US Dollars" (100.0 USD) upon execution of this Agreement, payable as follows: "bank transfer". - ```