metanorma / iso-10303-templates

Annotated EXPRESS rendering templates for ISO 10303
0 stars 0 forks source link

Replace `documents/*/express-g-diagrams.yaml` with an Expressir loop #31

Closed ronaldtse closed 3 months ago

ronaldtse commented 3 months ago

See:

Current situation

  1. For every schema, there are schema diagrams under the schema directory. e.g. schemas/resources/product_property_representation_schema/product_property_representation_schemaexpg1.svg
  2. For every schema diagram, the links are actually in the original XML file: iso-10303-stepmod-wg12/data/resources/product_property_representation_schema/product_property_representation_schemaexpg1.xml
  3. In stepmod2mn, these SVG links in (2) are discarded in favor of index numbers.
  4. The SVG links are supposed to be restored by the stepmod-utils function for svgmap. In the Annotated EXPRESS schema content, e.g. product_property_representation_schema.exp, it includes blocks like this to link the SVG file and the EXPRESS links:
(*"product_property_representation_schema.__expressg"
[[product_property_representation_schemaexpg1]]
[.svgmap]
====
image::product_property_representation_schemaexpg1.svg[]

* <<express:representation_schema>>; 1
* <<express:product_structure_schema>>; 2
* <<express:support_resource_schema>>; 3
* <<express:product_definition_schema>>; 4
* <<express:basic_attribute_schema>>; 5
* <<express:material_property_definition_schema>>; 6
* <<express:product_property_definition_schema>>; 7
* <<express:product_property_representation_schema>>; 8
====

*)
  1. Right now, the Annex D diagrams are being included using:

a) documents/iso-10303-41/express-g-diagrams.yaml

---
- path: ../../../schemas/resources/action_schema/action_schemaexpg1.svg
- path: ../../../schemas/resources/action_schema/action_schemaexpg2.svg
- path: ../../../schemas/resources/application_context_schema/application_context_schemaexpg1.svg
- ...

b) documents/common-files/diagrams.adoc

[yaml2text,express-g-diagrams.yaml,diagrams]
----
{% for diagram in diagrams %}
...
[[fig_d{{ figure_id }}]]
.EXPRESS-G diagram of {{ current_name }} ({{diagram_id}} of {{ sizes[size_index] }})
image::{{ diagram.path }}[]

{% endfor %}

This causes the SVG file to be included as a simple SVG image:: which does not have any links.

Solution

  1. All Annotated EXPRESS schemas already have their schema diagram SVGs included:
(*"product_property_representation_schema.__expressg"
...
*)

This means we can fetch them through Expressir.

  1. When we use Expressir to get these images, we can drop the files: documents/iso-10303-41/express-g-diagrams.yaml

  2. This means that a simple template change will fix this.

@manuelfuenmayor can you please help?

opoudjis commented 3 months ago

If this works, please close https://github.com/metanorma/stepmod-utils/issues/66

manuelfuenmayor commented 3 months ago

@ronaldtse, currently module schemas don't contain .svgmap blocks. Only resource schemas.

ronaldtse commented 3 months ago

We’ll have to do them. @HassanAkbar ?

ronaldtse commented 3 months ago

@manuelfuenmayor can you do the resource ones first?

manuelfuenmayor commented 3 months ago

That is done in https://github.com/metanorma/iso-10303-templates/commit/3fefdd2d4f3ed80bc10e5828209e70a667535f92

ronaldtse commented 3 months ago

Thanks @manuelfuenmayor !

ronaldtse commented 3 months ago

@manuelfuenmayor can you also help remove all the YAML files that are no longer needed?

manuelfuenmayor commented 3 months ago

Done