<?xml version="1.0" encoding="UTF-8"?>
<!--
  /=====================================================================\
  |  LaTeXML-meta.rnc                                                   |
  | RelaxNG model for LaTeXML generated documents                       |
  |=====================================================================|
  | Part of LaTeXML:                                                    |
  |  Public domain software, produced as part of work done by the       |
  |  United States Government & not subject to copyright in the US.     |
  |=====================================================================|
  | Bruce Miller <bruce.miller@nist.gov>                        #_#     |
  | http://dlmf.nist.gov/LaTeXML/                              (o o)    |
  \=========================================================ooo==U==ooo=/
-->
<grammar ns="http://dlmf.nist.gov/LaTeXML" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
  <define name="Meta.class" combine="choice">
    <a:documentation>Meta elements are generally hidden;
they can appear in both inline and block contexts.</a:documentation>
    <choice>
      <ref name="note"/>
      <ref name="declare"/>
      <ref name="indexmark"/>
      <ref name="glossarydefinition"/>
      <ref name="rdf"/>
      <ref name="resource"/>
      <ref name="navigation"/>
    </choice>
  </define>
  <!-- ====================================================================== -->
  <define name="note">
    <element name="note">
      <a:documentation>Metadata that covers several `out of band' annotations.
It's content allows both inline and block-level content.</a:documentation>
      <ref name="note_attributes"/>
      <ref name="note_model"/>
    </element>
  </define>
  <define name="note_attributes">
    <a:documentation>Attributes for \elementref{note}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="Labelled.attributes"/>
    <optional>
      <attribute name="mark">
        <a:documentation>indicates the desired visible marker to be linked to the note.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="role">
        <a:documentation>indicates the kind of note</a:documentation>
        <choice>
          <value>footnote</value>
          <text/>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="note_model">
    <a:documentation>Content model for \elementref{note}.</a:documentation>
    <optional>
      <ref name="tags"/>
    </optional>
    <ref name="Flow.model"/>
  </define>
  <!-- should mark be more like label/refnum ? -->
  <!-- ====================================================================== -->
  <define name="declare">
    <element name="declare">
      <a:documentation>declare records declarative mathematical information.</a:documentation>
      <ref name="declare_attributes"/>
      <ref name="declare_model"/>
    </element>
  </define>
  <define name="declare_attributes">
    <a:documentation>Attributes for \elementref{declare}.</a:documentation>
    <ref name="ID.attributes"/>
    <optional>
      <attribute name="type">
        <a:documentation>the type of declaration</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="definiens">
        <a:documentation>the thing being defined (if global), else must have xml:id</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="sortkey">
        <a:documentation>the sort key for use creating notation indices</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="declare_model">
    <a:documentation>Content model for \elementref{declare}</a:documentation>
    <optional>
      <ref name="tags">
        <a:documentation>various tags, short labels</a:documentation>
      </ref>
    </optional>
    <optional>
      <ref name="text">
        <a:documentation>long description</a:documentation>
      </ref>
    </optional>
  </define>
  <!-- ====================================================================== -->
  <define name="indexmark">
    <element name="indexmark">
      <a:documentation>Metadata to record an indexing position. The content is
a sequence of \elementref{indexphrase}, each representing a level in
a multilevel indexing entry.</a:documentation>
      <ref name="indexmark_attributes"/>
      <ref name="indexmark_model"/>
    </element>
  </define>
  <define name="indexmark_attributes">
    <a:documentation>Attributes for \elementref{indexmark}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="Listable.attributes"/>
    <optional>
      <attribute name="see_also">
        <a:documentation>a flattened form (like \attr{key}) of another \elementref{indexmark},
used to crossreference.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="style">
        <a:documentation>NOTE: describe this.</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="indexmark_model">
    <a:documentation>Content model for \elementref{indexmark}.</a:documentation>
    <zeroOrMore>
      <ref name="indexphrase"/>
    </zeroOrMore>
    <zeroOrMore>
      <ref name="indexsee"/>
    </zeroOrMore>
  </define>
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <define name="indexphrase">
    <element name="indexphrase">
      <a:documentation>A phrase within an \elementref{indexmark}</a:documentation>
      <ref name="indexphrase_attributes"/>
      <ref name="indexphrase_model"/>
    </element>
  </define>
  <define name="indexphrase_attributes">
    <a:documentation>Attributes for \elementref{indexphrase}.</a:documentation>
    <ref name="Common.attributes"/>
    <optional>
      <attribute name="key">
        <a:documentation>a flattened form of the phrase for generating an \attr{ID}.</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="indexphrase_model">
    <a:documentation>Content model for \elementref{indexphrase}.</a:documentation>
    <ref name="Inline.model"/>
  </define>
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <define name="indexsee">
    <element name="indexsee">
      <a:documentation>A see-also phrase within an \elementref{indexmark}</a:documentation>
      <ref name="indexsee_attributes"/>
      <ref name="indexsee_model"/>
    </element>
  </define>
  <define name="indexsee_attributes">
    <a:documentation>Attributes for \elementref{indexsee}.</a:documentation>
    <ref name="Common.attributes"/>
    <optional>
      <attribute name="key">
        <a:documentation>a flattened form of the phrase for generating an \attr{ID}.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="name">
        <a:documentation>a name for the see phrase, such as "see also".</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="indexsee_model">
    <a:documentation>Content model for \elementref{indexsee}.</a:documentation>
    <ref name="Inline.model"/>
  </define>
  <!-- ====================================================================== -->
  <define name="glossarydefinition">
    <element name="glossarydefinition">
      <a:documentation>A definition within an \elementref{glossaryentry}</a:documentation>
      <ref name="glossarydefinition_attributes"/>
      <ref name="glossarydefinition_model"/>
    </element>
  </define>
  <define name="glossarydefinition_attributes">
    <a:documentation>Attributes for \elementref{glossarydefinition}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="Listable.attributes"/>
    <optional>
      <attribute name="key">
        <a:documentation>a flattened form of the definition for generating an \attr{ID}.</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="glossarydefinition_model">
    <a:documentation>Content model for \elementref{glossarydefinition}.</a:documentation>
    <zeroOrMore>
      <ref name="glossaryphrase"/>
    </zeroOrMore>
  </define>
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <define name="glossaryphrase">
    <element name="glossaryphrase">
      <a:documentation>A phrase being clarified within an \elementref{glossaryentry}</a:documentation>
      <ref name="glossaryphrase_attributes"/>
      <ref name="glossaryphrase_model"/>
    </element>
  </define>
  <define name="glossaryphrase_attributes">
    <a:documentation>Attributes for \elementref{glossaryphrase}.</a:documentation>
    <ref name="Common.attributes"/>
    <ref name="IDREF.attributes"/>
    <optional>
      <attribute name="key">
        <a:documentation>a flattened form of the phrase for generating an \attr{ID}.</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="role">
        <a:documentation>a keyword naming the format of this phrase (to match \attr{show} in \elementref{glossaryref}).</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="glossaryphrase_model">
    <a:documentation>Content model for \elementref{glossaryphrase}.</a:documentation>
    <ref name="Inline.model"/>
  </define>
  <!-- ====================================================================== -->
  <define name="rdf">
    <element name="rdf">
      <a:documentation>A container for RDF annotations.
(See document structure for rdf-prefixes attribute)</a:documentation>
      <ref name="rdf_attributes"/>
      <ref name="rdf_model"/>
    </element>
  </define>
  <define name="rdf_attributes">
    <a:documentation>Attributes for \elementref{rdf}</a:documentation>
    <ref name="Common.attributes"/>
  </define>
  <define name="rdf_model">
    <a:documentation>Content model for \elementref{rdf}</a:documentation>
    <ref name="Flow.model"/>
  </define>
  <!--
    ======================================================================
    Document-level (or sub-document level) Meta objects
  -->
  <define name="resource">
    <element name="resource">
      <a:documentation>a resource for use in further processing such as javascript or CSS</a:documentation>
      <ref name="resource_attributes"/>
      <ref name="resource_model"/>
    </element>
  </define>
  <define name="resource_attributes">
    <a:documentation>Attributes for \elementref{resource}.</a:documentation>
    <ref name="Common.attributes"/>
    <optional>
      <attribute name="src">
        <a:documentation>the source url to the resource</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="type">
        <a:documentation>the mime type of the resource</a:documentation>
      </attribute>
    </optional>
    <optional>
      <attribute name="media">
        <a:documentation>the media for which this resource is applicable
(in the sense of CSS).</a:documentation>
      </attribute>
    </optional>
  </define>
  <!-- anyElement = element * { (attribute * { text } | text | anyElement) * } -->
  <!-- resource_model = (text | anyElement)* -->
  <define name="resource_model">
    <zeroOrMore>
      <text/>
    </zeroOrMore>
  </define>
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <define name="navigation">
    <element name="navigation">
      <a:documentation>Records navigation cross-referencing information,
or serves as a container for page navigational blocks.
An \elementref{inline-logical-block} child should have attribute \attr{class}
being one of \texttt{ltx_page_navbar}, \texttt{ltx_page_header}
or \texttt{ltx_page_footer} and its contents will be used to create those components of webpages.
Lacking those, a \elementref{TOC} requests a table of contents
in the navigation bar. Page headers and footers will be synthesized from
Links from the current page or document to related ones;
these are represented by \elementref{ref} elements with \attr{rel}
being up, down, previous, next, and so forth.</a:documentation>
      <ref name="navigation_attributes"/>
      <ref name="navigation_model"/>
    </element>
  </define>
  <define name="navigation_attributes">
    <a:documentation>Attributes for \elementref{navigation}.</a:documentation>
    <ref name="Common.attributes"/>
  </define>
  <define name="navigation_model">
    <a:documentation>Content model for \elementref{navigation}.</a:documentation>
    <zeroOrMore>
      <choice>
        <ref name="ref"/>
        <ref name="TOC"/>
        <ref name="inline-logical-block"/>
      </choice>
    </zeroOrMore>
  </define>
</grammar>
<!-- ====================================================================== -->
