Skip to content

Commit

Permalink
Refactored inline markup types to simplify.
Browse files Browse the repository at this point in the history
  • Loading branch information
david-waltermire authored and aj-stein-nist committed Jan 10, 2023
1 parent 10cd195 commit 5909f96
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 69 deletions.
7 changes: 4 additions & 3 deletions schema/xml/metaschema-markup-line.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

<xs:include schemaLocation="metaschema-prose-base.xsd"/>


<xs:complexType name="MarkupLineDatatype" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="inlineMarkupGroup"/>
</xs:choice>
<xs:complexContent>
<xs:extension base="inlineMarkupType"/>
</xs:complexContent>
</xs:complexType>
</xs:schema>
27 changes: 10 additions & 17 deletions schema/xml/metaschema-markup-multiline.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

<xs:group name="blockElementGroup">
<xs:choice>
<xs:element name="h1" type="inlineType"/>
<xs:element name="h2" type="inlineType"/>
<xs:element name="h3" type="inlineType"/>
<xs:element name="h4" type="inlineType"/>
<xs:element name="h5" type="inlineType"/>
<xs:element name="h6" type="inlineType"/>
<xs:element name="p" type="inlineType"/>
<xs:element name="h1" type="inlineMarkupType"/>
<xs:element name="h2" type="inlineMarkupType"/>
<xs:element name="h3" type="inlineMarkupType"/>
<xs:element name="h4" type="inlineMarkupType"/>
<xs:element name="h5" type="inlineMarkupType"/>
<xs:element name="h6" type="inlineMarkupType"/>
<xs:element name="p" type="inlineMarkupType"/>
<xs:element name="ul" type="listType"/>
<xs:element name="ol" type="listType"/>
<xs:element name="pre" type="preformattedType"/>
Expand All @@ -35,18 +35,11 @@
td th: phrase inline markup, a, insert, img (phrase+img)
-->


<xs:complexType name="inlineType" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="inlineMarkupGroup"/>
</xs:choice>
</xs:complexType>

<xs:complexType name="preformattedType" mixed="true">
<xs:complexContent>
<xs:extension base="inlineType">
<xs:extension base="inlineMarkupType">
<xs:annotation>
<xs:documentation>The content model is the same as inlineType, but line endings need
<xs:documentation>The content model is the same as inlineMarkupType, but line endings need
to be preserved, since this is preformatted.</xs:documentation>
</xs:annotation>
</xs:extension>
Expand Down Expand Up @@ -85,7 +78,7 @@
<xs:complexType name="tableCellType" mixed="true">
<xs:complexContent>
<!-- TODO: consider adding a choice between the inline or paragraphs. We need to figure out what is supported in Markdown. -->
<xs:extension base="inlineType">
<xs:extension base="inlineMarkupType">
<!-- TODO: need to add support for alignment. usnistgov/metaschema#70 -->
<xs:attribute name="align" type="alignType" default="left"/>
</xs:extension>
Expand Down
36 changes: 15 additions & 21 deletions schema/xml/metaschema-prose-base.xsd
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

<xs:complexType name="inlineMarkupType" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="inlineMarkupGroup"/>
</xs:choice>
</xs:complexType>

<xs:group name="inlineMarkupGroup">
<xs:choice>
<xs:element name="a" type="anchorType"/>
<xs:element name="insert" type="insertType"/>
<xs:group ref="phraseMarkupGroup"/>
<xs:group ref="imageMarkupGroup"/>
</xs:choice>
</xs:group>
<xs:group name="imageMarkupGroup">
<xs:choice>
<xs:element name="img" type="imageType"/>
</xs:choice>
</xs:group>
<xs:group name="phraseMarkupGroup">
<xs:choice>
<xs:element name="code" type="inlineMarkupType" minOccurs="1"/>
<xs:element name="em" type="inlineMarkupType" minOccurs="1"/>
<xs:element name="i" type="inlineMarkupType" minOccurs="1"/>
<xs:element name="b" type="inlineMarkupType" minOccurs="1"/>
<xs:element name="strong" type="inlineMarkupType" minOccurs="1"/>
<xs:element name="sub" type="inlineMarkupType" minOccurs="1"/>
<xs:element name="sup" type="inlineMarkupType" minOccurs="1"/>
<xs:element name="q" type="inlineMarkupType" minOccurs="1"/>
<xs:element name="code" type="inlineMarkupType"/>
<xs:element name="em" type="inlineMarkupType"/>
<xs:element name="i" type="inlineMarkupType"/>
<xs:element name="b" type="inlineMarkupType"/>
<xs:element name="strong" type="inlineMarkupType"/>
<xs:element name="sub" type="inlineMarkupType"/>
<xs:element name="sup" type="inlineMarkupType"/>
<xs:element name="q" type="inlineMarkupType"/>
<xs:element name="img" type="imageType"/>
</xs:choice>
</xs:group>
<xs:complexType name="inlineMarkupType" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="inlineMarkupGroup"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="imageType">
<xs:attribute name="alt" type="xs:string"/>
<xs:attribute name="src" use="required" type="xs:anyURI"/>
Expand All @@ -39,7 +34,6 @@
<xs:complexType name="anchorType" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="phraseMarkupGroup"/>
<xs:group ref="imageMarkupGroup"/>
</xs:choice>
<xs:attribute name="href" type="xs:anyURI"/>
</xs:complexType>
Expand Down
53 changes: 25 additions & 28 deletions schema/xml/metaschema.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,7 @@
<xs:element name="json-base-uri" type="JsonBaseUriType"/>
<xs:element name="remarks" type="RemarksType" minOccurs="0"/>

<xs:element name="import" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>To import a set of Metaschema definitions from an out-of-line resource, supporting reuse of common information structures.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attribute name="href" type="URIReferenceDatatype" use="required">
<xs:annotation>
<xs:documentation>A relative or absolute URI for retrieving an out-of-line Metaschema definition.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="import" type="MetaschemaImportType" minOccurs="0" maxOccurs="unbounded"/>

<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="define-assembly" type="GlobalAssemblyDefinitionType"/>
Expand Down Expand Up @@ -96,7 +85,7 @@
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="MarkupLineDatatype">
<xs:element name="name" type="StringDatatype">
<xs:annotation>
<xs:documentation>The name of this constraint set.</xs:documentation>
</xs:annotation>
Expand Down Expand Up @@ -161,10 +150,25 @@
</xs:complexType>
</xs:element>

<xs:complexType name="MetaschemaImportType">
<xs:annotation>
<xs:documentation>Imports a set of Metaschema definitions from an out-of-line resource, supporting reuse of common information structures.</xs:documentation>
</xs:annotation>
<xs:attribute name="href" type="URIReferenceDatatype" use="required">
<xs:annotation>
<xs:documentation>A relative or absolute URI for retrieving an out-of-line Metaschema definition.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>

<xs:group name="DefinitionMetadataGroup">
<xs:sequence>
<xs:element name="formal-name" type="FormalNameType" minOccurs="0"/>
<xs:element name="description" type="DescriptionType" minOccurs="0"/>
<xs:element name="description" type="MarkupLineDatatype" minOccurs="0">
<xs:annotation>
<xs:documentation>A short description of the data construct that provides basic documentation of the construct's purpose.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="prop" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/>
<!--
When using:
Expand All @@ -187,7 +191,7 @@
<prop name="identifier-scope" value="cross-instance"/>
Must be one of:
<prop name="identifier-persistence" value="per-instance"/>
<prop name="identifier-persistence" value="per-subject"/>
<prop name="identifier-persistence" value="change-on-write"/>
-->
</xs:sequence>
Expand Down Expand Up @@ -407,18 +411,6 @@
<xs:restriction base="URIDatatype"/>
</xs:simpleType>

<xs:complexType name="DescriptionType">
<xs:annotation>
<xs:documentation>A short description of the data construct, to be inserted into
documentation. Unlike 'formal-name' this should not simply repeat what is readily
discernible from a tag (element name or JSON label), but say a little more about
it.</xs:documentation>
</xs:annotation>
<xs:complexContent>
<xs:extension base="MarkupLineDatatype"/>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="RemarksType">
<xs:annotation>
<xs:documentation>Any explanatory or helpful information to be provided in the
Expand Down Expand Up @@ -1049,7 +1041,12 @@

<xs:complexType name="ExampleType">
<xs:sequence>
<xs:element name="description" type="DescriptionType" minOccurs="0"/>
<xs:element name="description" type="MarkupLineDatatype" minOccurs="0">
<xs:annotation>
<xs:documentation>A short description of the example that provides basic documentation about the example's purpose.</xs:documentation>
</xs:annotation>

</xs:element>
<xs:element name="remarks" type="RemarksType" minOccurs="0"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any namespace="##other" processContents="lax"/>
Expand Down

0 comments on commit 5909f96

Please sign in to comment.