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

# Would be nice to use somebody elses already-developed DTD...

# Some notes:
# There're two classes of things here:
# bibentry : which would be the translation of a .bib file
# bibitem  : which would be the formatted items in a latex bibliography environment.
#          This latter has typically lost much information during formatting.

biblist =
## A list of bibliographic \elementref{bibentry} or \elementref{bibitem}.
element biblist { biblist_attributes, biblist_model }

## Attributes for \elementref{biblist}.
biblist_attributes = Common.attributes

## Content model for \elementref{biblist}.
biblist_model = (bibentry | bibitem)*

# ======================================================================
# bibitem is the formatted, presentation, form, typically information has been lost;
# it basically contains a biblabel and several bibblock's
# ======================================================================

bibitem =
## A formatted bibliographic item, typically as written explicit
## in a LaTeX article. This has generally lost most of the semantics
## present in the BibTeX data.
element bibitem { bibitem_attributes, bibitem_model }

## Attributes for \elementref{bibitem}.
bibitem_attributes = 
  Common.attributes,
  ID.attributes,
  ## The unique key for this object; this key is referenced by the
  ## \attr{bibrefs} attribute of \elementref{bibref}.
  attribute key { text }?

## Content model for \elementref{bibitem}.
bibitem_model = bibtag*, bibblock*

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

bibtag =
## Various formatted tags for bibliographic items.
## Typically @role refnum is shown in the displayed bibliography,
## as the beginning of the item.  Other roles 
## (eg. number, authors, fullauthors, year, title) record formatted
## info to be used for filling in citations (\elementref{bibref}).
element bibtag { bibtag_attributes, bibtag_model }

## Attributes for \elementref{bibtag}.
bibtag_attributes = 
  attribute role { ("number"|"authors"|"fullauthors"|"key"|"year"|"bibtype"|"title"|text) }?,
  ## A delimiter for formatting the refnum in the bibliography
  attribute open { text }?,
  ## A delimiter for formatting the refnum in the bibliography
  attribute close { text }?

## Content model for \elementref{bibtag}.
bibtag_model = Inline.model

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

bibblock =
## A block of data appearing within a \elementref{bibitem}.
element bibblock { bibblock_attributes, bibblock_model }

## Attributes for \elementref{bibblock}.
bibblock_attributes = empty

## Content model for \elementref{bibblock}.
bibblock_model = Flow.model

# bibblock's model was this:
#  Inline.model }

# ======================================================================
# bibentry is the (more) semantic form, typically extracted from bibtex.
# ======================================================================

bibentry =
## Semantic representation of a bibliography entry, 
## typically resulting from parsing BibTeX
element bibentry { bibentry_attributes, bibentry_model }

bibentry.type =  "article" | "book" | "booklet" | "conference" | "inbook"
                 | "incollection" | "inproceedings" | "manual" | "mastersthesis"
                 | "misc" | "phdthesis" | "proceedings" | "techreport" | "unpublished"
                 | "report" | "thesis" | "website" | "software" | "periodical"
                 | "collection" | "collection.article" | "proceedings.article"
                 | text

## Attributes for \elementref{bibentry}.
bibentry_attributes = 
  Common.attributes,
  ID.attributes,

  ## The unique key for this object; this key is referenced by the
  ## \attr{bibrefs} attribute of \elementref{bibref}.
  attribute key { text },

  ## The type of the referenced object. The values are a superset of
  ## those types recognized by BibTeX, but is also open-ended for extensibility.
  attribute type { bibentry.type }

## Content model for \elementref{bibentry}.
bibentry_model = Bibentry.class*

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

# Name related information
bib-name =
## Name of some participant in creating a bibliographic entry.
element bib-name { bib-name_attributes, bib-name_model }

## Attributes for \elementref{bib-name}.
bib-name_attributes = 
  Common.attributes,
  ## The role that this participant played in creating the entry.
  attribute role { ("author" | "editor" | "translator" | text) }?

## Content model for \elementref{bib-name}.
bib-name_model = Bibname.model

## The content model of the bibliographic name fields (\elementref{bib-name})
Bibname.model =
  surname,  givenname?, lineage?

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

surname =
## Surname of a participant (\elementref{bib-name}).
element surname { surname_attributes, surname_model }

## Attributes for \elementref{surname}.
surname_attributes = empty

## Content model for \elementref{surname}.
surname_model = Inline.model

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

givenname =
## Given name of a participant (\elementref{bib-name}).
element givenname { givenname_attributes, givenname_model }

## Attributes for \elementref{givenname}.
givenname_attributes = empty

## Content model for \elementref{givenname}.
givenname_model = Inline.model

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

lineage =
## Lineage of a participant (\elementref{bib-name}), eg. Jr. or similar.
element lineage { lineage_attributes, lineage_model }

## Attributes for \elementref{lineage}.
lineage_attributes = empty

## Content model for \elementref{lineage}.
lineage_model = Inline.model

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

# Title related information
bib-title =
## Title of a bibliographic entry.
element bib-title { bib-title_attributes, bib-title_model }

## Attributes for \elementref{bib-title}.
bib-title_attributes = Common.attributes

## Content model for \elementref{bib-title}.
bib-title_model = Inline.model
#----------------------------------------------------------------------

bib-subtitle =
## Subtitle of a bibliographic entry.
element bib-subtitle { bib-subtitle_attributes, bib-subtitle_model }

## Attributes for \elementref{bib-subtitle}.
bib-subtitle_attributes = Common.attributes

## Content model for \elementref{bib-subtitle}.
bib-subtitle_model = Inline.model

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

bib-key =
## Unique key of a bibliographic entry.
element bib-key { bib-key_attributes, bib-key_model }

## Attributes for \elementref{bib-key}.
bib-key_attributes = Common.attributes

## Content model for \elementref{bib-key}.
bib-key_model = Inline.model

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

bib-type =
## Type of a bibliographic entry.
element bib-type { bib-type_attributes, bib-type_model }

## Attributes for \elementref{bib-type}.
bib-type_attributes = Common.attributes

## Content model for \elementref{bib-type}.
bib-type_model = Inline.model

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

bib-date =
## Date of a bibliographic entry.
element bib-date { bib-date_attributes, bib-date_model }

## Attributes for \elementref{bib-date}.
bib-date_attributes = 
  Common.attributes,
  ## characterizes what happened on the given date
  attribute role { ("publication" | "copyright" | text) }?

## Content model for \elementref{bib-date}.
bib-date_model = Inline.model

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

bib-publisher =
## Publisher of a bibliographic entry.
element bib-publisher { bib-publisher_attributes, bib-publisher_model }

## Attributes for \elementref{bib-publisher}.
bib-publisher_attributes = Common.attributes

## Content model for \elementref{bib-publisher}.
bib-publisher_model = Inline.model

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

bib-organization =
## Organization responsible for a bibliographic entry.
element bib-organization { bib-organization_attributes, bib-organization_model }

## Attributes for \elementref{bib-organization}.
bib-organization_attributes = Common.attributes

## Content model for \elementref{bib-organization}.
bib-organization_model = Inline.model

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

bib-place =
## Location of publisher or event
element bib-place { bib-place_attributes, bib-place_model }

## Attributes for \elementref{bib-place}.
bib-place_attributes = Common.attributes

## Content model for \elementref{bib-place}.
bib-place_model = Inline.model

# ---------------------------------------------------------------------
bib-related =
## A Related bibliographic object, such as the book or journal
## that the current item is related to.
element bib-related { bib-related_attributes, bib-related_model }

## Attributes for \elementref{bib-related}.
bib-related_attributes = 
  Common.attributes,
  ## The type of this related entry.
  attribute type { bibentry.type }?,
  ## How this object relates to the containing object.
  ## Particularly important is \attrval{host} which indicates that
  ## the outer object is a part of this object.
  attribute role { ("host" | "event" | "original" | text) }?,
  ## If the bibrefs attribute is given, it is the key of another object in the bibliography,
  ## and this element should be empty; otherwise the object should be described by
  ## the content of the element.
  attribute bibrefs { text }?

## Content model for \elementref{bib-related}.
bib-related_model = Bibentry.class*

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

bib-part =
## Describes how the current object is related to a related (\elementref{bib-related})
## object, in particular page, part, volume numbers and similar.
element bib-part { bib-part_attributes, bib-part_model }
 
## Attributes for \elementref{bib-part}.
bib-part_attributes = 
  Common.attributes,
  ## indicates how the value partitions the containing object.
  attribute role { ("pages" | "part" | "volume" | "issue" | "number"
                     | "chapter" | "section" | "paragraph" | text) }?

## Content model for \elementref{bib-part}.
bib-part_model = Inline.model

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

bib-edition =
## Edition of a bibliographic entry.
element bib-edition { bib-edition_attributes, bib-edition_model }

## Attributes for \elementref{bib-edition}.
bib-edition_attributes = Common.attributes

## Content model for \elementref{bib-edition}.
bib-edition_model = Inline.model

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

bib-status =
## Status of a bibliographic entry.
element bib-status { bib-status_attributes, bib-status_model }

## Attributes for \elementref{bib-status}.
bib-status_attributes = Common.attributes

## Content model for \elementref{bib-status}.
bib-status_model = Inline.model

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

bib-identifier =
## Some form of document identfier. The content is descriptive.
element bib-identifier { bib-identifier_attributes, bib-identifier_model }

## Attributes for \elementref{bib-identifier}.
bib-identifier_attributes = 
  Common.attributes,
  Refable.attributes,
  ## indicates what sort of identifier it is; it is open-ended for extensibility.
  attribute scheme { "doi" | "issn" | "isbn" | "mr" | text }?,
  ## the identifier.
  attribute id { text}?

## Content model for \elementref{bib-identifier}.
bib-identifier_model = Inline.model

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

bib-review =
## Review of a bibliographic entry. The content is descriptive.
element bib-review { bib-review_attributes, bib-review_model }

## Attributes for \elementref{bib-review}.
bib-review_attributes = 
  Common.attributes,
  Refable.attributes,
  ## indicates what sort of identifier it is; it is open-ended for extensibility.
  attribute scheme { "doi" | "issn" | "isbn" | "mr" | text }?,
  ## the identifier.
  attribute id { text}?

## Content model for \elementref{bib-review}.
bib-review_model = Inline.model

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

bib-links =
## Links to other things like preprints, source code, etc.
element bib-links { bib-links_attributes, bib-links_model }

## Attributes for \elementref{bib-links}.
bib-links_attributes = Common.attributes

## Content model for \elementref{bib-links}.
bib-links_model = Inline.model

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

bib-language =
## Language of a bibliographic entry.
element bib-language { bib-language_attributes, bib-language_model }

## Attributes for \elementref{bib-language}.
bib-language_attributes = Common.attributes

## Content model for \elementref{bib-language}.
bib-language_model = Inline.model

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

bib-url =
## A URL for a bibliographic entry. The content is descriptive
element bib-url { bib-url_attributes, bib-url_model }

## Attributes for \elementref{bib-url}.
bib-url_attributes = 
  Common.attributes,
  Refable.attributes

## Content model for \elementref{bib-url}.
bib-url_model = Inline.model

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

bib-extract =
## An extract from the referenced object.
element bib-extract { bib-extract_attributes, bib-extract_model }

## Attributes for \elementref{bib-extract}.
bib-extract_attributes = 
  Common.attributes,
  ## Classify what kind of extract
  attribute role { ("keywords" | "abstract" | "contents" | text) }?

## Content model for \elementref{bib-extract}.
bib-extract_model = Inline.model

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

bib-note =
## Notes about a bibliographic entry.
element bib-note { bib-note_attributes, bib-note_model }

## Attributes for \elementref{bib-note}.
bib-note_attributes = 
  Common.attributes,
  ## Classify the kind of note
  attribute role { ("annotation" | "publication" | text) }?

## Content model for \elementref{bib-note}.
bib-note_model = Inline.model

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

bib-data =
## Random data, not necessarily even text.
## (future questions: should model be text or ANY? maybe should have encoding attribute?).
element bib-data { bib-data_attributes, bib-data_model }

## Attributes for \elementref{bib-data}.
bib-data_attributes = 
  Common.attributes,
  ## Classify the relationship of the data to the entry.
  attribute role { text }?,
  ## Classify the type of the data.
  attribute type { text }?

## Content model for \elementref{bib-data}.
bib-data_model = Inline.model

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

Bibentry.class =
  bib-name
  | bib-title
  | bib-subtitle
  | bib-key
  | bib-type
  | bib-date
  | bib-publisher | bib-organization
  | bib-place
  | bib-part
  | bib-related
  | bib-edition
  | bib-status
  | bib-language
  | bib-url
  | bib-note
  | bib-extract
  | bib-identifier
  | bib-review
  | bib-links
  | bib-data

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