diff --git a/grammars/basicdoc.rnc b/grammars/basicdoc.rnc index b31d1ad..ed130dd 100644 --- a/grammars/basicdoc.rnc +++ b/grammars/basicdoc.rnc @@ -15,9 +15,12 @@ sections = section+ } +## Section: groups of blocks within text, which can also contain other sections section = element section { Basic-Section, + ## Sections contained within the current section. The relation is recursive, + ## so the hierarchical arrangement of sections can be arbitrarily deep section* } @@ -27,21 +30,30 @@ LanguageType = text ## Four-letter script code taken from ISO-15924, indicating the script in which the content is written ScriptType = text +## Group of blocks within text, which is a leaf node in the hierarchical organisation of text (does not contain any sections of its own) Basic-Section = - attribute id { xsd:ID }?, + OptionalId, attribute language { LanguageType }?, attribute script { ScriptType }?, + ## Title of the section section-title?, + ## Blocks, containing the textual content of the section + ## (but excluding subsections, which are only present in Hierarchical Sections) BasicBlock* +## Sections containing zero or more bibliographical items (as described in Relaton), along with any prefatory text references = element references { - attribute id { xsd:ID }?, + OptionalId, + ## Title of section section-title?, + ## Prefatory text BasicBlock*, + ## Bibliographical items included in the References section bibitem* } +## Title of a section section-title = element title { TextElement* } @@ -55,7 +67,7 @@ amend = element amend { AmendType } AmendType = - attribute id { xsd:ID }?, + OptionalId, attribute change { "add" | "modify" | "delete" | "replace" }, attribute path { text }?, attribute path_end { text }?, @@ -63,7 +75,7 @@ AmendType = element location { (locality | localityStack)* }?, element description { BasicBlock* }?, element newcontent { - attribute id { xsd:ID }?, + OptionalId, BasicBlock* }?, classification*, contributor* @@ -75,12 +87,19 @@ classification = element classification { classification_tag = element tag { text } classification_value = element value { text } +## Default block of textual content. +## Unlike the case for other document models, paragraphs _cannot_ +## contain other blocks, such as lists, tables, or figures: they are modelled as a basic building block of text +## Does not contain foonotes. While most paragraphs in a document can contain footnotes (paragraph-with-footnote), +## the distinction is necessary, as footnotes are not appropriate for all instances of paragraph content +## in a document (e.g. sourcecode annotations) paragraph = element p { ParagraphType } +## The alignment of the paragraph against the margins of the document Alignments = ( "left" | "right" | "center" | "justified" ) -## Mandatory anchor of element +## Mandatory anchor of element, to be used for cross-references within the document RequiredId = attribute id { xsd:ID } @@ -89,6 +108,7 @@ OptionalId = attribute id { xsd:ID }? ParagraphAttrs = + ## The alignment of the paragraph against the margins of the document attribute align { Alignments }? ParagraphType = @@ -96,12 +116,23 @@ ParagraphType = ParagraphAttrs, ParagraphBody +## Inline elements constituting the content of the paragraph, excluding footnotes ParagraphBody = - ( TextElement )*, note* + ## Inline elements constituting the content of the paragraph + TextElement*, + note* +## Inline elements constituting the content of the paragraph, including footnotes ParagraphFnBody = - ( TextElement | fn )*, note* - + ( + ## Inline elements constituting the content of the paragraph + TextElement | + ## Footnotes interspersed with paragraph content + fn + )*, + note* + +## Paragraph containing no footnotes: optional ID attributes (for use in Relaton, metadata) paragraph-no-id = element p { OptionalId, @@ -109,6 +140,7 @@ paragraph-no-id = ParagraphBody } +## A paragraph which may contain footnotes. paragraph-with-footnote = element p { RequiredId, @@ -116,6 +148,7 @@ paragraph-with-footnote = ParagraphFnBody } +## A paragraph which may contain footnotes optional ID attributes (for use in Relaton, metadata) paragraph-with-footnote-no-id = element p { OptionalId, @@ -434,6 +467,7 @@ ExampleNoIdBody = ( formula-no-id | ul-no-id | ol-no-id | dl-no-id | quote-no-id | sourcecode-no-id | paragraph-with-footnote-no-id )+, note-no-id* +## A sidebar block outside of the main flow of text, conveying particular warnings or supplementary text to the reader admonition = element admonition { RequiredId, @@ -449,11 +483,18 @@ admonition-no-id = } AdmonitionAttr = + ## Subclass of admonition determining how it is to be rendered. + ## Distinct admonition types are often associated with distinct icons or rendering attribute type { AdmonitionType }, + ## Subclass of admonition, allowing different runs of admonitions to be labelled + ## and auto-numbered differently, even if they are of the same type. + ## Typically is a subclass of an admonition type attribute class { text }?, + ## Location where the content of the admonition is accessible as an external document attribute uri { xsd:anyURI }? AdmonitionBody = + ## Caption of admonition tname?, paragraph-with-footnote*, note* @@ -463,8 +504,18 @@ AdmonitionNoIdBody = paragraph-with-footnote-no-id*, note-no-id* +## Subclass of admonition determining how it is to be rendered AdmonitionType = - "warning" | "note" | "tip" | "important" | "caution" + ## Warning to reader, note of risk to be avoided + "warning" | + ## Supplementary, explanatory information + "note" | + ## Instructive information to assist in the fulfilment of tasks related to content + "tip" | + ## Note to reader of something crucial to be borne in mind + "important" | + ## Caution to reader, note of potential surprise or difficulty + "caution" figure = element figure { @@ -539,12 +590,14 @@ underline = element underline { attribute style { text }?, NestedTextElement* } +## Underlined text for PureTextElement pure_underline = element underline { attribute style { text }?, PureTextElement* } ## Small caps text smallcap = element smallcap { NestedTextElement* } +## Small caps text for PureTextElement pure_smallcap = element smallcap { PureTextElement* } ## Text with Ruby annotations in East Asian languages. Corresponds to HTML `ruby` @@ -589,11 +642,19 @@ index = element index { element tertiary { PureTextElement+ }? } +## A reference to an index term, cross-referenced within an index as an +## alternative index entry, either as a "see" or a "see also" cross-reference. +## The text in the inline element is the primary index term to be be cross-referenced index-xref = element index-xref { + ## The cross-reference is to be treated as "see also" rather than as "see" attribute also { xsd:boolean }, + ## The primary index term to be cross-referenced element primary { PureTextElement+ }, + ## The secondary index term to be cross-referenced element secondary { PureTextElement+ }?, + ## The tertiary index term to be cross-referenced element tertiary { PureTextElement+ }?, + ## The index term to be cross-referenced to element target { PureTextElement+ } } @@ -601,52 +662,82 @@ index-xref = element index-xref { # bare ID element, used for referencing arbitrary spans of text bookmark = element bookmark { - attribute id { xsd:ID }, + RequiredId, empty } -ReferenceFormat = ( "external" | "inline" | "footnote" | "callout" ) +## The type of Reference Element, prescribing how it is to be rendered +ReferenceFormat = + ## Reference to an external document + "external" | + ## Reference to another element in the same document + "inline" | + ## Inline reference to a block to be rendered as a footnote + "footnote" | + ## Inline reference to a block to be referenced as a sourcecode callout + "callout" +## An external reference to a bibliographic entity eref = element eref { erefType } erefType = + ## Whether the reference is to be treated as normative or informative, particularly in the context of normative documents such as standards attribute normative { xsd:boolean }?, + ## Form that the bibliographic citation should take when it is rendered attribute citeas { text }, + ## The type of Reference Element, prescribing how it is to be rendered attribute type { ReferenceFormat }, + ## Alternate text, used for accessibility attribute alt { text }?, + ## Reference cross-reference: modelled as cross-reference to the corresponding bibliographical item in a References section CitationType, + ## The textual content of the element. The `text` is what we wish to show the link as (e.g., the "content" of `my link text`) PureTextElement+ +## A reference to an external document or resource hyperlink = element link { + ## The location or online identifier of the external document or resource attribute target { xsd:anyURI }, + ## The type of Reference Element, prescribing how it is to be rendered attribute type { ReferenceFormat }, + ## Alternate text, used for accessibility attribute alt { text }?, + ## The textual content of the element. The `text` is what we wish to show the link as (e.g., the "content" of `my link text`) PureTextElement+ } + +## Inline element, which references an identifier of a document, a block in a document, or an element in a document xref = element xref { + ## The identifier of a section, block or inlined element being referenced attribute target { xsd:IDREF }, + ## The type of Reference Element, prescribing how it is to be rendered attribute type { ReferenceFormat }, + ## Alternate text, used for accessibility attribute alt { text }?, + ## The textual content of the element. The `text` is what we wish to show the link as (e.g., the "content" of `my link text`) PureTextElement+ } +## Inline reference to a paragraph or paragraphs, appearing as a footnote. +## The target of a footnote is the location it is embedded in within the text fn = element fn { + ## The number of the footnote, used to identify it visually attribute reference { text }, + ## The content of the footnote paragraph+ } -# This is xref with fixed @type="footnote", and @target built in as paragraph+ -# @reference replaces ReferenceElement/text -# so

This is a footnote

-# corresponds to -# 2

This is a footnote

+## Inline reference to a paragraph or paragraphs, appearing as annotation of source code callout = element callout { + ## The target of the callout is understood to be the location of the callout within the source code; + ## the extent of the target is not expressed overtly attribute target { xsd:IDREF }, + ## The label of the callout, used to identify its target within the source code text } diff --git a/grammars/basicdoc.rng b/grammars/basicdoc.rng index bad967a..7ab859e 100644 --- a/grammars/basicdoc.rng +++ b/grammars/basicdoc.rng @@ -1,5 +1,5 @@ - + @@ -13,6 +13,7 @@ + Bibliographic description of a document, used as metadata, expressed in the Relaton model @@ -25,51 +26,73 @@ + Section: groups of blocks within text, which can also contain other sections - + + Sections contained within the current section. The relation is recursive, +so the hierarchical arrangement of sections can be arbitrarily deep + + + Two-letter language code taken from ISO-639, indicating the language in which the content is written + + + + Four-letter script code taken from ISO-15924, indicating the script in which the content is written + + + Group of blocks within text, which is a leaf node in the hierarchical organisation of text (does not contain any sections of its own) + - - + + - - - - + + + - + + Title of the section + - + + Blocks, containing the textual content of the section +(but excluding subsections, which are only present in Hierarchical Sections) + + Sections containing zero or more bibliographical items (as described in Relaton), along with any prefatory text + - - - - - - + + Title of section + - + + Prefatory text + - + + Bibliographical items included in the References section + + Title of a section @@ -126,11 +149,7 @@ - - - - - + add @@ -167,11 +186,7 @@ - - - - - + @@ -201,11 +216,18 @@ + Default block of textual content. +Unlike the case for other document models, paragraphs _cannot_ +contain other blocks, such as lists, tables, or figures: they are modelled as a basic building block of text +Does not contain foonotes. While most paragraphs in a document can contain footnotes (paragraph-with-footnote), +the distinction is necessary, as footnotes are not appropriate for all instances of paragraph content +in a document (e.g. sourcecode annotations) + The alignment of the paragraph against the margins of the document left right @@ -214,11 +236,13 @@ + Mandatory anchor of element, to be used for cross-references within the document + Optional anchor of element @@ -228,6 +252,7 @@ + The alignment of the paragraph against the margins of the document @@ -238,18 +263,26 @@ + Inline elements constituting the content of the paragraph, excluding footnotes - + + Inline elements constituting the content of the paragraph + + Inline elements constituting the content of the paragraph, including footnotes - - + + Inline elements constituting the content of the paragraph + + + Footnotes interspersed with paragraph content + @@ -257,6 +290,7 @@ + Paragraph containing no footnotes: optional ID attributes (for use in Relaton, metadata) @@ -264,6 +298,7 @@ + A paragraph which may contain footnotes. @@ -271,6 +306,7 @@ + A paragraph which may contain footnotes optional ID attributes (for use in Relaton, metadata) @@ -331,6 +367,22 @@ + + + + Do not number this block in rendering + + + + + + Define a subsequence for numbering of this block; e.g. if this block would be numbered +as 7, but it has a subsequence value of XYZ, this block, and all consecutive blocks +of the same class and with the same subsequence value, will be numbered consecutively +with the same number and in a subsequence: 7a, 7b, 7c etc + + + @@ -346,14 +398,7 @@ - - - - - - - - + @@ -452,17 +497,12 @@ + - - + + - - - - - - @@ -536,6 +576,7 @@ + Tabular arrangement of text @@ -543,6 +584,7 @@ + Tabular arrangement of text: optional ID attributes recursively (for use in Relaton, metadata) @@ -550,75 +592,91 @@ + - - + + Accessible description of the tabular text, in case the table cannot be rendered accessibly (HTML 5) - - - - - - - + + Alternative more extensive summary of table to be provided for accessibility purposes, +in case the table cannot be rendered accessibly (HTML 5) + + Online location of content of table (in case the table is available as a separate external document) (HTML 5) + Elements of table - + + Caption for the table + - + + Table rows constituting the table header + - + + Table rows constituting the table body + - + + Table rows constituting the table footer + - + + Definitions list defining any symbols used in the table + - + + Notes specific to this block + + Elements of table: optional ID attributes recursively (for use in Relaton, metadata) - + + Caption for the table + - + + Table rows constituting the table header + - + + Table rows constituting the table body + - + + Table rows constituting the table footer + - + + Definitions list defining any symbols used in the table + - + + Notes specific to this block + - - - - - - - - - - + @@ -667,11 +725,16 @@ + Sequence of cells to be displayed as a row in a table - - + + Data cells in a table row + + + Header cells in a table row + @@ -687,12 +750,14 @@ + Textual content constituting a basic building block of a table + Textual content constituting a basic building block of a table: optional ID attributes recursively (for use in Relaton, metadata) @@ -700,13 +765,18 @@ - + + Number of columns in the underlying table grid which the cell spans + - + + Number of rows in the underlying table grid which the cell spans + + Horizontal textual alignment of the cell against the underlying table grid left right @@ -716,6 +786,7 @@ + Vertical alignment of the cell against the underlying table grid top middle @@ -728,10 +799,15 @@ - + + Table cell is a block + + - + + Table cell contains a block + @@ -781,14 +857,7 @@ - - - - - - - - + @@ -829,6 +898,7 @@ + A sidebar block outside of the main flow of text, conveying particular warnings or supplementary text to the reader @@ -844,20 +914,29 @@ + Subclass of admonition determining how it is to be rendered. +Distinct admonition types are often associated with distinct icons or rendering - + + Subclass of admonition, allowing different runs of admonitions to be labelled +and auto-numbered differently, even if they are of the same type. +Typically is a subclass of an admonition type + + Location where the content of the admonition is accessible as an external document - + + Caption of admonition + @@ -878,12 +957,18 @@ + Subclass of admonition determining how it is to be rendered warning + Warning to reader, note of risk to be avoided note + Supplementary, explanatory information tip + Instructive information to assist in the fulfilment of tasks related to content important + Note to reader of something crucial to be borne in mind caution + Caution to reader, note of potential surprise or difficulty @@ -901,14 +986,7 @@ - - - - - - - - + @@ -972,6 +1050,8 @@ + Any inline element containing text and associated formatting information. +Includes inline elements that are identifiers or references to identifiers @@ -998,6 +1078,9 @@ + Inline element containing text and associated formatting information, +but which does not contain any associated identifiers or references to identifiers. +Restricted recursively to contain only other such inline elements with no identifiers or references to identifiers @@ -1011,27 +1094,35 @@ + + Contents of TextElement tags: leaves out tags that should occur only at top level of block: bookmark image hr pagebreak + + + + + + + + + + + + + Emphasised text. Corresponds to HTML `em`, `i` - - - - - - - - - + + Emphasised text for PureTextElement @@ -1039,21 +1130,15 @@ + Strong text. Corresponds to HTML `strong`, `b` - - - - - - - - - + + Strong text for PureTextElement @@ -1061,20 +1146,15 @@ + Monospace text. Corresponds to HTML `tt`, `code` - - - - - - - - + + Monospace text for PureTextElement @@ -1082,6 +1162,7 @@ + Keyword text @@ -1093,6 +1174,7 @@ + Subscript text. Corresponds to HTML `sub` @@ -1100,6 +1182,7 @@ + Superscript text. Corresponds to HTML `sup` @@ -1107,21 +1190,15 @@ + Strikethrough text. Corresponds to HTML 4 `s` - - - - - - - - - + + Strikethrough for PureTextElement @@ -1129,24 +1206,20 @@ + Underlined text. Corresponds to HTML 4 `u` - + + CSS style to apply to underline (intended for text-decoration-style attribute keyword values: solid double dotted dashed wavy) + - - - - - - - - - + + Underlined text for PureTextElement @@ -1157,21 +1230,15 @@ + Small caps text - - - - - - - - - + + Small caps text for PureTextElement @@ -1179,36 +1246,59 @@ + Text with Ruby annotations in East Asian languages. Corresponds to HTML `ruby` - - + + Ruby annotation giving pronunciation + + + Ruby annotation giving other (semantic) information + - - + + Ruby annotated text which contains no further annotations + + + Ruby annotated text which itself contains other Ruby annotations + + Ruby annotation giving pronunciation of text - + + Ruby annotation value + - + + + - + + + + Ruby annotation giving information other than pronunciation of text - + + Ruby annotation value + - + + + - + + + @@ -1256,17 +1346,23 @@ + A reference to an index term, cross-referenced within an index as an +alternative index entry, either as a "see" or a "see also" cross-reference. +The text in the inline element is the primary index term to be be cross-referenced + The cross-reference is to be treated as "see also" rather than as "see" + The primary index term to be cross-referenced + The secondary index term to be cross-referenced @@ -1274,12 +1370,14 @@ + The tertiary index term to be cross-referenced + The index term to be cross-referenced to @@ -1289,21 +1387,25 @@ - - - + + The type of Reference Element, prescribing how it is to be rendered external + Reference to an external document inline + Reference to another element in the same document footnote + Inline reference to a block to be rendered as a footnote callout + Inline reference to a block to be referenced as a sourcecode callout + An external reference to a bibliographic entity @@ -1311,74 +1413,102 @@ + Whether the reference is to be treated as normative or informative, particularly in the context of normative documents such as standards - + + Form that the bibliographic citation should take when it is rendered + + The type of Reference Element, prescribing how it is to be rendered - + + Alternate text, used for accessibility + - + + Reference cross-reference: modelled as cross-reference to the corresponding bibliographical item in a References section + - + + The textual content of the element. The `text` is what we wish to show the link as (e.g., the "content" of `<xx>my link text</xx>`) + + A reference to an external document or resource + The location or online identifier of the external document or resource + The type of Reference Element, prescribing how it is to be rendered - + + Alternate text, used for accessibility + - + + The textual content of the element. The `text` is what we wish to show the link as (e.g., the "content" of `<xx>my link text</xx>`) + + Inline element, which references an identifier of a document, a block in a document, or an element in a document + The identifier of a section, block or inlined element being referenced + The type of Reference Element, prescribing how it is to be rendered - + + Alternate text, used for accessibility + - + + The textual content of the element. The `text` is what we wish to show the link as (e.g., the "content" of `<xx>my link text</xx>`) + + Inline reference to a paragraph or paragraphs, appearing as a footnote. +The target of a footnote is the location it is embedded in within the text - + + The number of the footnote, used to identify it visually + - + + The content of the footnote + - + Inline reference to a paragraph or paragraphs, appearing as annotation of source code + The target of the callout is understood to be the location of the callout within the source code; +the extent of the target is not expressed overtly - + + The label of the callout, used to identify its target within the source code +