gama-platform / gama-platform.github.io

Repository for the website of GAMA
https://gama-platform.github.io/
GNU General Public License v3.0
4 stars 2 forks source link

Some examples have broken formatting #120

Closed lesquoyb closed 2 years ago

lesquoyb commented 2 years ago

Describe the bug On the website, certain examples are formatted as being on only one line whilst they are described as multiple lines in the code used to generate it. For example here in the doc: image And the code: image As of now, I found those cases, maybe there are more:

In addition, for the add documentation, on the website, you can also see a little bit under the first broken example, that some examples are completely empty. image the code: image

Edit: A third formatting problem for examples: sometimes there is a carriage return inserted in the first line that is also not present in the code. image Identified cases:

RoiArthurB commented 2 years ago

Hello,

As displayed at the top of the page, this page is generated and the bug is not specific to the website :) image

And, even if the generation works smootly on other parts of this page, all the code block is generated on a single line as this :

* Case of a list, the expression in the facet at: should be an integer.

`` ` 
list<int> workingList <- [];add 0 at: 0 to: workingList ;//workingList equals [0]add 10 at: 0 to: workingList ;//workingList equals [10,0]add 20 at: 2 to: workingList ;//workingList equals [10,0,20]add 50 to: workingList;//workingList equals [10,0,20,50]add [60,70] all: true to: workingList;//workingList equals [10,0,20,50,60,70]
`` `

This should be a bug in the way documentation is generated (maybe an evolution in the generator ?)


About the empty code block, here's what the generated markdown display :

`` `add "val2" to: workingMap;//workingMap equals ["x"::"val1", "val2"::"val2"]add "5"::"val4" to: workingMap; //workingMap equals ["x"::"val1", "val2"::"val2", "5"::"val4"]
`` `

Here, the problem comes from the code line being on the same line as the code block header. This space is used by Docusaurus to get meta-data for the code block (like setting the language, etc). So the generation should ensure writting code on a different line than the code-block wrapper


The last problem still comes from the generator inserting an empty line in the code block as there :

* Other examples of use: 
`` `

coping emotion: new_emotion("fear") when: flip(0.5) new_desire: new_predicate("test");
`` ` 

Code block won't assume nor prevent anything inside the wrapper and will display extra empty lines if you add some inside. So it have to be prevented during the generation :)

lesquoyb commented 2 years ago

Everything seems solved, thanks