Skip to content

Commit

Permalink
Update liquid templates
Browse files Browse the repository at this point in the history
  • Loading branch information
kwkwan committed Oct 21, 2024
1 parent 3ba56e0 commit 472dbc1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
24 changes: 18 additions & 6 deletions lib/metanorma/plugin/lutaml/liquid_templates/_klass_table.liquid
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
{% assign root = klass.generalization %}

{%- capture upper_klass_name -%}
{{ root.general.upper_klass }}:{{ root.general.name }}
{%- endcapture -%}
{%- if upper_klass_name == ":" -%}
{%- assign upper_klass_name = "-" -%}
{%- endif -%}
{%- capture stereotype -%}<< {{ root.stereotype }} >>{%- endcapture -%}
{%- if stereotype == "<< >>" -%}
{%- assign stereotype = " " -%}
{%- endif -%}

[cols="1a,1a,2a"]
|===
| Definition of Type
2+| {{ root.definition }}

h| Upper Type 2+| {{ root.general.upper_klass }}:{{ root.general.name }}
h| Stereotype 2+| << {{ root.stereotype }} >>
h| Upper Type 2+| {{ upper_klass_name }}
h| Stereotype 2+| {{ stereotype }}

3+h| Inherited Properties
h| Property Name h| Property Type and Multiplicity h| Definition
Expand All @@ -16,7 +28,7 @@ h| Property Name h| Property Type and Multiplicity h| Definition
({{ attr.gen_name }})
{%- endcapture -%}
| {{ name_col | newline_to_br }}
| {{ attr.type }} [{{ attr.cardinality }}]
| {{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
| {{ attr.definition }}
{%- endif -%}
{% endfor %}
Expand All @@ -30,7 +42,7 @@ h| Property Name h| Property Type and Multiplicity h| Definition
({{ attr.gen_name }})
{%- endcapture -%}
| {{ name_col | newline_to_br }}
| {{ attr.type }} [{{ attr.cardinality }}]
| {{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
| {{ attr.definition }}
{%- endif -%}
{% endfor %}
Expand All @@ -44,7 +56,7 @@ h| Property Name h| Property Type and Multiplicity h| Definition
({{ attr.gen_name }})
{%- endcapture -%}
| {{ name_col | newline_to_br }}
| {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality }}]
| {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
| {{ attr.definition }}
{%- endif -%}
{% endfor %}
Expand All @@ -58,7 +70,7 @@ h| Property Name h| Property Type and Multiplicity h| Definition
({{ attr.gen_name }})
{%- endcapture -%}
| {{ name_col | newline_to_br }}
| {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality }}]
| {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
| {{ attr.definition }}
{%- endif -%}
{% endfor %}
Expand Down
8 changes: 4 additions & 4 deletions spec/fixtures/lutaml/liquid_templates/_klass_table.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ h| 属性名 h| 属性の型及び多重度 h| 定義
({{ attr.gen_name }})
{%- endcapture -%}
| {{ name_col | newline_to_br }}
| {{ attr.type }} [{{ attr.cardinality }}]
| {{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
| {{ attr.definition }}
{%- endif -%}
{% endfor %}
Expand All @@ -30,7 +30,7 @@ h| 属性名 h| 属性の型及び多重度 h| 定義
({{ attr.gen_name }})
{%- endcapture -%}
| {{ name_col | newline_to_br }}
| {{ attr.type }} [{{ attr.cardinality }}]
| {{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
| {{ attr.definition }}
{%- endif -%}
{% endfor %}
Expand All @@ -44,7 +44,7 @@ h| 関連役割名 h| 関連役割の型及び多重度 h| 定義
({{ attr.gen_name }})
{%- endcapture -%}
| {{ name_col | newline_to_br }}
| {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality }}]
| {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
| {{ attr.definition }}
{%- endif -%}
{% endfor %}
Expand All @@ -58,7 +58,7 @@ h| 関連役割名 h| 関連役割の型及び多重度 h| 定義
({{ attr.gen_name }})
{%- endcapture -%}
| {{ name_col | newline_to_br }}
| {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality }}]
| {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
| {{ attr.definition }}
{%- endif -%}
{% endfor %}
Expand Down

0 comments on commit 472dbc1

Please sign in to comment.