Skip to content

krABMaga/krABMaga.github.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

Landing page for the krABMaga framework. This project uses Zola, a fast static site generator built in Rust. The embedded wasm binaries of the various krABMaga based examples require the v0.11.0 release of Zola, which fixes an important issue where the responses of the wasm js files being served lacked the proper Content-Type header, required for js modules to be loaded per HTML spec.

Running in local

You can easily run a local server with the whole site, along with the embedded wasm simulations, by simply running:

zola serve

If you want to update the wasm binaries, simply run the update script as such:

python scripts/update.py

Contributing

To add a new page for a specific simulation, simply create a new markdown file under the content folder, with a filename equal to the name of the folder containing the simulation project on the Rust AB examples repository. The front matter requires some boilerplate that will be hopefully removed in recent releases. The template's as follows:

+++
title = "Name of the simulation"
[extra]
last_updated = "2021-05-09"
sim_name = "boids"
+++

The last_updated date should be set to the current date. When an example changes, a script will automatically update it. The sim_name should be equal to the name of the file and of the simulation. It will be used to fetch the current wasm binary, and the chart csv files, if any chart is specified.

There's support for basic optional charts from csv files directly from the front matter, with the use of a specific set of directives as shown below:

[[extra.charts]]
name="Strong scaling"
id="strong_scaling"
csv="strong_scaling"
type="line"
caption="Lorem ipsum"
[extra.charts.xAxis]
id = "thread_num"
title = "Threads number"
[extra.charts.yAxis]
id = "total_seconds"
title = "Total seconds"

It is assumed that the data source for the chart is a csv file located within the static/csv folder with a file name equal to the value given to the csv property. You can define multiple [[extra.charts]] blocks, the only requirement is that all the property are filled, with the id in particular being unique.

You may also want to edit the main_menu property in the config.toml file in the root of the project to add a link to your newly made model page to the navigation bar menu.

Scripts

The script folder contains the update.py script, which is used to update the wasm binaries and the chart data for each example. The script works under Python 3.8.x. It simply clones (or updates, if a local copy exists) the krABMaga examples repository, calling cargo make build-web --profile release on each, moving the generated wasm outputs to the correct folder (static/wasm) with the correct name. The script copies all the csvs contained within the bench folder of the specific simulation, if any exist. Lastly, it updates the last_updated timestamps in the related markdown file to notify the simulation page has changed. The script blacklists some examples (notably the template project) and it is ran automatically by a GitHub Action when a new commit is merged in the Examples repository.

Theme

The theme used is zerm. The edits are:

  • In index.html which adds a template block in the head tag, to allow for pages extending the index to define custom scripts.
  • The list_pages macro has been removed.