Skip to content

Commit

Permalink
GH Pages: Add raw Liquid tags for jekyll
Browse files Browse the repository at this point in the history
  • Loading branch information
argenos committed Nov 7, 2024
1 parent d3bf94f commit d0ff034
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions docs/v2-motivation.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,21 +319,25 @@ Modularization of the grammar is discussed [below](#modularity-and-model-reuse).
- **Templates used by jinja:** These are the templates that are loaded by the generator. The jinja generator keeps the file name and changes the extension to `.fpm2`. Each template `includes` the relevant templates for the concepts for each of the five JSON-LD models (see [composable model representation](#composable-model-representation)).
- **Base JSON-LD representations:** Each concept has a template (that other templates can extend to minimize repetition). For example, a frame template matches what we specified in the grammar rule that we discussed the in [refactoring](#refactoring-of-the-textx-metamodels):

```
{
"@id": "floorplan:{% block frame_id %}{{ frame.name }}{% endblock %}",
"@type": "Frame",
"origin": "floorplan:{% block origin %}{{ frame.origin.name }}{% endblock %}"
}
```
{% raw %}
```
{
"@id": "floorplan:{% block frame_id %}{{ frame.name }}{% endblock %}",
"@type": "Frame",
"origin": "floorplan:{% block origin %}{{ frame.origin.name }}{% endblock %}"
}
```
{% endraw %}

In `skeleton.fpm2.jinja`, we just define the frame of the element we're currently converting, e.g. to define the origin point and the frame of a space:

```
{% set frame = space.frame %}
{% include "./floorplan/structural-entities/origin.json" with context %},
{% include "./geometry/structural-entities/frame.json" with context %},
```
{% raw %}
```
{% set frame = space.frame %}
{% include "./floorplan/structural-entities/origin.json" with context %},
{% include "./geometry/structural-entities/frame.json" with context %},
```
{% endraw %}

- [x] Model-to-model transformation from `v1` to `v2` was also implemented with jinja2. How the jinja templates are organized is shown below:
![](images/jinja-templates-fpm2.png)
Expand Down

0 comments on commit d0ff034

Please sign in to comment.