metanorma/metanorma-gb

View on GitHub
lib/asciidoctor/gb/isostandard.rng

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <!-- default namespace isostandard = "https://www.metanorma.com/ns/iso" -->
  <include href="isodoc.rng">
    <start>
      <ref name="iso-standard"/>
    </start>
    <define name="organization">
      <element name="organization">
        <oneOrMore>
          <ref name="orgname"/>
        </oneOrMore>
        <optional>
          <ref name="abbreviation"/>
        </optional>
        <optional>
          <ref name="uri"/>
        </optional>
        <zeroOrMore>
          <ref name="org-identifier"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="contact"/>
        </zeroOrMore>
        <optional>
          <ref name="technical-committee"/>
        </optional>
        <optional>
          <ref name="subcommittee"/>
        </optional>
        <optional>
          <ref name="workgroup"/>
        </optional>
        <optional>
          <ref name="secretariat"/>
        </optional>
      </element>
    </define>
    <define name="BibDataExtensionType">
      <ref name="doctype"/>
      <ref name="editorialgroup"/>
      <zeroOrMore>
        <ref name="ics"/>
      </zeroOrMore>
      <ref name="structuredidentifier"/>
      <optional>
        <ref name="stagename"/>
      </optional>
    </define>
    <define name="bdate">
      <element name="date">
        <attribute name="type">
          <choice>
            <ref name="BibliographicDateType"/>
            <text/>
          </choice>
        </attribute>
        <choice>
          <group>
            <element name="from">
              <ref name="ISO8601Date"/>
            </element>
            <optional>
              <element name="to">
                <ref name="ISO8601Date"/>
              </element>
            </optional>
          </group>
          <element name="on">
            <choice>
              <ref name="ISO8601Date"/>
              <value>--</value>
              <value>–</value>
            </choice>
          </element>
        </choice>
      </element>
    </define>
    <define name="ul">
      <element name="ul">
        <attribute name="id">
          <data type="ID"/>
        </attribute>
        <oneOrMore>
          <ref name="ul_li"/>
        </oneOrMore>
        <zeroOrMore>
          <ref name="note"/>
        </zeroOrMore>
      </element>
    </define>
    <define name="sections">
      <element name="sections">
        <zeroOrMore>
          <choice>
            <ref name="note"/>
            <ref name="admonition"/>
          </choice>
        </zeroOrMore>
        <ref name="clause"/>
        <optional>
          <choice>
            <ref name="term-clause"/>
            <ref name="terms"/>
          </choice>
        </optional>
        <optional>
          <ref name="definitions"/>
        </optional>
        <oneOrMore>
          <ref name="clause"/>
        </oneOrMore>
      </element>
    </define>
    <define name="Clause-Section">
      <optional>
        <attribute name="id">
          <data type="ID"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="language"/>
      </optional>
      <optional>
        <attribute name="script"/>
      </optional>
      <optional>
        <attribute name="inline-header">
          <data type="boolean"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="obligation">
          <choice>
            <value>normative</value>
            <value>informative</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <ref name="section-title"/>
      </optional>
      <choice>
        <group>
          <oneOrMore>
            <ref name="BasicBlock"/>
          </oneOrMore>
          <zeroOrMore>
            <ref name="note"/>
          </zeroOrMore>
        </group>
        <oneOrMore>
          <ref name="clause-subsection"/>
        </oneOrMore>
      </choice>
    </define>
    <define name="term">
      <element name="term">
        <optional>
          <attribute name="id">
            <data type="ID"/>
          </attribute>
        </optional>
        <ref name="preferred"/>
        <zeroOrMore>
          <ref name="admitted"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="deprecates"/>
        </zeroOrMore>
        <optional>
          <ref name="termdomain"/>
        </optional>
        <ref name="definition"/>
        <zeroOrMore>
          <ref name="termnote"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="termexample"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="termsource"/>
        </zeroOrMore>
      </element>
    </define>
    <define name="definition">
      <element name="definition">
        <oneOrMore>
          <choice>
            <ref name="paragraph"/>
            <ref name="figure"/>
            <ref name="formula"/>
          </choice>
        </oneOrMore>
      </element>
    </define>
    <define name="annex">
      <element name="annex">
        <optional>
          <attribute name="id">
            <data type="ID"/>
          </attribute>
        </optional>
        <optional>
          <attribute name="language"/>
        </optional>
        <optional>
          <attribute name="script"/>
        </optional>
        <optional>
          <attribute name="inline-header">
            <data type="boolean"/>
          </attribute>
        </optional>
        <optional>
          <attribute name="obligation">
            <choice>
              <value>normative</value>
              <value>informative</value>
            </choice>
          </attribute>
        </optional>
        <optional>
          <ref name="section-title"/>
        </optional>
        <zeroOrMore>
          <!--
            allow hanging paragraps in annexes: they introduce lists
            ( paragraph-with-footnote | table | note | formula | admonition | ol | ul | dl | figure | quote | sourcecode | review | example )*,
          -->
          <ref name="BasicBlock"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="note"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="clause-hanging-paragraph-with-footnote"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="annex-appendix"/>
        </zeroOrMore>
      </element>
    </define>
    <define name="AdmonitionType">
      <choice>
        <value>danger</value>
        <value>caution</value>
        <value>warning</value>
        <value>important</value>
        <value>safety precautions</value>
      </choice>
    </define>
    <define name="preface">
      <element name="preface">
        <optional>
          <ref name="abstract"/>
        </optional>
        <ref name="foreword"/>
        <optional>
          <ref name="introduction"/>
        </optional>
      </element>
    </define>
    <define name="DocumentType">
      <choice>
        <value>international-standard</value>
        <value>technical-specification</value>
        <value>technical-report</value>
        <value>publicly-available-specification</value>
        <value>international-workshop-agreement</value>
        <value>guide</value>
        <value>amendment</value>
        <value>technical-corrigendum</value>
      </choice>
    </define>
    <define name="structuredidentifier">
      <element name="structuredidentifier">
        <optional>
          <attribute name="type"/>
        </optional>
        <group>
          <ref name="documentnumber"/>
          <optional>
            <ref name="tc-documentnumber"/>
          </optional>
        </group>
      </element>
    </define>
    <define name="foreword">
      <element name="foreword">
        <ref name="Basic-Section"/>
      </element>
    </define>
    <define name="introduction">
      <element name="introduction">
        <ref name="Content-Section"/>
      </element>
    </define>
    <define name="editorialgroup">
      <element name="editorialgroup">
        <oneOrMore>
          <ref name="technical-committee"/>
        </oneOrMore>
        <zeroOrMore>
          <ref name="subcommittee"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="workgroup"/>
        </zeroOrMore>
        <optional>
          <ref name="secretariat"/>
        </optional>
      </element>
    </define>
    <define name="Content-Section">
      <optional>
        <attribute name="id">
          <data type="ID"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="language"/>
      </optional>
      <optional>
        <attribute name="script"/>
      </optional>
      <optional>
        <attribute name="obligation">
          <choice>
            <value>normative</value>
            <value>informative</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <ref name="section-title"/>
      </optional>
      <choice>
        <group>
          <zeroOrMore>
            <ref name="BasicBlock"/>
          </zeroOrMore>
          <zeroOrMore>
            <ref name="note"/>
          </zeroOrMore>
        </group>
        <oneOrMore>
          <ref name="content-subsection"/>
        </oneOrMore>
      </choice>
    </define>
    <define name="table">
      <element name="table">
        <attribute name="id">
          <data type="ID"/>
        </attribute>
        <optional>
          <attribute name="width"/>
        </optional>
        <optional>
          <attribute name="unnumbered">
            <data type="boolean"/>
          </attribute>
        </optional>
        <optional>
          <attribute name="number"/>
        </optional>
        <optional>
          <attribute name="subsequence"/>
        </optional>
        <optional>
          <attribute name="alt"/>
        </optional>
        <optional>
          <attribute name="summary"/>
        </optional>
        <optional>
          <attribute name="uri">
            <data type="anyURI"/>
          </attribute>
        </optional>
        <optional>
          <ref name="tname"/>
        </optional>
        <optional>
          <ref name="thead"/>
        </optional>
        <ref name="tbody"/>
        <optional>
          <ref name="tfoot"/>
        </optional>
        <zeroOrMore>
          <ref name="table-note"/>
        </zeroOrMore>
        <optional>
          <ref name="dl"/>
        </optional>
      </element>
    </define>
  </include>
  <!-- end overrides -->
  <!--
    We display the Normative References between scope and terms; but to keep the
    grammar simple, we keep the references together
  -->
  <define name="iso-standard">
    <element name="iso-standard">
      <attribute name="version"/>
      <attribute name="type">
        <choice>
          <value>semantic</value>
          <value>presentation</value>
        </choice>
      </attribute>
      <ref name="bibdata"/>
      <zeroOrMore>
        <ref name="termdocsource"/>
      </zeroOrMore>
      <optional>
        <ref name="boilerplate"/>
      </optional>
      <ref name="preface"/>
      <oneOrMore>
        <ref name="sections"/>
      </oneOrMore>
      <zeroOrMore>
        <ref name="annex"/>
      </zeroOrMore>
      <ref name="bibliography"/>
    </element>
  </define>
  <define name="documentnumber">
    <element name="project-number">
      <optional>
        <attribute name="part">
          <data type="int"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="subpart">
          <data type="int"/>
        </attribute>
      </optional>
      <text/>
    </element>
  </define>
  <define name="tc-documentnumber">
    <element name="tc-document-number">
      <data type="int"/>
    </element>
  </define>
  <define name="subcommittee">
    <element name="subcommittee">
      <ref name="IsoWorkgroup"/>
    </element>
  </define>
  <define name="workgroup">
    <element name="workgroup">
      <ref name="IsoWorkgroup"/>
    </element>
  </define>
  <define name="secretariat">
    <element name="secretariat">
      <text/>
    </element>
  </define>
  <define name="clause-hanging-paragraph-with-footnote">
    <element name="clause">
      <optional>
        <attribute name="id">
          <data type="ID"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="language"/>
      </optional>
      <optional>
        <attribute name="script"/>
      </optional>
      <optional>
        <attribute name="inline-header">
          <data type="boolean"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="obligation">
          <choice>
            <value>normative</value>
            <value>informative</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <ref name="section-title"/>
      </optional>
      <zeroOrMore>
        <!-- allow hanging paragraphs in annexes: they introduce lists -->
        <ref name="BasicBlock"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="note"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="clause-hanging-paragraph-with-footnote"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="annex-appendix">
    <element name="appendix">
      <ref name="Clause-Section"/>
    </element>
  </define>
  <define name="ul_li">
    <element name="li">
      <optional>
        <attribute name="id">
          <data type="ID"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="uncheckedcheckbox">
          <data type="boolean"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="checkedcheckbox">
          <data type="boolean"/>
        </attribute>
      </optional>
      <oneOrMore>
        <ref name="BasicBlock"/>
      </oneOrMore>
    </element>
  </define>
  <define name="stagename">
    <element name="stagename">
      <text/>
    </element>
  </define>
</grammar>