# /=====================================================================\ 
# |  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=/

default namespace = "http://dlmf.nist.gov/LaTeXML"

## Meta elements are generally hidden;
## they can appear in both inline and block contexts.
Meta.class   |= note | declare | indexmark | glossarydefinition | rdf | ERROR | resource | navigation

#======================================================================

note =
## Metadata that covers several `out of band' annotations.
## It's content allows both inline and block-level content.
element note { note_attributes, note_model }

## Attributes for \elementref{note}.
note_attributes =
  Common.attributes,
  Labelled.attributes,

  ## indicates the desired visible marker to be linked to the note.
  attribute mark { text }?,

  ## indicates the kind of note
  attribute role { "footnote" | text }?

## Content model for \elementref{note}.
note_model = tags?, Flow.model

# should mark be more like label/refnum ?

#======================================================================
declare =
## declare records declarative mathematical information.
element declare { declare_attributes, declare_model }

## Attributes for \elementref{declare}.
declare_attributes =
  ID.attributes,

  ## the type of declaration
  attribute type { text }?,

  ## the thing being defined (if global), else must have xml:id
  attribute definiens { text }?,

  ## the sort key for use creating notation indices
  attribute sortkey { text }?

## Content model for \elementref{declare}
declare_model =
  ## various tags, short labels
  tags?,

  ## long description
  \text?

#======================================================================

indexmark =
## Metadata to record an indexing position. The content is 
## a sequence of \elementref{indexphrase}, each representing a level in
## a multilevel indexing entry.
element indexmark { indexmark_attributes, indexmark_model }

## Attributes for \elementref{indexmark}.
indexmark_attributes =
  Common.attributes,
  Listable.attributes,
  ## a flattened form (like \attr{key}) of another \elementref{indexmark},
  ## used to crossreference.
  attribute see_also { text }?,

  ## NOTE: describe this.
  attribute style { text }?

## Content model for \elementref{indexmark}.
indexmark_model = indexphrase*, indexsee*

#----------------------------------------------------------------------

indexphrase =
## A phrase within an \elementref{indexmark}
element indexphrase { indexphrase_attributes, indexphrase_model }

## Attributes for \elementref{indexphrase}.
indexphrase_attributes =
  Common.attributes,

  ## a flattened form of the phrase for generating an \attr{ID}.
  attribute key { text }?

## Content model for \elementref{indexphrase}.
indexphrase_model = Inline.model

#----------------------------------------------------------------------

indexsee =
## A see-also phrase within an \elementref{indexmark}
element indexsee { indexsee_attributes, indexsee_model }

## Attributes for \elementref{indexsee}.
indexsee_attributes =
  Common.attributes,

  ## a flattened form of the phrase for generating an \attr{ID}.
  attribute key { text }?,

  ## a name for the see phrase, such as "see also".
  attribute name { text }?

## Content model for \elementref{indexsee}.
indexsee_model = Inline.model

#======================================================================

glossarydefinition =
## A definition within an \elementref{glossaryentry}
element glossarydefinition { glossarydefinition_attributes, glossarydefinition_model }

## Attributes for \elementref{glossarydefinition}.
glossarydefinition_attributes =
  Common.attributes,
  Listable.attributes,

  ## a flattened form of the definition for generating an \attr{ID}.
  attribute key { text }?

## Content model for \elementref{glossarydefinition}.
glossarydefinition_model = glossaryphrase*

#----------------------------------------------------------------------

glossaryphrase =
## A phrase being clarified within an \elementref{glossaryentry}
element glossaryphrase { glossaryphrase_attributes, glossaryphrase_model }

## Attributes for \elementref{glossaryphrase}.
glossaryphrase_attributes =
  Common.attributes,
  IDREF.attributes,
  
  ## a flattened form of the phrase for generating an \attr{ID}.
  attribute key { text }?,
  ## a keyword naming the format of this phrase (to match \attr{show} in \elementref{glossaryref}).
  attribute role { text }?

## Content model for \elementref{glossaryphrase}.
glossaryphrase_model = Inline.model

#======================================================================

rdf =
## A container for RDF annotations.
## (See document structure for rdf-prefixes attribute)
element rdf { rdf_attributes, rdf_model }

## Attributes for \elementref{rdf}
rdf_attributes =
  Common.attributes

## Content model for \elementref{rdf}
rdf_model = Flow.model

#======================================================================

ERROR =
## error object for undefined control sequences, or whatever
element ERROR { ERROR_attributes, ERROR_model }

## Attributes for \elementref{ERROR}.
ERROR_attributes =
  Common.attributes,
  ID.attributes

## Content model for \elementref{ERROR}.
ERROR_model = text*

#======================================================================
# Document-level (or sub-document level) Meta objects

resource =
## a resource for use in further processing such as javascript or CSS
element resource { resource_attributes, resource_model }

## Attributes for \elementref{resource}.
resource_attributes = 
  Common.attributes,

  ## the source url to the resource
  attribute src { text }?,

  ## the mime type of the resource
  attribute type { text }?,

  ## the media for which this resource is applicable
  ## (in the sense of CSS).
  attribute media { text }?

#anyElement = element * { (attribute * { text } | text | anyElement) * }

#resource_model = (text | anyElement)*

resource_model = text*

#----------------------------------------------------------------------

navigation =
## Records navigation cross-referencing information,
## or serves as a container for page navigational blocks.
element navigation { navigation_attributes, navigation_model }

## Attributes for \elementref{navigation}.
navigation_attributes = Common.attributes

## Content model for \elementref{navigation}.
## A \elementref{inline-para} 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.
##  top-level elements, presumably block-level,
navigation_model = ( ref | TOC | inline-para )*

#======================================================================
