# HG changeset patch # User Patrick PIERRE <patrick.pierre@prismallia.fr> # Date 1317136324 -7200 # Node ID 32381a87f8073754f625b6a91a9a49afece92186 # Parent adde3c1288f27d9fec87b542884824c9dc526445 Ajout des ancres et des mathématiques diff -r adde3c1288f2 -r 32381a87f807 RelaxNG/publidoc.rnc --- a/RelaxNG/publidoc.rnc mar. sept. 13 10:24:30 2011 +0200 +++ b/RelaxNG/publidoc.rnc mar. sept. 27 17:12:04 2011 +0200 @@ -306,7 +306,7 @@ block = (p | speech | \list | table | media) -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p = element p { p.content } @@ -458,7 +458,9 @@ inlines = mixed { sup* & sub* + & var* & number* + & math* & date* & name* & note* @@ -469,13 +471,30 @@ & acronym* & term* & link* + & anchor* } -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup, var ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -sup = element sup { inlines } +sup = element sup { text } -sub = element sub { inlines } +sub = element sub { text } + +var = element var { text } + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ math ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +math = element math { + ( attribute notation {"tex"}, math.attributes, math.tex.content ) + | ( math.attributes, math.content) +} + +math.attributes = + wide.attribute? +wide.attribute = attribute wide { xsd:boolean } + +math.content = mixed { sup* & sub* & var* } +math.tex.content = text # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -570,9 +589,23 @@ link = element link { link.attributes, link.content } link.attributes = - uri.attribute - | idref.attribute + (uri.attribute | idref.attribute) + & anchor.attribute? uri.attribute = attribute uri { xsd:anyURI } idref.attribute = attribute idref { xsd:IDREF } +anchor.attribute = attribute anchor { xsd:NCName } link.content = inlines + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ anchor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +anchor = element anchor { + ( anchor.attributes, anchor.content ) + | ( attribute startref { xsd:IDREF } ) +} + +anchor.attributes = + anchor.id.attribute +anchor.id.attribute = attribute xml:id { xsd:ID } + +anchor.content = inlines diff -r adde3c1288f2 -r 32381a87f807 RelaxNG/publidoc.rng --- 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> diff -r adde3c1288f2 -r 32381a87f807 Xml/Documents/torture_test.xml --- a/Xml/Documents/torture_test.xml mar. sept. 13 10:24:30 2011 +0200 +++ b/Xml/Documents/torture_test.xml mar. sept. 27 17:12:04 2011 +0200 @@ -282,11 +282,41 @@ <section> <list type="glossary"> <item> + <label>Ancres</label> + <p> + Une <anchor xml:id="a001">ancre</anchor> est un objet embarqué, + lourd, souvent de métal et destiné à stabiliser des bateaux à + un endroit spécifique sur les fonds rocheux, vaseux ou + sableux. <anchor xml:id="a002"/>Il y a deux catégories + d’ancrages (ou mouillage), les ancrages provisoires et les + ancrages permanents. + </p> + <p> + Un ancrage fonctionne en s’opposant à la force exercée par le + navire qui y est relié.<anchor startref="a002"/> + </p> + </item> + <item> <label>Indices et exposants</label> <p>Un exposant 10<sup>-3</sup> suivi d'un indice H<sub>2</sub>O.</p> </item> <item> + <label>Mathématiques</label> + <p>Le dernier théorème de Fermat :</p> + <p> + Il n'existe pas de nombres entiers non nuls <var>x</var>, + <var>y</var> et <var>z</var> tels que : + <math wide="true"> + <var>x</var><sup>n</sup> + <var>y</var><sup>n</sup> = <var>z</var><sup>n</sup> + </math> + dès que <var>n</var> est un entier strictement supérieur à 2. + </p> + <p> + Une fraction en LaTeX : <math notation="tex">\frac{1}{2}</math> + </p> + </item> + <item> <label>Nombres</label> <p>En horlogerie, <number>4</number> est écrit <number type="roman">iiii</number> au lieu de <number @@ -375,8 +405,15 @@ </item> <item> <label>Liens</label> - <p>N'hésitez pas à visiter le site de <link - uri="http://www.prismallia.fr">Prismallia</link>.</p> + <p> + N'hésitez pas à visiter le site de <link + uri="http://www.prismallia.fr">Prismallia</link>. + </p> + <p> + Lisez également l'article sur les <link + idref="a01">ancres</link> ou un <link + idref="a02">extrait</link>. + </p> </item> </list> </section>