Skip to content

Unitsml schema template using Lutaml::Xsd and Metanorma command #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

suleman-uzair
Copy link
Member

This PR adds adoc and liquid files for Unitsml schema documentation generation via Lutaml::Xsd gem.

closes #5

Added complex_type and attribute_groups templates
and added simple_type as partial
@ronaldtse
Copy link
Contributor

ronaldtse commented Aug 22, 2025

@suleman-uzair thanks! Please remove document.html from the latest commit since we shouldn't keep artifacts in the repo.

Also, the document.adoc requires some metadata, please copy the structure from say, sources/unitsdb/document.adoc. Thanks!

<xsd:attributeGroup name="{{attribute_group.name}}">
{%- assign element_order = attribute_group | resolved_element_order: %}
{%- for element in element_order %}
{%- assign attribute_drop = element | class_name_end_with: "::AttributeDrop" -%}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want any "Ruby class names" in Liquid... The attribute variable here should already be the Drop object. Every XSD element should be here as a Drop object.

{%- assign attribute_group_drop = element | class_name_end_with: "::AttributeGroupDrop" -%}
{%- assign simple_type = element.simple_type %}
{%- if attribute_drop %}
<xsd:attribute{{ element | attributes_xml_representation_for: }}{% unless simple_type %}/{% endunless %}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to handcraft XML elements here? We actually want the source directly, which should be provided by the drop (add a "source" method?).

You can see how Expressir stores the source of the parsed content and provides it through the method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create XSD schema driven Metanorma document for UnitsML 1.0
2 participants