# /=====================================================================\ 
# |  LaTeXML-block.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"

## The block module defines the following `physical' block elements.
Block.class |= 
   p | equation | equationgroup | quote | block | listing
 | itemize | enumerate | description | pagination

## These are inline forms of logical lists
## (they are included in Misc since that has been the general strategy)
Misc.class |=  inline-itemize | inline-enumerate | inline-description

## Additional Metadata that can be present in equations.
EquationMeta.class = constraint

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

p =
## A physical paragraph.
element p { p_attributes, p_model }

## Attributes for \elementref{p}.
p_attributes =
  Common.attributes,
  ID.attributes,
  Positionable.attributes,
  Backgroundable.attributes

## Content model for \elementref{p}.
p_model = Inline.model

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

constraint = 
## A constraint upon an equation.
element constraint { constraint_attributes, constraint_model }

## Attributes for \elementref{constraint}.
constraint_attributes =
  attribute hidden { xsd:boolean }?,
  Backgroundable.attributes

## Content model for \elementref{constraint}.
constraint_model = Inline.model

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

equation =
## An Equation.  The model is just Inline which includes \elementref{Math},
## the main expected ingredient.
## However, other things can end up in display math, too, so we use Inline.
## Note that tabular is here only because it's a common, if misguided, idiom;
## the processor will lift such elements out of math, when possible
element equation { equation_attributes, equation_model }

## Attributes for \elementref{equation}.
equation_attributes =
  Common.attributes,
  Labelled.attributes,
  Backgroundable.attributes

## Content model for \elementref{equation}.
equation_model =
  tag?, (Math | MathFork  | \text | Misc.class | Meta.class | EquationMeta.class)* 

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

equationgroup =
## A group of equations, perhaps aligned (Though this is nowhere recorded).
element equationgroup { equationgroup_attributes, equationgroup_model }

## Attributes for \elementref{equationgroup}.
equationgroup_attributes =
  Common.attributes,
  Labelled.attributes,
  Backgroundable.attributes,
  ## the spacing between rows (equations, intertext,...)
  attribute rowsep { Length.type}?

## Content model for \elementref{equationgroup}.
equationgroup_model = (equationgroup | equation | p | Meta.class | EquationMeta.class)*

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

MathFork =
## A wrapper for Math that provides alternative,
## but typically less semantically meaningful,
## formatted representations.
## The first child is the meaningful form,
## the extra children provide formatted forms,
## for example being table rows or cells arising from an eqnarray.
element MathFork { MathFork_attributes, MathFork_model }

## Attributes for \elementref{MathFork}.
MathFork_attributes = Common.attributes

## Content model for \elementref{MathFork}.
MathFork_model = (Math|\text), MathBranch*

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

MathBranch =
## A container for an alternatively formatted math representation.
element MathBranch { MathBranch_attributes, MathBranch_model }

## Attributes for \elementref{MathBranch}.
MathBranch_attributes =
  Common.attributes,
  attribute format { text }?

## Content model for \elementref{MathBranch}.
MathBranch_model =  (Math|tr|td)*

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

quote =
## A quotation.
element quote { quote_attributes, quote_model }

## Attributes for \elementref{quote}.
quote_attributes =
  Common.attributes,
  ID.attributes,
  Backgroundable.attributes,

  ## The kind of quotation; could be something like verse, or translation
  attribute role { text }?

## Content model for \elementref{quote}.
quote_model = Block.model
# This was Inline.model, but since quotes can be arbitrarily complex
# including equations, etc, not just verse, should be Block.model, perhaps even Para.model?

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

block =
## A generic block (fallback).
element block { block_attributes, block_model }

## Attributes for \elementref{block}.
block_attributes =
  Common.attributes,
  ID.attributes,
  Positionable.attributes,
  Backgroundable.attributes

## Content model for \elementref{block}.
block_model = Inline.model

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

listing =
## An Listing, (without caption: see \elementref{float})
element listing { listing_attributes, listing_model }

## Attributes for \elementref{listing}.
listing_attributes =
  Common.attributes,
  Labelled.attributes,
  Positionable.attributes,
  Backgroundable.attributes,
  Data.attributes

## Content model for \elementref{listing}.
listing_model = listingline*

#======================================================================
listingline =
## a line in a listing
element listingline { listingline_attributes, listingline_model }

## Attributes for \elementref{listingline}
listingline_attributes =
  Common.attributes,
  ID.attributes

## Content model for \elementref{listingline}
listingline_model =
  tag?, Inline.model
  
#======================================================================

itemize =
## An itemized list.
element itemize { itemize_attributes, itemize_model }

## Attributes for \elementref{itemize}.
itemize_attributes =
  Common.attributes,
  ID.attributes,
  Backgroundable.attributes

## Content model for \elementref{itemize}.
itemize_model = item*

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

enumerate =
## An enumerated list.
element enumerate { enumerate_attributes, enumerate_model }

## Attributes for \elementref{enumerate}.
enumerate_attributes =
  Common.attributes,
  ID.attributes,
  Backgroundable.attributes

## Content model for \elementref{enumerate}.
enumerate_model = item*

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

description =
## A description list. The \elementref{item}s within are expected to have a \elementref{tag}
## which represents the term being described in each \elementref{item}.
element description { description_attributes, description_model }

## Attributes for \elementref{description}.
description_attributes =
  Common.attributes,
  ID.attributes,
  Backgroundable.attributes

## Content model for \elementref{description}.
description_model = item*

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

item =
## An item within a list (\elementref{itemize},\elementref{enumerate} or \elementref{description}).
element item { item_attributes, item_model }

## Attributes for \elementref{item}.
item_attributes =
  Common.attributes,
  Labelled.attributes,
  Backgroundable.attributes,

  ## the vertical spacing between items
  attribute itemsep { Length.type}?

## Content model for \elementref{item}.
item_model =   tag?, Para.model

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

inline-itemize =
## An inline form of itemized list.
element inline-itemize { inline-itemize_attributes, inline-itemize_model }

## Attributes for \elementref{inline-itemize}.
inline-itemize_attributes =
  Common.attributes,
  ID.attributes,
  Backgroundable.attributes

## Content model for \elementref{inline-itemize}.
inline-itemize_model = inline-item*

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

inline-enumerate =
## An inline form of enumerated list.
element inline-enumerate { inline-enumerate_attributes, inline-enumerate_model }

## Attributes for \elementref{inline-enumerate}.
inline-enumerate_attributes =
  Common.attributes,
  ID.attributes,
  Backgroundable.attributes

## Content model for \elementref{inline-enumerate}.
inline-enumerate_model = inline-item*

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

inline-description =
## An inline form of description list.
## The \elementref{inline-item}s within are expected to have a \elementref{tag}
## which represents the term being described in each \elementref{inline-item}.
element inline-description { inline-description_attributes, inline-description_model }

## Attributes for \elementref{inline-description}.
inline-description_attributes =
  Common.attributes,
  ID.attributes,
  Backgroundable.attributes

## Content model for \elementref{inline-description}.
inline-description_model = inline-item*

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

inline-item =
## An item within an inline list (\elementref{inline-itemize},\elementref{inline-enumerate}
## or \elementref{inline-description}).
element inline-item { inline-item_attributes, inline-item_model }

## Attributes for \elementref{item}.
inline-item_attributes =
  Common.attributes,
  Labelled.attributes,
  Backgroundable.attributes

## Content model for \elementref{inline-item}.
inline-item_model =   tag?, (Inline.class | Misc.class | Meta.class)*

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

tag =
## A tag within an item indicating the term or bullet for a given item.
element tag { tag_attributes, tag_model }

## Attributes for \elementref{tag}.
tag_attributes =
  Common.attributes,
  Backgroundable.attributes,

  ## specifies an open delimiters used to display the tag.
  attribute open { text }?,

  ## specifies an close delimiters used to display the tag.
  attribute close { text }?

## Content model for \elementref{tag}.
tag_model = Inline.model

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

pagination =
## A page break or related pagination information.
element pagination {  pagination_attributes, pagination_model }

## Attributes for \elementref{pagination}.
pagination_attributes =
  Common.attributes,
  ## what kind of pagination
  attribute role { text }?

## Content model for \elementref{pagination}.
pagination_model = empty

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