From 6824d380f89f7bf580572bca88599a54d45531d3 Mon Sep 17 00:00:00 2001 From: Norman Walsh Date: Sat, 2 Apr 2005 22:29:43 +0000 Subject: [PATCH] Added mathphrase and termdef --- docbook/relaxng/src/docbook.rnc | 1 + docbook/relaxng/src/math.rnc | 132 ++++++++++++++++++++++++++++++++ docbook/relaxng/src/pool.rnc | 121 ++++++++--------------------- 3 files changed, 163 insertions(+), 91 deletions(-) create mode 100644 docbook/relaxng/src/math.rnc diff --git a/docbook/relaxng/src/docbook.rnc b/docbook/relaxng/src/docbook.rnc index 6ff8921b0..93ed47238 100644 --- a/docbook/relaxng/src/docbook.rnc +++ b/docbook/relaxng/src/docbook.rnc @@ -43,6 +43,7 @@ include "calstbl.rnc" include "htmltbl.rnc" include "msgset.rnc" include "qandaset.rnc" +include "math.rnc" include "mathml.rnc" include "svg.rnc" include "htmlform.rnc" diff --git a/docbook/relaxng/src/math.rnc b/docbook/relaxng/src/math.rnc new file mode 100644 index 000000000..ae139dcc1 --- /dev/null +++ b/docbook/relaxng/src/math.rnc @@ -0,0 +1,132 @@ +# This file is part of DocBook NG: The "IPA" Release. + +# This schema is a "work-in-progress". It validates a DocBook-like grammar that +# may, in some incarnation, form the basis for DocBook V.next. Or it may not. +# At the moment, it's just an exploration by Norm. It has utterly no normative +# value at all. +# +# Author: Norman Walsh, +# Source: Derived from DocBook XML V4.3 +# Release: $Id$ +# + +namespace ctrl = "http://nwalsh.com/xmlns/schema-control/" +namespace rng = "http://relaxng.org/ns/structure/1.0" +namespace s = "http://www.ascc.net/xml/schematron" +namespace db = "http://docbook.org/docbook-ng" +default namespace = "http://docbook.org/docbook-ng" + +# TEI: formula + +db.math.inlines = db.inlineequation + +db.math.blocks = + db.equation + | db.informalequation + +db.domain.inlines |= db.math.inlines + +db.nopara.blocks |= db.math.blocks + +# ====================================================================== + +db.equation.content = (db.mediaobject+ | db.mathphrase+) + +# ====================================================================== + +[ + db:refname [ "equation" ] + db:refpurpose [ "A displayed mathematical equation" ] +] +div { + + db.equation.role.attribute = attribute role { text } + + db.equation.attlist = + db.equation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & attribute label { text }? + & db.pgwide.attribute? + & db.floatstyle.attribute? + & db.float.attribute? + + db.equation.info = db._info.title.onlyreq + + db.equation = + element equation { + db.equation.attlist, + db.equation.info, + db.equation.content + } +} + +# ====================================================================== + +[ + db:refname [ "informalequation" ] + db:refpurpose [ "A displayed mathematical equation without a title" ] +] +div { + + db.informalequation.role.attribute = attribute role { text } + + db.informalequation.attlist = + db.informalequation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + + db.informalequation.info = db._info.title.forbidden + + db.informalequation = + element informalequation { + db.informalequation.attlist, + db.informalequation.info, + db.equation.content + } +} + +# ====================================================================== + +[ + db:refname [ "inlineequation" ] + db:refpurpose [ "A mathematical equation or expression occurring inline" ] +] +div { + + db.inlineequation.role.attribute = attribute role { text } + + db.inlineequation.attlist = + db.inlineequation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + + db.inlineequation = + element inlineequation { + db.inlineequation.attlist, + db.equation.content + } +} + +# ====================================================================== + +[ + db:refname [ "mathphrase" ] + db:refpurpose [ "A mathematical phrase, an expression that can be represented with ordinary text and a small amount of markup" ] +] +div { + + db.mathphrase.role.attribute = attribute role { text } + + db.mathphrase.attlist = + db.mathphrase.role.attribute? + & db.common.attributes + & db.common.linking.attributes + + db.mathphrase = + element mathphrase { + db.mathphrase.attlist, + (db._text | db.ubiq.inlines | db._emphasis)* + } +} + diff --git a/docbook/relaxng/src/pool.rnc b/docbook/relaxng/src/pool.rnc index a1ade8d5c..0b4136abc 100644 --- a/docbook/relaxng/src/pool.rnc +++ b/docbook/relaxng/src/pool.rnc @@ -411,6 +411,12 @@ db._phrase = db._text } +db._emphasis = + element emphasis { + db.emphasis.attlist, + (db._text | db._emphasis)* + } + db._title = db.title? & db.titleabbrev? & db.subtitle? db._title.req = db.title & db.titleabbrev? & db.subtitle? db._title.only = db.title? & db.titleabbrev? @@ -453,7 +459,6 @@ db.domain.inlines = | db.os.inlines | db.programming.inlines | db.markup.inlines - | db.math.inlines | db.gui.inlines | db.keyboard.inlines @@ -464,6 +469,7 @@ db.technical.inlines = | db.optional | db.package | db.property + | db.termdef db.error.inlines = db.errorcode @@ -553,10 +559,6 @@ db.publishing.inlines = | db.superscript | db.wordasword -# TEI: formula - -db.math.inlines = db.inlineequation - # TEI: figure db.graphic.inlines = db.inlinemediaobject @@ -598,7 +600,6 @@ db.nopara.blocks = db.list.blocks | db.admonition.blocks | db.formal.blocks - | db.equation.blocks | db.informal.blocks | db.publishing.blocks | db.graphic.blocks @@ -628,10 +629,6 @@ db.formal.blocks = | db.figure | db.table -db.equation.blocks = - db.equation - | db.informalequation - db.informal.blocks = db.informalexample | db.informalfigure @@ -1848,6 +1845,28 @@ div { # ====================================================================== +[ + db:refname [ "termdef" ] + db:refpurpose [ "An inline definition of a term" ] +] +div { + + db.termdef.role.attribute = attribute role { text } + + db.termdef.attlist = + db.termdef.role.attribute? + & db.common.attributes + & db.common.linking.attributes + + db.termdef = + element termdef { + db.termdef.attlist, + (db.all.inlines* & db.glossterm) + } +} + +# ====================================================================== + [ db:refname [ "example" ] db:refpurpose [ "A formal example, with a title" ] @@ -2337,86 +2356,6 @@ div { # ====================================================================== -db.equation.content = db.mediaobject - -# ====================================================================== - -[ - db:refname [ "equation" ] - db:refpurpose [ "A displayed mathematical equation" ] -] -div { - - db.equation.role.attribute = attribute role { text } - - db.equation.attlist = - db.equation.role.attribute? - & db.common.attributes - & db.common.linking.attributes - & attribute label { text }? - & db.pgwide.attribute? - & db.floatstyle.attribute? - & db.float.attribute? - - db.equation.info = db._info.title.onlyreq - - db.equation = - element equation { - db.equation.attlist, - db.equation.info, - db.equation.content+ - } -} - -# ====================================================================== - -[ - db:refname [ "informalequation" ] - db:refpurpose [ "A displayed mathematical equation without a title" ] -] -div { - - db.informalequation.role.attribute = attribute role { text } - - db.informalequation.attlist = - db.informalequation.role.attribute? - & db.common.attributes - & db.common.linking.attributes - - db.informalequation.info = db._info.title.forbidden - - db.informalequation = - element informalequation { - db.informalequation.attlist, - db.informalequation.info, - db.equation.content+ - } -} - -# ====================================================================== - -[ - db:refname [ "inlineequation" ] - db:refpurpose [ "A mathematical equation or expression occurring inline" ] -] -div { - - db.inlineequation.role.attribute = attribute role { text } - - db.inlineequation.attlist = - db.inlineequation.role.attribute? - & db.common.attributes - & db.common.linking.attributes - - db.inlineequation = - element inlineequation { - db.inlineequation.attlist, - db.equation.content+ - } -} - -# ====================================================================== - [ db:refname [ "synopsis" ] db:refpurpose [ "A general-purpose element for representing the syntax of commands or functions" ] @@ -6271,7 +6210,7 @@ div { [ db:refname [ "superscript" ] - db:refpurpose [ "A superscript (as in x2, the mathematical notation for x multiplied by itself)" ] + db:refpurpose [ "A superscript (as in x^2, the mathematical notation for x multiplied by itself)" ] ] div { -- 2.40.0