# /=====================================================================\ 
# |  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 {
  Common.attributes,
  (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 {
  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 }?,
  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 {
  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 }?,
  Inline.model }

bibblock =
## A block of data appearing within a \elementref{bibitem}.
element bibblock {
  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 {
  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 },
  Bibentry.class*  }

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
# ---------------------------------------------------------------------
# Name related information
bib-name =
## Name of some participant in creating a bibliographic entry.
element bib-name {
  Common.attributes,
  ## The role that this participant played in creating the entry.
  attribute role { ("author" | "editor" | "translator" | text) }?,
  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 {
  Inline.model }

givenname =
## Given name of a participant (\elementref{bib-name}).
element givenname {
  Inline.model }

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

# ---------------------------------------------------------------------
# Title related information
bib-title =
## Title of a bibliographic entry.
element bib-title {
  Common.attributes,
  Inline.model }

bib-subtitle =
## Subtitle of a bibliographic entry.
element bib-subtitle {
  Common.attributes,
  Inline.model }

bib-key =
## Unique key of a bibliographic entry.
element bib-key {
  Common.attributes,
  Inline.model }

bib-type =
## Type of a bibliographic entry.
element bib-type {
  Common.attributes,
  Inline.model }

bib-date =
## Date of a bibliographic entry.
element bib-date {
  Common.attributes,
  ## characterizes what happened on the given date
  attribute role { ("publication" | "copyright" | text) }?,
  Inline.model }

bib-publisher =
## Publisher of a bibliographic entry.
element bib-publisher {
  Common.attributes,
  Inline.model }

bib-organization =
## Organization responsible for a bibliographic entry.
element bib-organization {
  Common.attributes,
  Inline.model }

bib-place =
## Location of publisher or event
element bib-place {
  Common.attributes,
  Inline.model }

# ---------------------------------------------------------------------
bib-related =
## A Related bibliographic object, such as the book or journal
## that the current item is related to.
element bib-related {
  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 }?,
  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 {
  Common.attributes,
  ## indicates how the value partitions the containing object.
  attribute role { ("pages" | "part" | "volume" | "issue" | "number"
  	             | "chapter" | "section" | "paragraph" | text) }?,
  Inline.model }
 
# ---------------------------------------------------------------------
# 

bib-edition =
## Edition of a bibliographic entry.
element bib-edition {
  Common.attributes,
  Inline.model }

bib-status =
## Status of a bibliographic entry.
element bib-status {
  Common.attributes,
  Inline.model }

bib-identifier =
## Some form of document identfier. The content is descriptive.
element bib-identifier {
  Common.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}?,
  ## a url to the document, if available
  attribute href { text}?,
  Inline.model }

bib-review =
## Review of a bibliographic entry. The content is descriptive.
element bib-review {
  Common.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}?,
  ## a url to the review, if available
  attribute href { text}?,
  Inline.model }

bib-links =
## Links to other things like preprints, source code, etc.
element bib-links {
  Common.attributes,
  Inline.model }

bib-language =
## Language of a bibliographic entry.
element bib-language {
  Common.attributes,
  Inline.model }

bib-url =
## A URL for a bibliographic entry. The content is descriptive
element bib-url {
  Common.attributes,
  attribute href { text }?,
  Inline.model }

bib-extract =
## An extract from the referenced object.
element bib-extract {
  Common.attributes,
  ## Classify what kind of extract
  attribute role { ("keywords" | "abstract" | "contents" | text) }?,
  Inline.model }

bib-note =
## Notes about a bibliographic entry.
element bib-note {
  Common.attributes,
  ## Classify the kind of note
  attribute role { ("annotation" | "publication" | text) }?,
  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
