mirror of
https://github.com/CatalaLang/catala.git
synced 2024-09-19 00:15:39 +03:00
docs(contributing): update the CONTRIBUTING.md catala code examples
This commit is contained in:
parent
86d0476b58
commit
98beaf850c
@ -33,12 +33,12 @@ copy-paste the text into your source file.
|
||||
First you will have to format the copy-pasted text using Catala headings
|
||||
and articles markers:
|
||||
|
||||
```
|
||||
@@Heading@@
|
||||
```markdown
|
||||
## Heading
|
||||
|
||||
@@Sub-heading (the more +, the less important)@@++
|
||||
### Sub-heading (the more +, the less important)
|
||||
|
||||
@Legislative atom@
|
||||
#### [Legislative atom]
|
||||
```
|
||||
|
||||
Please look at the code of other examples to see how to format things properly.
|
||||
@ -54,30 +54,32 @@ to see if you've made any syntax errors. Once the text formatting is done, you
|
||||
can start to annotate each legislative atom (article, provision, etc.) with
|
||||
some Catala code. To open up a code section in Catala, simply use
|
||||
|
||||
```
|
||||
/*
|
||||
~~~markdown
|
||||
```catala
|
||||
# In code sections, comments start with #
|
||||
scope Foo:
|
||||
<your code goes here>
|
||||
*/
|
||||
```
|
||||
~~~
|
||||
|
||||
While all the code sections are equivalent in terms of execution, you can
|
||||
mark some as "metadata" so that they are printed differently on lawyer-facing
|
||||
documents. Here's how it works:
|
||||
|
||||
```
|
||||
@@Begin metadata@@ # @@Début métadonnées@@ en français
|
||||
/*
|
||||
~~~markdown
|
||||
> Begin metadata # > Début métadonnées en français
|
||||
|
||||
```catala
|
||||
declaration structure FooBar:
|
||||
data foo content boolean
|
||||
data bar content money
|
||||
|
||||
<your structure/enumeration/scope declarations goes here>
|
||||
*/
|
||||
@@End metadata@@ # @@Fin métadonnées@@ en français
|
||||
```
|
||||
|
||||
> End metadata # > Fin métadonnées en français
|
||||
~~~
|
||||
|
||||
Again, make sure to regularly check that your example is parsing correctly. The error message from the compiler should help you debug the syntax if need be. You can also
|
||||
live-test the programs you wrote by feeding them to the interpreter
|
||||
(see the [README of the `examples` directory](examples/README.md)); this will
|
||||
|
Loading…
Reference in New Issue
Block a user