RelaxNG/publidoc.rng
changeset 42 32381a87f807
parent 41 adde3c1288f2
child 43 5be33d03941a
--- a/RelaxNG/publidoc.rng	mar. sept. 13 10:24:30 2011 +0200
+++ b/RelaxNG/publidoc.rng	mar. sept. 27 17:12:04 2011 +0200
@@ -635,7 +635,7 @@
       <ref name="media"/>
     </choice>
   </define>
-  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <define name="p">
     <element name="p">
       <ref name="p.content"/>
@@ -980,9 +980,15 @@
           <ref name="sub"/>
         </zeroOrMore>
         <zeroOrMore>
+          <ref name="var"/>
+        </zeroOrMore>
+        <zeroOrMore>
           <ref name="number"/>
         </zeroOrMore>
         <zeroOrMore>
+          <ref name="math"/>
+        </zeroOrMore>
+        <zeroOrMore>
           <ref name="date"/>
         </zeroOrMore>
         <zeroOrMore>
@@ -1012,20 +1018,74 @@
         <zeroOrMore>
           <ref name="link"/>
         </zeroOrMore>
+        <zeroOrMore>
+          <ref name="anchor"/>
+        </zeroOrMore>
       </interleave>
     </mixed>
   </define>
-  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup, var ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <define name="sup">
     <element name="sup">
-      <ref name="inlines"/>
+      <text/>
     </element>
   </define>
   <define name="sub">
     <element name="sub">
-      <ref name="inlines"/>
+      <text/>
     </element>
   </define>
+  <define name="var">
+    <element name="var">
+      <text/>
+    </element>
+  </define>
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ math ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <define name="math">
+    <element name="math">
+      <choice>
+        <group>
+          <attribute name="notation">
+            <value>tex</value>
+          </attribute>
+          <ref name="math.attributes"/>
+          <ref name="math.tex.content"/>
+        </group>
+        <group>
+          <ref name="math.attributes"/>
+          <ref name="math.content"/>
+        </group>
+      </choice>
+    </element>
+  </define>
+  <define name="math.attributes">
+    <optional>
+      <ref name="wide.attribute"/>
+    </optional>
+  </define>
+  <define name="wide.attribute">
+    <attribute name="wide">
+      <data type="boolean"/>
+    </attribute>
+  </define>
+  <define name="math.content">
+    <mixed>
+      <interleave>
+        <zeroOrMore>
+          <ref name="sup"/>
+        </zeroOrMore>
+        <zeroOrMore>
+          <ref name="sub"/>
+        </zeroOrMore>
+        <zeroOrMore>
+          <ref name="var"/>
+        </zeroOrMore>
+      </interleave>
+    </mixed>
+  </define>
+  <define name="math.tex.content">
+    <text/>
+  </define>
   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
   <define name="number">
     <element name="number">
@@ -1225,10 +1285,15 @@
     </element>
   </define>
   <define name="link.attributes">
-    <choice>
-      <ref name="uri.attribute"/>
-      <ref name="idref.attribute"/>
-    </choice>
+    <interleave>
+      <choice>
+        <ref name="uri.attribute"/>
+        <ref name="idref.attribute"/>
+      </choice>
+      <optional>
+        <ref name="anchor.attribute"/>
+      </optional>
+    </interleave>
   </define>
   <define name="uri.attribute">
     <attribute name="uri">
@@ -1240,7 +1305,37 @@
       <data type="IDREF"/>
     </attribute>
   </define>
+  <define name="anchor.attribute">
+    <attribute name="anchor">
+      <data type="NCName"/>
+    </attribute>
+  </define>
   <define name="link.content">
     <ref name="inlines"/>
   </define>
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ anchor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <define name="anchor">
+    <element name="anchor">
+      <choice>
+        <group>
+          <ref name="anchor.attributes"/>
+          <ref name="anchor.content"/>
+        </group>
+        <attribute name="startref">
+          <data type="IDREF"/>
+        </attribute>
+      </choice>
+    </element>
+  </define>
+  <define name="anchor.attributes">
+    <ref name="anchor.id.attribute"/>
+  </define>
+  <define name="anchor.id.attribute">
+    <attribute name="xml:id">
+      <data type="ID"/>
+    </attribute>
+  </define>
+  <define name="anchor.content">
+    <ref name="inlines"/>
+  </define>
 </grammar>