Jrst-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
May 2012
- 2 participants
- 40 discussions
r692 - branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst
by jpages@users.nuiton.org 31 May '12
by jpages@users.nuiton.org 31 May '12
31 May '12
Author: jpages
Date: 2012-05-31 11:08:57 +0200 (Thu, 31 May 2012)
New Revision: 692
Url: http://nuiton.org/repositories/revision/jrst/692
Log:
Suppression du test generateRst qui n'a plus lieu d'?\195?\170tre.
Modified:
branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java
Modified: branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java
===================================================================
--- branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java 2012-05-31 08:49:47 UTC (rev 691)
+++ branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java 2012-05-31 09:08:57 UTC (rev 692)
@@ -58,64 +58,10 @@
Assert.assertNotNull(Resource.getURL(JRST.DOCBOOK_2_XHTML));
Assert.assertNotNull(Resource.getURL(JRST.DOCBOOK_2_JAVAHELP));
Assert.assertNotNull(Resource.getURL(JRST.DOCBOOK_2_HTMLHELP));
- //FIXME echatellier 20110217 following assert fails
- //Assert.assertNotNull(Resource.getURL(JRST.docbook2odf));
Assert.assertNotNull(Resource.getURL(JRST.DOCBOOK_2_FO));
}
- @Ignore
@Test
- public void generateRst() throws Exception {
- File in = new File(testWorkDir, "toRst1-in.rst");
-
- List<String> IN_LINES = Arrays.asList(new String[]{
- "=====",
- "Title",
- "=====",
- "",
- "SubTitle",
- "--------",
- "",
- ".. topic:: TopicTitle",
- "",
- " TopicBody.",
- "",
- "",
- "Another body outside of the topic :)"
- });
- List<String> OUT_LINES = Arrays.asList(new String[]{
- "Title",
- "-----",
- // "",
- "SubTitle",
- "--------",
- // "",
- ".. topic:: TopicTitle",
- // "",
- " TopicBody.",
- // "",
- // "",
- "Another body outside of the topic :)"
- });
-
- FileUtils.writeLines(in, IN_LINES);
-
- File out = new File(testWorkDir, "toRst1-out.rst");
-
- JRST.generate(JRST.TYPE_RST, in, out, JRST.Overwrite.ALLTIME);
-
- List<?> readLines = FileUtils.readLines(out);
- log.info(OUT_LINES);
- log.info(readLines);
- Assert.assertEquals(OUT_LINES.size(), readLines.size());
- for (int i = 0, j = OUT_LINES.size(); i < j; i++) {
- String inLine = OUT_LINES.get(i);
- String outLine = (String) readLines.get(i);
- Assert.assertEquals(inLine, outLine);
- }
- }
-
- @Test
public void generateXml() throws Exception {
File in = getTestFile("text.rst");
1
0
r691 - in branches/jrst-docutils-jython/jrst-doc/src/site: en/rst en/rst/devel en/rst/user resources/schemas rst rst/devel rst/user
by jpages@users.nuiton.org 31 May '12
by jpages@users.nuiton.org 31 May '12
31 May '12
Author: jpages
Date: 2012-05-31 10:49:47 +0200 (Thu, 31 May 2012)
New Revision: 691
Url: http://nuiton.org/repositories/revision/jrst/691
Log:
Version finale de la documentation pour JRST 1.6 (correction de quelques coquilles)
Ajout des fichiers sources pour les diagrammes (.dia) dans les ressources.
Added:
branches/jrst-docutils-jython/jrst-doc/src/site/resources/schemas/class-diagram.dia
branches/jrst-docutils-jython/jrst-doc/src/site/resources/schemas/diagrammeGeneration.dia
branches/jrst-docutils-jython/jrst-doc/src/site/resources/schemas/diagrammeSequence.dia
Modified:
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/developerDoc.rst
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/externalDoc.rst
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/library.rst
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/index.rst
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/index.rst
branches/jrst-docutils-jython/jrst-doc/src/site/resources/schemas/diagrammeGeneration.png
branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/docDeveloppeur.rst
branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/docExterne.rst
branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/librairies.rst
branches/jrst-docutils-jython/jrst-doc/src/site/rst/index.rst
branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/index.rst
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/developerDoc.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/developerDoc.rst 2012-05-31 08:02:14 UTC (rev 690)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/developerDoc.rst 2012-05-31 08:49:47 UTC (rev 691)
@@ -50,7 +50,6 @@
Links :
- * xml2rst.xsl (conversion from xml of docutils towards rst) : http://www.merten-home.de/FreeSoftware/xml2rst
* dn2dbk.xsl (conversion from xml of docutils towards docbook) : http://membres.lycos.fr/ebellot/dn2dbk
* nwalsh xsl (conversion from docbook towards FO and xhtml) : http://nwalsh.com
* IText (conversion from HTML towards PDF) : http://itextpdf.com/
@@ -131,7 +130,7 @@
JRST --xslFile XSLfile, XSLfile2 RSTfile
JRST process RST_ file, returned DocUtils_ XML will be transformed by JRSTgenerator Class
-starting by XSLfile then XSL2file2...
+starting by "XSLfile" then "XSL2file2".
.. [1] `Cascading Style Sheets`_
.. [2] XSL documentation is available here_.
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/externalDoc.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/externalDoc.rst 2012-05-31 08:02:14 UTC (rev 690)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/externalDoc.rst 2012-05-31 08:49:47 UTC (rev 691)
@@ -31,6 +31,6 @@
reStructured DTD : http://docutils.sourceforge.net/docs/ref/doctree.html
-XSL used to convert the XML into RST : http://www.merten-home.de/FreeSoftware/xml2rst/
+XSL used to convert the XML into RST : http://docutils.sourceforge.net/sandbox/xml2rst/
To generate javadoc in RST form : http://java.sun.com/javase/6/docs/technotes/guides/javadoc/doclet/overview.…
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/library.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/library.rst 2012-05-31 08:02:14 UTC (rev 690)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/library.rst 2012-05-31 08:49:47 UTC (rev 691)
@@ -35,10 +35,10 @@
Dom4j_ is an easy to use, open source library for working with XML, XPath and XSLT on the Java platform
using the Java Collections Framework and with full support for DOM, SAX and JAXP.
-javax.xml.transform_
-====================
+Saxon_
+======
-Librairy used to the XSL transformation.
+Saxon_ is an open source XSLT processor for Java. In this project, it is used to apply XSL stylesheets to XML.
IText_
======
@@ -53,7 +53,7 @@
DocUtils_
=========
-DocUtils_ is a set of Python scripts to transform RST_ files into useful formats, such as HTML, ODT, Latex and more.
+DocUtils_ is a set of Python scripts to transform RST_ files into useful formats, such as HTML, ODT, Latex and more.
Jython_
=======
@@ -63,7 +63,7 @@
.. _dom4j: http://www.dom4j.org
-.. _javax.xml.transform: http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.h…
+.. _Saxon: http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.h…
.. _IText: http://itextpdf.com/
.. _Xmlunit: http://xmlunit.sourceforge.net/
.. _RST: http://docutils.sourceforge.net/rst.html
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/index.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/index.rst 2012-05-31 08:02:14 UTC (rev 690)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/index.rst 2012-05-31 08:49:47 UTC (rev 691)
@@ -42,7 +42,7 @@
documents, becomes useless when it is used to quickly creating a simple
document. RST has a so simple syntax that it becomes almost invisible.
-JRST uses Jython_ and DocUtils_ to transform RST_ files to XML to create a tree representation
+JRST uses Jython_ to execute DocUtils_ scripts to transform RST_ files to DocUtils XML to create a tree representation
document. It becomes easy to generate document representation towards different
formats.
@@ -63,7 +63,7 @@
Several options are available :
-o file, --outFile=file To write toward a file.
--t format, --outType format To specify exit format, so using generation XSL_ file(s). Several formats are available xhtml, docbook, xml, HTML, xdoc, rst, pdf, odt, rtf.
+-t format, --outType format To specify exit format, so using generation XSL_ file(s). Several formats are available xhtml, docbook, xml, HTML, xdoc, pdf.
-x xslFile, --xslFile xslFile To specify generation XSL_ file at using.
--force To overwrite, if file exists, it will be replaced by the new one.
--help To display available options :
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/index.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/index.rst 2012-05-31 08:02:14 UTC (rev 690)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/index.rst 2012-05-31 08:49:47 UTC (rev 691)
@@ -42,7 +42,7 @@
documents, becomes useless when it is used to quickly creating a simple
document. RST has a so simple syntax that it becomes almost invisible.
-JRST uses Jython_ and DocUtils_ to transform RST_ files to XML to create a tree representation
+JRST uses Jython_ to execute DocUtils_ scripts to transform RST_ files to DocUtils XML to create a tree representation
document. It becomes easy to generate document representation towards different
formats.
@@ -63,7 +63,7 @@
Several options are available :
-o file, --outFile=file To write toward a file.
--t format, --outType format To specify exit format, so using generation XSL_ file(s). Several formats are available xhtml, docbook, xml, HTML, xdoc, rst, pdf, odt, rtf.
+-t format, --outType format To specify exit format, so using generation XSL_ file(s). Several formats are available xhtml, docbook, xml, HTML, xdoc, pdf.
-x xslFile, --xslFile xslFile To specify generation XSL_ file at using.
--force To overwrite, if file exists, it will be replaced by the new one.
--help To display available options :
Added: branches/jrst-docutils-jython/jrst-doc/src/site/resources/schemas/class-diagram.dia
===================================================================
(Binary files differ)
Property changes on: branches/jrst-docutils-jython/jrst-doc/src/site/resources/schemas/class-diagram.dia
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: branches/jrst-docutils-jython/jrst-doc/src/site/resources/schemas/diagrammeGeneration.dia
===================================================================
(Binary files differ)
Property changes on: branches/jrst-docutils-jython/jrst-doc/src/site/resources/schemas/diagrammeGeneration.dia
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/resources/schemas/diagrammeGeneration.png
===================================================================
(Binary files differ)
Added: branches/jrst-docutils-jython/jrst-doc/src/site/resources/schemas/diagrammeSequence.dia
===================================================================
(Binary files differ)
Property changes on: branches/jrst-docutils-jython/jrst-doc/src/site/resources/schemas/diagrammeSequence.dia
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/docDeveloppeur.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/docDeveloppeur.rst 2012-05-31 08:02:14 UTC (rev 690)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/docDeveloppeur.rst 2012-05-31 08:49:47 UTC (rev 691)
@@ -53,10 +53,9 @@
Référence :
- * xml2rst.xsl (convertion de xml de docutils vers rst) : http://www.merten-home.de/FreeSoftware/xml2rst
- * dn2dbk.xsl (convertion de xml de docutils vers docbook) : http://membres.lycos.fr/ebellot/dn2dbk
- * les xsl de nwalsh (convertion de docbook vers FO et xhtml) : http://nwalsh.com
- * IText (convertion de HTML vers PDF) : http://itextpdf.com/
+ * dn2dbk.xsl (conversion de xml de docutils vers docbook) : http://membres.lycos.fr/ebellot/dn2dbk
+ * les xsl de nwalsh (conversion de docbook vers FO et xhtml) : http://nwalsh.com
+ * IText (conversion de HTML vers PDF) : http://itextpdf.com/
Exemple d'utilisation
@@ -133,7 +132,7 @@
JRST --xslFile fichierXSL, fichierXSL2 fichierRST
JRST traitera le fichierRST, le XML de DocUtils_ qui est retourné sera transformé par la Class JRSTgenerator
-en commençant par le fichierXSL puis par le fichierXSL2...
+en commençant par "fichierXSL" puis par "fichierXSL2".
.. [1] `Cascading Style Sheets`_
.. [2] Une documentation sur le XSL est diponible ici_.
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/docExterne.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/docExterne.rst 2012-05-31 08:02:14 UTC (rev 690)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/docExterne.rst 2012-05-31 08:49:47 UTC (rev 691)
@@ -31,6 +31,6 @@
La DTD reStructuredText : http://docutils.sourceforge.net/docs/ref/doctree.html
-Un XSL permettant de convertir le XML en RST : http://www.merten-home.de/FreeSoftware/xml2rst/
+Un XSL permettant de convertir le XML en RST : http://docutils.sourceforge.net/sandbox/xml2rst/
Pour la génération de la javaDoc en RST : http://java.sun.com/javase/6/docs/technotes/guides/javadoc/doclet/overview.…
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/librairies.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/librairies.rst 2012-05-31 08:02:14 UTC (rev 690)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/librairies.rst 2012-05-31 08:49:47 UTC (rev 691)
@@ -34,10 +34,10 @@
Dom4j_ est une API Open Source Java permettant de travailler avec XML, XPath et XSLT. Cette bibliothèque est compatible avec les standards DOM, SAX et JAXP.
-javax.xml.transform_
-====================
+Saxon_
+======
-Librairie permettant la transformation XSL.
+Saxon_ est une bibliothèque permettant d'effectuer des traitements XSLT. Dans ce projet, elle permet d'appliquer les feuilles de style XSL aux documents XML.
IText_
======
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/rst/index.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/rst/index.rst 2012-05-31 08:02:14 UTC (rev 690)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/rst/index.rst 2012-05-31 08:49:47 UTC (rev 691)
@@ -43,7 +43,7 @@
de créer rapidement un document pas trop complexe. RST_ dispose quant à lui d'une
syntaxe tellement simple qu'elle en devient presque invisible.
-JRST utilise Jython_ et DocUtils_ pour transformer le RST_ en XML permettant de créer une représentation en arbre d'un document. Il devient alors facile de générer une représentation du document vers différents formats.
+JRST utilise Jython_ pour lancer des scripts de DocUtils_ afin de transformer le RST_ en XML de DocUtils permettant de créer une représentation en arbre d'un document. Il devient alors facile de générer une représentation du document vers différents formats.
Usage
@@ -64,7 +64,7 @@
Plusieurs options sont disponibles :
-o file, --outFile=file Pour rediriger la sortie vers un fichier.
--t format, --outType format Pour préciser un format de sortie, donc utiliser un ou des fichiers XSL_ de génération. Plusieurs formats sont disponibles xhtml, docbook, xml, html, xdoc, rst, pdf, odt, rtf.
+-t format, --outType format Pour préciser un format de sortie, donc utiliser un ou des fichiers XSL_ de génération. Plusieurs formats sont disponibles xhtml, docbook, xml, html, xdoc, pdf.
-x xslFile, --xslFile xslFile Sert à préciser le fichier xsl de génération à utiliser.
--force Forcer l'écriture d'un fichier, si le fichier de sortie existe, il sera remplacé.
--help Pour afficher les options disponibles :
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/index.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/index.rst 2012-05-31 08:02:14 UTC (rev 690)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/index.rst 2012-05-31 08:49:47 UTC (rev 691)
@@ -43,7 +43,7 @@
de créer rapidement un document pas trop complexe. RST_ dispose quant à lui d'une
syntaxe tellement simple qu'elle en devient presque invisible.
-JRST utilise Jython_ et DocUtils_ pour transformer le RST_ en XML permettant de créer une représentation en arbre d'un document. Il devient alors facile de générer une représentation du document vers différents formats.
+JRST utilise Jython_ pour lancer des scripts de DocUtils_ afin de transformer le RST_ en XML de DocUtils permettant de créer une représentation en arbre d'un document. Il devient alors facile de générer une représentation du document vers différents formats.
Usage
@@ -64,7 +64,7 @@
Plusieurs options sont disponibles :
-o file, --outFile=file Pour rediriger la sortie vers un fichier.
--t format, --outType format Pour préciser un format de sortie, donc utiliser un ou des fichiers XSL_ de génération. Plusieurs formats sont disponibles xhtml, docbook, xml, html, xdoc, rst, pdf, odt, rtf.
+-t format, --outType format Pour préciser un format de sortie, donc utiliser un ou des fichiers XSL_ de génération. Plusieurs formats sont disponibles xhtml, docbook, xml, html, xdoc, pdf.
-x xslFile, --xslFile xslFile Sert à préciser le fichier xsl de génération à utiliser.
--force Forcer l'écriture d'un fichier, si le fichier de sortie existe, il sera remplacé.
--help Pour afficher les options disponibles :
1
0
r690 - in branches/jrst-docutils-jython: . jrst/src/main/java/org jrst/src/main/java/org/nuiton/jrst jrst/src/main/resources/xsl jrst-doc/src/site/en/rst/devel jrst-doc/src/site/en/rst/user jrst-doc/src/site/rst/devel jrst-doc/src/site/rst/user
by sletellier@users.nuiton.org 31 May '12
by sletellier@users.nuiton.org 31 May '12
31 May '12
Author: sletellier
Date: 2012-05-31 10:02:14 +0200 (Thu, 31 May 2012)
New Revision: 690
Url: http://nuiton.org/repositories/revision/jrst/690
Log:
- Delete empty directory
- Remove xalan dependency
- Remove rst2rst.xsl (dont work)
Removed:
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/images/
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/images/
branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/images/
branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/images/
branches/jrst-docutils-jython/jrst/src/main/java/org/dom4j/
branches/jrst-docutils-jython/jrst/src/main/resources/xsl/xml2rst.xsl
Modified:
branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRST.java
branches/jrst-docutils-jython/pom.xml
Modified: branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRST.java
===================================================================
--- branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRST.java 2012-05-30 15:45:20 UTC (rev 689)
+++ branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRST.java 2012-05-31 08:02:14 UTC (rev 690)
@@ -118,11 +118,8 @@
/** XSL Stylesheet to transform Docbook into PDF. */
protected static final String DOCBOOK_2_FO = "/docbook/fo/docbook.xsl";
- /** XSL Stylesheet to transform XML into RST. */
- protected static final String XML_2_RST = "/xsl/xml2rst.xsl";
+ public static final String PATTERN_TYPE = "xml|xhtml|docbook|html|htmlInnerBody|xdoc|fo|pdf";
- public static final String PATTERN_TYPE = "xml|xhtml|docbook|html|htmlInnerBody|xdoc|rst|fo|pdf";
-
/** HTML output format type */
public static final String TYPE_HTML = "html";
@@ -144,9 +141,6 @@
/** HTML HELP output format type */
public static final String TYPE_HTMLHELP = "htmlhelp";
- /** RST output format type */
- public static final String TYPE_RST = "rst";
-
/** ODT output format type */
public static final String TYPE_ODT = "odt";
@@ -177,7 +171,6 @@
stylesheets.put(TYPE_XHTML, RST_2_DOCBOOK + "," + DOCBOOK_2_XHTML);
stylesheets.put(TYPE_JAVAHELP, RST_2_DOCBOOK + "," + DOCBOOK_2_JAVAHELP);
stylesheets.put(TYPE_HTMLHELP, RST_2_DOCBOOK + "," + DOCBOOK_2_HTMLHELP);
- stylesheets.put(TYPE_RST, XML_2_RST);
stylesheets.put(TYPE_FO, RST_2_DOCBOOK + "," + DOCBOOK_2_FO);
stylesheets.put(TYPE_PDF, RST_2_XHTML);
@@ -189,7 +182,6 @@
mimeType.put(TYPE_XHTML, "text/html");
mimeType.put(TYPE_JAVAHELP, "text/plain");
mimeType.put(TYPE_HTMLHELP, "text/html");
- mimeType.put(TYPE_RST, "text/plain");
mimeType.put(TYPE_ODT, "application/vnd.oasis.opendocument.text");
mimeType.put(TYPE_FO, "text/xml");
mimeType.put(TYPE_PDF, "application/pdf");
Deleted: branches/jrst-docutils-jython/jrst/src/main/resources/xsl/xml2rst.xsl
===================================================================
--- branches/jrst-docutils-jython/jrst/src/main/resources/xsl/xml2rst.xsl 2012-05-30 15:45:20 UTC (rev 689)
+++ branches/jrst-docutils-jython/jrst/src/main/resources/xsl/xml2rst.xsl 2012-05-31 08:02:14 UTC (rev 690)
@@ -1,3744 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE xsl:stylesheet [
-<!ENTITY CR "
">
-<!-- "xml:space='preserve'" is needed for use with libxslt -->
-<!-- "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'" is needed for
- use with xsltproc -->
-<!-- Used to create a blank line -->
-<!ENTITY tCR "<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xml:space='preserve'>&CR;</xsl:text>">
-<!-- Used when the line before must be ended -->
-<!ENTITY tEOL "<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xml:space='preserve'>&CR;</xsl:text>">
-<!ENTITY tSP "<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xml:space='preserve'> </xsl:text>">
-]>
-
-<!--
- Copyright (C) 2005, 2006 Stefan Merten, David Priest
- Copyright (C) 2009, 2010, 2011 Stefan Merten
-
- xml2rst.xsl is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA.
--->
-
-<!-- ********************************************************************** -->
-<!-- ********************************************************************** -->
-
-<!-- These elements in the DTD need support:
-
- - ``colspec`` has attribute "stub %yesorno; #IMPLIED"
-
- - ``document`` has attribute "title CDATA #IMPLIED"
-
- Probably rendered by the `.. title::` directive
-
- -->
-
-<!--
-Set namespace extensions. These are used as [shortname]:[tag] throughout the
-XSL-FO files.
-xsl: eXtensible Stylesheet Language
-u: user extensions (indicates utility 'call-template' routines defined in
-these XSL files)
-data: Data elements used by the stylesheet
--->
-<xsl:stylesheet
- version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:u="u"
- xmlns:data="a"
- exclude-result-prefixes="data"
- xmlns:str="http://exslt.org/strings"
- xmlns:dyn="http://exslt.org/dynamic"
- xmlns:math="http://exslt.org/math"
- extension-element-prefixes="str dyn math">
-
- <!-- xmlns:regexp="http://exslt.org/regular-expressions" not supported :-( -->
-
- <xsl:output
- method="text"
- omit-xml-declaration="yes"
- indent="no"/>
-
- <!-- ******************************************************************** -->
- <!-- ******************************************************************** -->
-
- <!-- Parameter to configure title markup; see manual page for description -->
- <xsl:param
- name="adornment"
- select="'o=o-u=u-u~u`u,u.'"/>
-
- <!-- Parameter for folding long lines; see manual page for description -->
- <xsl:param
- name="fold"
- select="0"/>
-
- <!-- ******************************************************************** -->
- <!-- ******************************************************************** -->
-
- <xsl:variable
- name="apos"
- select='"'"'/>
-
- <xsl:variable
- name="structural_elements"
- select="'*document*section*topic*sidebar*'"/>
-
- <xsl:variable
- name="structural_subelements"
- select="'*title*subtitle*docinfo*decoration*transition*'"/>
-
- <xsl:variable
- name="bibliographic_elements"
- select="'*address*author*authors*contact*copyright*date*field*organization*revision*status*version*'"/>
-
- <xsl:variable
- name="decorative_elements"
- select="'*footer*header*'"/>
-
- <xsl:variable
- name="simple_body_elements_no_substitution"
- select="'*comment*doctest_block*image*literal_block*paragraph*pending*raw*rubric*target*'"/>
-
- <xsl:variable
- name="folding_elements"
- select="concat('*comment*paragraph*rubric*attribution*caption*line*', substring-after($bibliographic_elements, '*'))"/>
-
- <xsl:variable
- name="simple_body_elements"
- select="concat($simple_body_elements_no_substitution, 'substitution_definition*')"/>
-
- <xsl:variable
- name="compound_body_elements"
- select="'*admonition*attention*block_quote*bullet_list*caution*citation*compound*danger*definition_list*enumerated_list*error*field_list*figure*footnote*hint*important*line_block*note*option_list*system_message*table*tip*warning*container*'"/>
-
- <xsl:variable
- name="body_elements"
- select="concat($simple_body_elements, substring-after($compound_body_elements, '*'))"/>
-
- <xsl:variable
- name="admonitions"
- select="'*admonition*attention*caution*danger*error*hint*important*note*tip*warning*'"/>
-
- <xsl:variable
- name="simple_body_subelements"
- select="'*attribution*caption*classifier*colspec*field_name*label*line*option_argument*option_string*term*'"/>
-
- <xsl:variable
- name="compound_body_subelements"
- select="'*definition*definition_list_item*description*entry*field*field_body*legend*list_item*option*option_group*option_list_item*row*tbody*tgroup*thead*'"/>
-
- <xsl:variable
- name="inline_elements"
- select="'*abbreviation*acronym*citation_reference*emphasis*footnote_reference*generated*image*inline*literal*problematic*reference*strong*subscript*substitution_reference*superscript*target*title_reference*raw*'"/>
-
- <xsl:variable
- name="inline_containers"
- select="concat($simple_body_elements_no_substitution, substring-after($inline_elements, '*'))"/>
-
- <xsl:variable
- name="directives"
- select="'*admonition*attention*caution*comment*danger*error*footnote*hint*important*note*tip*warning*image*figure*topic*sidebar*rubric*meta*raw*citation*compound*substitution_definition*container*'"/>
-
- <xsl:variable
- name="titled_elements"
- select="'*sidebar*topic*admonition*'"/>
-
- <xsl:variable
- name="blank_after"
- select="concat($structural_elements, substring-after($structural_subelements, '*'), substring-after($body_elements, '*'))"/>
-
- <xsl:variable
- name="adornment_characters"
- select="concat($apos, '!"#$%&()*+,-./:;<=>?@[\]^_`{|}~')"/>
-
- <!-- ******************************************************************** -->
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: ((title, subtitle?)?, docinfo?, decoration?,
- %structure.model;)
-
- Attributes: The document element contains only the common attributes: ids,
- names, dupnames, source, and classes.
-
- Depending on the source of the data and the stage of processing, the
- "document" may not initially contain a "title". A document title is not
- directly representable in reStructuredText. Instead, a lone top-level section
- may have its title promoted to become the document title, and similarly for a
- lone second-level (sub)section's title to become the document subtitle. The
- "docinfo" may be transformed from an initial field_list, and "decoration" is
- usually constructed programmatically.
- -->
- <!-- == structural_element -->
- <xsl:template
- match="document">
- <xsl:if
- test="//generated[@classes = 'sectnum']">
- <xsl:text>.. section-numbering::</xsl:text>
- &tEOL;
- &tCR;
- </xsl:if>
- <xsl:call-template
- name="u:outputClass">
- <xsl:with-param
- name="blankAfter"
- select="true()"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (title, %structure.model;)
- Attributes: The section element contains only the common attributes: ids,
- names, dupnames, source, and classes.
- -->
- <!-- == structural_element -->
- <xsl:template
- match="section">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:blank"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- == structural_element -->
- <xsl:template
- match="section[@classes = 'system-messages']"/>
- <!-- Ignore system messages completely -->
- <!-- This should be really in `generated' -->
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (title, subtitle?, (%body.elements;)+)
- Attributes: The sidebar element contains only the common attributes: ids,
- names, dupnames, source, and classes.
- -->
- <!-- == structural_element == directive -->
- <xsl:template
- match="sidebar">
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. sidebar:: </xsl:text>
- <xsl:value-of
- select="title"/>
- &tEOL;
- <xsl:if
- test="subtitle">
- <xsl:call-template
- name="u:param">
- <xsl:with-param
- name="name"
- select="'subtitle'"/>
- <xsl:with-param
- name="value"
- select="subtitle"/>
- <xsl:with-param
- name="ancestors"
- select="ancestor-or-self::*"/>
- </xsl:call-template>
- </xsl:if>
- <xsl:call-template
- name="u:params"/>
- <!-- Always blank line after parameter block -->
- &tCR;
- <xsl:apply-templates
- select="*[not(self::title) and not(self::subtitle)]"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (title?, (%body.elements;)+)
- Attributes: The topic element contains only the common attributes: ids,
- names, dupnames, source, and classes.
- -->
- <!-- == structural_element == directive -->
- <xsl:template
- match="topic">
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. topic:: </xsl:text>
- <xsl:value-of
- select="title"/>
- &tEOL;
- <xsl:call-template
- name="u:params"/>
- <xsl:apply-templates
- select="*[not(self::title)]"/>
- </xsl:template>
-
- <!-- == structural_element == directive -->
- <xsl:template
- match="topic[starts-with(@classes, 'contents')]">
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. contents:: </xsl:text>
- <xsl:apply-templates
- select="title"/>
- &tEOL;
- <xsl:call-template
- name="u:params">
- <xsl:with-param
- name="params"
- select="@*[name() != 'ids' and name() != 'names' and name() != 'classes']"/>
- </xsl:call-template>
- <xsl:variable
- name="isLocal"
- select="substring-before(@classes, ' local')"/>
- <xsl:variable
- name="realClassesLocal"
- select="normalize-space(substring-after(@classes, 'contents'))"/>
- <xsl:variable
- name="realClassesNode">
- <xsl:choose>
- <xsl:when
- test="$isLocal">
- <xsl:value-of
- select="normalize-space(substring-before($realClassesLocal, 'local'))"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
- select="$realClassesLocal"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable
- name="realClasses"
- select="string($realClassesNode)"/>
- <xsl:if
- test="$isLocal">
- <xsl:call-template
- name="u:param">
- <xsl:with-param
- name="name"
- select="'local'"/>
- <xsl:with-param
- name="value"
- select="''"/>
- <xsl:with-param
- name="ancestors"
- select="ancestor-or-self::*"/>
- </xsl:call-template>
- </xsl:if>
- <xsl:if
- test="$realClasses">
- <xsl:call-template
- name="u:param">
- <xsl:with-param
- name="name"
- select="'class'"/>
- <xsl:with-param
- name="value"
- select="$realClasses"/>
- <xsl:with-param
- name="ancestors"
- select="ancestor-or-self::*"/>
- </xsl:call-template>
- </xsl:if>
- <!-- Autogenerated content is discarded -->
- &tCR;
- </xsl:template>
-
- <!-- == structural_element == directive -->
- <xsl:template
- match="topic[@classes='dedication' or @classes='abstract']">
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>:</xsl:text>
- <xsl:apply-templates
- select="title"/>
- <xsl:text>: </xsl:text>
- &tEOL;
- <xsl:apply-templates
- select="*[not(self::title)]"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (title, (%body.elements;)+)
- Attributes: The admonition element contains only the common attributes:
- ids, names, dupnames, source, and classes.
- -->
- <!-- == compound_body_element == directive -->
- <xsl:template
- match="admonition">
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. admonition:: </xsl:text>
- <xsl:apply-templates
- select="title"/>
- &tEOL;
- <xsl:call-template
- name="u:params">
- <xsl:with-param
- name="params"
- select="@*[name() != 'classes' or not(starts-with(., 'admonition-'))]"/>
- </xsl:call-template>
- <xsl:call-template
- name="u:indent"/>
- <xsl:apply-templates
- select="*[not(self::title)]"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (%body.elements;)+
- Attributes: The note element contains only the common attributes: ids,
- names, dupnames, source, and classes.
- -->
- <!-- == compound_body_element == directive -->
- <xsl:template
- match="attention | caution | danger | error | hint | important | note | tip | warning">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. </xsl:text>
- <xsl:value-of
- select="name()"/>
- <xsl:text>:: </xsl:text>
- <xsl:call-template
- name="u:params">
- <xsl:with-param
- name="params"
- select="@*[name() != 'classes']"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (header?, footer?)
- Attributes: The decoration element contains only the common attributes:
- ids, names, dupnames, source, and classes.
-
- Although the content model doesn't specifically require contents, no empty
- decoration elements are ever created.
- -->
- <!-- == structural_subelement -->
- <xsl:template
- match="//document/decoration">
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- TODO To be rendered as `.. header::` directive -->
- <!-- == decorative_element -->
- <xsl:template
- match="//document/decoration/header">
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- TODO To be rendered as `.. footer::` directive -->
- <!-- == decorative_element -->
- <xsl:template
- match="//document/decoration/footer">
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (%bibliographic.elements;)+
- Attributes: The docinfo element contains only the common attributes: ids,
- names, dupnames, source, and classes.
- -->
- <!-- == structural_subelement -->
- <xsl:template
- match="docinfo">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:blank"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: ((author, organization?, address?, contact?)+)
- Attributes: The authors element contains only the common attributes: ids,
- names, dupnames, source, and classes.
-
- In reStructuredText, multiple author's names are separated with semicolons
- (";") or commas (","); semicolons take precedence. There is currently no way
- to represent the author's organization, address, or contact in a
- reStructuredText "Authors" field.
- -->
- <!-- == bibliographic_element == folding_element -->
- <xsl:template
- match="docinfo/authors">
- <xsl:call-template
- name="u:outputFolding">
- <xsl:with-param
- name="prefix">
- <xsl:text>:</xsl:text>
- <xsl:value-of
- select="name()"/>
- <xsl:text>: </xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Content Model: %text.model;
- Attributes: All docinfo elements contains the common attributes (ids,
- names, dupnames, source, and classes)
- Some docinfo elements also have xml:space.
- -->
- <xsl:template
- match="docinfo/authors/*">
- <xsl:apply-templates/>
- <!-- no semicolon after final author -->
- <xsl:if
- test="generate-id(current()) != generate-id(../*[last()])">
- <xsl:text>; </xsl:text>
- </xsl:if>
- </xsl:template>
-
- <!--
- Content Model: (field_name, field_body)
- Attributes: The field element contains only the common attributes: ids,
- names, dupnames, source, and classes.
- -->
- <!-- == bibliographic_element -->
- <xsl:template
- match="docinfo/field">
- <!-- contents handled by ordinary field lists -->
- <xsl:apply-templates/>
- <!-- Supply an EOL because following elements do not recognize this -->
- &tEOL;
- </xsl:template>
-
- <!--
- Content Model: %text.model;
- Attributes: All docinfo elements contains the common attributes (ids,
- names, dupnames, source, and classes)
- Some docinfo elements also have xml:space.
- -->
- <!-- == bibliographic_element == folding_element -->
- <xsl:template
- match="docinfo/*[name()!='authors' and name()!='field']">
- <xsl:call-template
- name="u:outputFolding">
- <xsl:with-param
- name="prefix">
- <xsl:text>:</xsl:text>
- <xsl:value-of
- select="name()"/>
- <xsl:text>: </xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: EMPTY
- Attributes: The transition element contains only the common attributes:
- ids, names, dupnames, source, and classes.
- -->
- <!-- == structural_subelement -->
- <xsl:template
- match="transition">
- <xsl:call-template
- name="u:outputClass"/>
- &tCR; <!-- req: blank line before -->
- <xsl:text>-----</xsl:text>
- &tEOL;
- <!-- Add a required blank line after unless class follows immediately -->
- <xsl:if
- test="not(following-sibling::*[1]/@classes)">
- &tCR;
- </xsl:if>
- </xsl:template>
-
- <!-- ******************************************************************** -->
- <!-- ******************************************************************** -->
-
- <!--
- IFF there is a /document/title element, it is the publication's title. All
- other titles will appear within sections.
-
- Content Model: %text.model;
- Attributes: The title element contains the common attributes (ids, names,
- dupnames, source, and classes), plus refid and auto.
- refid is used as a backlink to a table of contents entry.
- auto is used to indicate (with value "1") that the title has been
- numbered automatically.
- -->
- <!-- == structural_subelement -->
- <xsl:template
- match="//document/title">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:variable
- name="textWS">
- <!-- Catch the title text as it is rendered so its length can be
- determined -->
- <xsl:apply-templates/>
- </xsl:variable>
- <xsl:variable
- name="text"
- select="normalize-space($textWS)"/>
- <xsl:variable
- name="length"
- select="string-length($text)"/>
- <xsl:call-template
- name="u:overline">
- <xsl:with-param
- name="length"
- select="$length"/>
- <xsl:with-param
- name="depth"
- select="1"/>
- </xsl:call-template>
- <xsl:value-of
- select="$text"/>
- &tEOL;
- <xsl:call-template
- name="u:underline">
- <xsl:with-param
- name="length"
- select="$length"/>
- <xsl:with-param
- name="depth"
- select="1"/>
- </xsl:call-template>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Title Underlines are defined by their position within the tree.
-
- Content Model: %text.model;
- Attributes: The title element contains the common attributes (ids, names,
- dupnames, source, and classes), plus refid and auto.
- refid is used as a backlink to a table of contents entry.
- auto is used to indicate (with value "1") that the title has been
- numbered automatically.
- -->
- <!-- == structural_subelement -->
- <xsl:template
- match="section/title">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:variable
- name="textWS">
- <!-- catch the title text as it is rendered -->
- <xsl:apply-templates/>
- </xsl:variable>
- <xsl:variable
- name="text"
- select="normalize-space($textWS)"/>
- <xsl:variable
- name="length"
- select="string-length($text)"/>
- <xsl:variable
- name="depth"
- select="count(ancestor::section)"/>
- <xsl:call-template
- name="u:overline">
- <xsl:with-param
- name="length"
- select="$length"/>
- <xsl:with-param
- name="depth"
- select="$depth + 2"/>
- </xsl:call-template>
- <xsl:value-of
- select="$text"/>
- &tEOL;
- <xsl:call-template
- name="u:underline">
- <xsl:with-param
- name="length"
- select="$length"/>
- <xsl:with-param
- name="depth"
- select="$depth + 2"/>
- </xsl:call-template>
- <!-- Add a blank line after unless structure follows immediately -->
- <xsl:if
- test="not(contains(concat($structural_elements, $compound_body_elements), concat('*', name(following-sibling::*[1]), '*')) or following-sibling::*[1]/@classes)">
- &tCR;
- </xsl:if>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: %text.model;
- Attributes: The title element contains the common attributes (ids, names,
- dupnames, source, and classes), plus refid and auto.
- refid is used as a backlink to a table of contents entry.
- auto is used to indicate (with value "1") that the title has been
- numbered automatically.
- -->
- <!-- == structural_subelement -->
- <xsl:template
- match="title">
- <xsl:call-template
- name="u:outputClass">
- <xsl:with-param
- name="alreadyBlanked"
- select="true()"/>
- </xsl:call-template>
- <!-- blank line provided by parent -->
- <xsl:apply-templates/>
- <!-- no EOL: provided by parent -->
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- IFF there is a /document/title element, it is the publication's title. All
- other titles will appear within sections.
-
- Content Model: %text.model;
- Attributes: The subtitle element contains only the common attributes:
- ids, names, dupnames, source, and classes.
- -->
- <!-- == structural_subelement -->
- <xsl:template
- match="//document/subtitle">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:variable
- name="textWS">
- <!-- Catch the title text as it is rendered -->
- <xsl:apply-templates/>
- </xsl:variable>
- <xsl:variable
- name="text"
- select="normalize-space($textWS)"/>
- <xsl:variable
- name="length"
- select="string-length($text)"/>
-
- <!-- always a blank line above -->
- &tCR;
- <xsl:call-template
- name="u:overline">
- <xsl:with-param
- name="length"
- select="$length"/>
- <xsl:with-param
- name="depth"
- select="2"/>
- </xsl:call-template>
- <xsl:value-of
- select="$text"/>
- &tEOL;
- <xsl:call-template
- name="u:underline">
- <xsl:with-param
- name="length"
- select="$length"/>
- <xsl:with-param
- name="depth"
- select="2"/>
- </xsl:call-template>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: %text.model;
- Attributes: The subtitle element contains only the common attributes: ids,
- names, dupnames, source, and classes.
- -->
- <!-- == structural_subelement -->
- <xsl:template
- match="sidebar/subtitle">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:indent"/>
- <xsl:apply-templates/>
- &tEOL;
- &tCR;
- </xsl:template>
-
- <!-- ******************************************************************** -->
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: %text.model;
- Attributes: The comment element contains only the common attributes: ids,
- names, dupnames, source, and classes.
- -->
- <!-- == simple_body_element == folding_element == directive -->
- <xsl:template
- match="comment">
- <xsl:call-template
- name="u:BandI"/>
- <xsl:call-template
- name="u:outputFolding">
- <xsl:with-param
- name="prefix">
- <xsl:text>.. </xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: %text.model;
- Attributes: The doctest_block element contains the common attributes (ids,
- names, dupnames, source, and classes), plus xml:space.
- -->
- <!-- == simple_body_element -->
- <xsl:template
- match="doctest_block">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:BandI"/>
- <xsl:apply-templates/>
- &tEOL;
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- An image element can have various roles; they are all covered here -->
- <!-- == simple_body_element == inline_element == directive -->
- <xsl:template
- match="image">
- <xsl:choose>
- <xsl:when
- test="contains($inline_containers, concat('*', name(..), '*')) and @alt">
- <!-- An inline image with an `@alt' - must be a substitution
- reference -->
- <xsl:text>|</xsl:text>
- <!-- Original text is lost - use what we have -->
- <xsl:value-of
- select="@alt"/>
- <xsl:text>|</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <!-- A directive -->
- <xsl:if
- test="not(parent::figure)">
- <xsl:if
- test="not(parent::substitution_definition)">
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. </xsl:text>
- </xsl:if>
- <xsl:text>image:: </xsl:text>
- </xsl:if>
- <xsl:value-of
- select="@uri"/>
- &tEOL;
- <xsl:choose>
- <xsl:when
- test="parent::figure">
- <!-- `@classes' is special because it is in the parent -->
- <xsl:if
- test="../@classes">
- <xsl:call-template
- name="u:param">
- <xsl:with-param
- name="name"
- select="'figclass'"/>
- <xsl:with-param
- name="value"
- select="../@classes"/>
- <xsl:with-param
- name="ancestors"
- select="ancestor::*"/>
- </xsl:call-template>
- </xsl:if>
- <!-- `@align' is special because it is in the parent -->
- <xsl:if
- test="../@align">
- <xsl:call-template
- name="u:param">
- <xsl:with-param
- name="name"
- select="'align'"/>
- <xsl:with-param
- name="value"
- select="../@align"/>
- <xsl:with-param
- name="ancestors"
- select="ancestor::*"/>
- </xsl:call-template>
- </xsl:if>
- <xsl:call-template
- name="u:params">
- <!-- `figure' would add one level of indentation -->
- <xsl:with-param
- name="ancestors"
- select="ancestor::*"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when
- test="parent::substitution_definition">
- <xsl:call-template
- name="u:params">
- <!-- `@alt' only for the real images -->
- <xsl:with-param
- name="params"
- select="@*[name() != 'alt']"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template
- name="u:params">
- <xsl:with-param
- name="params"
- select="@*[name() != 'ids' and name() != 'names']"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:if
- test="parent::reference">
- <!-- A clickable image -->
- <xsl:call-template
- name="u:param">
- <xsl:with-param
- name="name"
- select="'target'"/>
- <xsl:with-param
- name="value">
- <xsl:choose>
- <xsl:when
- test="../@name">
- <!-- An internal link -->
- <xsl:call-template
- name="u:inlineReference">
- <xsl:with-param
- name="text"
- select="../@refid"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <!-- An external link -->
- <xsl:value-of
- select="../@refuri"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param
- name="ancestors"
- select="ancestor-or-self::*"/>
- </xsl:call-template>
- </xsl:if>
- <!-- Always blank line after parameter block -->
- &tCR;
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (line_block | line)+
- Attributes: The line_block element contains the common attributes (ids,
- names, dupnames, source, and classes), plus xml:space.
- -->
- <!-- == compound_body_element -->
- <xsl:template
- match="line_block">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:variable
- name="isEmbedded"
- select="name(..) = 'line_block'"/>
- <xsl:if
- test="not($isEmbedded)">
- <xsl:call-template
- name="u:blank"/>
- </xsl:if>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: %text.model;
- Attributes: The line element contains the common attributes (ids,
- names, dupnames, source, and classes).
- -->
- <!-- == simple_body_subelement == folding_element -->
- <xsl:template
- match="line">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:variable
- name="indent">
- <xsl:call-template
- name="u:indent"/>
- </xsl:variable>
- <xsl:value-of
- select="$indent"/>
- <xsl:choose>
- <xsl:when
- test="node()">
- <!-- Only for non-empty lines -->
- <xsl:variable
- name="lineBlockIndent">
- <!-- Very special indendation for nested `line_block's -->
- <xsl:for-each
- select="ancestor::line_block[position() > 1]">
- <xsl:value-of
- select="str:padding(4)"/>
- </xsl:for-each>
- </xsl:variable>
- <xsl:call-template
- name="u:outputFolding">
- <xsl:with-param
- name="prefix">
- <xsl:text>| </xsl:text>
- <xsl:value-of
- select="$lineBlockIndent"/>
- </xsl:with-param>
- <xsl:with-param
- name="indent"
- select="concat($indent, ' ', $lineBlockIndent)"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>|</xsl:text>
- &tEOL;
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: %text.model;
- Attributes: The literal_block element contains the common attributes (ids,
- names, dupnames, source, and classes), plus xml:space.
- -->
- <!-- == simple_body_element == directive -->
- <xsl:template
- match="literal_block">
- <xsl:choose>
- <xsl:when
- test=".//*[contains($inline_elements, concat('*', name(), '*'))]">
- <!-- If it contains inline elements this is a parsed-literal -->
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. parsed-literal::</xsl:text>
- &tEOL;
- <xsl:call-template
- name="u:params"/>
- &tCR;
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template
- name="u:outputClass"/>
- <!-- TODO Support for the (fully) minimized style would be nice but
- is difficult to accomplish because there is a linefeed
- already when we arrive here :-( -->
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>::</xsl:text>
- &tEOL;
- &tCR;
- </xsl:otherwise>
- </xsl:choose>
- <xsl:variable
- name="isQuotedLiteral">
- <xsl:call-template
- name="u:isQuotedLiteral"/>
- </xsl:variable>
- <!-- Indent correctly depending on quoted literal or not -->
- <xsl:choose>
- <xsl:when
- test="string-length($isQuotedLiteral)">
- <xsl:call-template
- name="u:indent">
- <xsl:with-param
- name="ancestors"
- select="ancestor::*"/>
- </xsl:call-template>
- <xsl:apply-templates
- mode="quotedLiteral"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template
- name="u:indent">
- <xsl:with-param
- name="ancestors"
- select="ancestor-or-self::*"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </xsl:otherwise>
- </xsl:choose>
- &tEOL;
- </xsl:template>
-
- <!-- Indent a text of a quoted literal containing line feeds correctly -->
- <xsl:template
- match="text()"
- mode="quotedLiteral">
- <xsl:call-template
- name="u:indentLF">
- <xsl:with-param
- name="indent">
- <xsl:call-template
- name="u:indent">
- <xsl:with-param
- name="ancestors"
- select="ancestor::*[position() > 1]"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!-- Determine whether `$text' is a quoted literal and return the quote
- character if so -->
- <xsl:template
- name="u:isQuotedLiteral">
- <xsl:param
- name="text"
- select="text()"/>
- <xsl:param
- name="quote"
- select="substring($text, 1, 1)"/>
- <xsl:if
- test="contains($adornment_characters, $quote) and substring($text, 1, 1) = $quote">
- <!-- Given quote is an adornment character and first character is this
- quote -->
- <xsl:choose>
- <xsl:when
- test="contains($text, '
')">
- <!-- Test the remaining lines -->
- <xsl:call-template
- name="u:isQuotedLiteral">
- <xsl:with-param
- name="text"
- select="substring-after($text, '
')"/>
- <xsl:with-param
- name="quote"
- select="$quote"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <!-- No more lines to test so this is a quoted literal -->
- <xsl:value-of
- select="$quote"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: %text.model;
- Attributes: The paragraph element contains only the common attributes:
- ids, names, dupnames, source, and classes.
- -->
- <!-- == simple_body_element == folding_element -->
- <xsl:template
- match="paragraph">
- <xsl:variable
- name="previous"
- select="preceding-sibling::*[1]"/>
- <!-- Do indent except first element in some compound elements -->
- <xsl:variable
- name="needsIndent"
- select="($previous or not(parent::list_item or parent::field_body or contains($admonitions, concat('*', name(..), '*')))) and name($previous) != 'label'"/>
- <!-- Blank line in front if following a body element, except first
- elements in some compound elements -->
- <xsl:variable
- name="needsBlank"
- select="($previous or not(parent::list_item or ../parent::option_list_item or parent::field_body or parent::document or contains($admonitions, concat('*', name(..), '*')))) and (not($previous) or contains($body_elements, concat('*', name($previous), '*')) or name($previous) = 'title' and contains($titled_elements, concat('*', name(..), '*')) or name($previous) = 'docinfo')"/>
- <xsl:if
- test="$needsBlank">
- &tCR;
- </xsl:if>
- <xsl:if
- test="$needsIndent">
- <xsl:call-template
- name="u:indent"/>
- </xsl:if>
- <xsl:if
- test="@classes">
- <!-- This paragraph has a classes attribute - always needs newline and
- indent -->
- <xsl:call-template
- name="u:outputClass">
- <xsl:with-param
- name="alreadyBlanked"
- select="$needsBlank"/>
- <xsl:with-param
- name="alreadyIndented"
- select="$needsIndent"/>
- </xsl:call-template>
- <xsl:call-template
- name="u:BandI"/>
- </xsl:if>
- <xsl:call-template
- name="u:outputFolding"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- == simple_body_element -->
- <xsl:template
- match="pending">
- <xsl:call-template
- name="u:notSupported"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- == simple_body_element == inline_element == directive -->
- <xsl:template
- match="raw">
- <xsl:choose>
- <xsl:when
- test="contains($inline_containers, concat('*', name(..), '*'))">
- <!-- Used as a custom role -->
- <!-- TODO `role' directives must be generated for user-defined raw
- roles. -->
- <!-- The name of the custom role is not contained in the input -->
- <xsl:text>:RAW-ROLE:`</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>`</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <!-- A directive -->
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. raw:: </xsl:text>
- <xsl:value-of
- select="@format"/>
- &tEOL;
- <xsl:call-template
- name="u:params">
- <xsl:with-param
- name="params"
- select="@*[name() != 'format' and name() != 'classes']"/>
- </xsl:call-template>
- &tCR;
- <xsl:call-template
- name="u:indent">
- <xsl:with-param
- name="ancestors"
- select="ancestor-or-self::*"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- &tEOL;
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- == simple_body_element == folding_element == directive -->
- <xsl:template
- match="rubric">
- <xsl:call-template
- name="u:BandI"/>
- <xsl:call-template
- name="u:outputFolding">
- <xsl:with-param
- name="prefix">
- <xsl:text>.. rubric:: </xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- <xsl:call-template
- name="u:params"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- == compound_body_element == directive -->
- <xsl:template
- match="compound">
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. compound::</xsl:text>
- &tEOL;
- <xsl:call-template
- name="u:params"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- == compound_body_element == directive -->
- <xsl:template
- match="container">
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. container::</xsl:text>
- <xsl:if
- test="@classes">
- &tSP;
- <xsl:value-of
- select="@classes"/>
- </xsl:if>
- &tEOL;
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- == simple_body_element == directive -->
- <xsl:template
- match="substitution_definition">
- <!-- More than one child or not a directive is a replacement text -->
- <xsl:variable
- name="isReplace"
- select="not(* and count(node()) = 1 and contains($directives, concat('*', name(*[1]), '*')))"/>
- <xsl:call-template
- name="u:BandI"/>
- <xsl:variable
- name="prefix">
- <xsl:text>.. |</xsl:text>
- <xsl:call-template
- name="u:outputNames"/>
- <xsl:text>| </xsl:text>
- </xsl:variable>
- <xsl:choose>
- <xsl:when
- test="$isReplace">
- <!-- TODO Substitution references for replace can not be found because
- they are not marked as such; embedding them in `generated'
- would be nice -->
- <xsl:call-template
- name="u:outputFolding">
- <xsl:with-param
- name="prefix">
- <xsl:value-of
- select="$prefix"/>
- <xsl:text>replace:: </xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
- select="$prefix"/>
- <xsl:apply-templates/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: ((%body.elements;)+, attribution?)
- Attributes: The block_quote element contains only the common attributes:
- ids, names, dupnames, source, and classes.
- -->
- <!-- == compound_body_element -->
- <xsl:template
- match="block_quote">
- <xsl:if
- test="@classes = 'epigraph' or @classes = 'highlights' or @classes = 'pull-quote'">
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. </xsl:text>
- <xsl:value-of
- select="@classes"/>
- <xsl:text>::</xsl:text>
- &tEOL;
- <xsl:call-template
- name="u:params"/>
- </xsl:if>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- == simple_body_subelement == folding_element -->
- <xsl:template
- match="attribution">
- <xsl:call-template
- name="u:outputClass"/>
- <!-- blank line between quote and attribution -->
- &tCR;
- <xsl:call-template
- name="u:indent"/>
- <xsl:call-template
- name="u:outputFolding">
- <xsl:with-param
- name="prefix">
- <xsl:text>-- </xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- == compound_body_element == directive -->
- <xsl:template
- match="citation">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. [</xsl:text>
- <xsl:value-of
- select="label"/>
- <xsl:text>] </xsl:text>
- <xsl:apply-templates
- select="*[not(self::label)]"/>
- </xsl:template>
-
- <!-- == simple_body_subelement -->
- <xsl:template
- match="citation/label">
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- == compound_body_element == directive -->
- <xsl:template
- match="figure">
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. figure:: </xsl:text>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- == simple_body_subelement == folding_element -->
- <xsl:template
- match="caption">
- <xsl:call-template
- name="u:indent"/>
- <xsl:call-template
- name="u:outputFolding"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- == compound_body_subelement -->
- <xsl:template
- match="legend">
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- TODO Footnotes should continue on line of definition -->
-
- <!-- user-numbered footnotes lack @auto -->
- <!-- == compound_body_element == directive -->
- <xsl:template
- match="footnote[not(@auto)]">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. [</xsl:text>
- <xsl:apply-templates
- select="label"/>
- <xsl:text>] </xsl:text>
- <xsl:apply-templates
- select="*[not(self::label)]"/>
- </xsl:template>
-
- <!-- autonumbered footnotes have @auto -->
- <!-- if the target footnote_reference@names matches its label, it was not a
- numbered-name footnote -->
- <!-- == compound_body_element == directive -->
- <xsl:template
- match="footnote[@auto='1']">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. [#</xsl:text>
- <xsl:if
- test="@names = @ids">
- <xsl:call-template
- name="u:outputNames"/>
- </xsl:if>
- <xsl:text>] </xsl:text>
- <xsl:apply-templates
- select="*[not(self::label)]"/>
- </xsl:template>
-
- <!-- autosymboled footnotes have @auto -->
- <!-- == compound_body_element == directive -->
- <xsl:template
- match="footnote[@auto='*']">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. [*] </xsl:text>
- <xsl:apply-templates
- select="*[not(self::label)]"/>
- </xsl:template>
-
- <!-- == compound_body_element == directive -->
- <xsl:template
- match="footnote[starts-with(@names, 'TARGET_NOTE:\ ')]">
- <!-- This is not a footnote but a hint for a directive -->
- <xsl:if
- test="generate-id(//footnote[starts-with(@names, 'TARGET_NOTE:\ ')][1]) = generate-id(.)">
- <!-- Only for the first one -->
- <xsl:call-template
- name="u:BandI"/>
- <!-- TODO May have a `classes` attribute -->
- <xsl:text>.. target-notes::</xsl:text>
- &tEOL;
- </xsl:if>
- </xsl:template>
-
- <!-- == simple_body_subelement -->
- <xsl:template
- match="footnote/label">
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (list_item +)
- Attributes: The bullet_list element contains the common attributes (ids,
- names, dupnames, source, and classes), plus bullet.
- bullet is used to record the style of bullet from the input data.
- In documents processed from reStructuredText, it contains one of "-",
- "+", or "*". It may be ignored in processing.
- -->
- <!-- == compound_body_element -->
- <xsl:template
- match="bullet_list">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:apply-templates
- mode="bullet_list"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (definition_list_item +)
- Attributes: The definition_list element contains only the common
- attributes: ids, names, dupnames, source, and classes.
- -->
- <!-- == compound_body_element -->
- <xsl:template
- match="definition_list">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (term, classifier?, definition)
- Attributes: The definition_list_item element contains only the common
- attributes: ids, names, dupnames, source, and classes.
- -->
- <!-- == compound_body_subelement -->
- <xsl:template
- match="definition_list_item">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:BandI"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: %text.model;
- Attributes: The term element contains only the common attributes: ids,
- names, dupnames, source, and classes.
- -->
- <!-- == simple_body_subelement -->
- <xsl:template
- match="term">
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: %text.model;
- Attributes: The classifier element contains only the common attributes:
- ids, names, dupnames, source, and classes.
- -->
- <!-- == simple_body_subelement -->
- <xsl:template
- match="classifier">
- <xsl:text> : </xsl:text>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (%body.elements;)+
- Attributes: The definition element contains only the common attributes:
- ids, names, dupnames, source, and classes.
- -->
- <!-- == compound_body_subelement -->
- <xsl:template
- match="definition">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (list_item +)
- Attributes: The enumerated_list element contains the common attributes
- (ids, names, dupnames, source, and classes), plus enumtype, prefix, suffix, and
- start.
- enumtype is used to record the intended enumeration sequence, one
- of "arabic" (1, 2, 3, ...), "loweralpha" (a, b, c, ..., z), "upperalpha" (A,
- B, C, ..., Z), "lowerroman" (i, ii, iii, iv, ..., mmmmcmxcix [4999]), or
- "upperroman" (I, II, III, IV, ..., MMMMCMXCIX [4999]).
- prefix stores the formatting characters used before the enumerator. In
- documents originating from reStructuredText data, it will contain either ""
- (empty string) or "(" (left parenthesis). It may or may not affect
- processing.
- suffix stores the formatting characters used after the enumerator. In
- documents originating from reStructuredText data, it will contain either "."
- (period) or ")" (right parenthesis). Depending on the capabilities of the
- output format, this attribute may or may not affect processing.
- start contains the ordinal value of the first item in the list, in
- decimal. For lists beginning at value 1 ("1", "a", "A", "i", or "I"), this
- attribute may be omitted.
- -->
- <!-- == compound_body_element -->
- <xsl:template
- match="enumerated_list">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:apply-templates
- mode="enumerated_list"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (field +)
- Attributes: The field_list element contains only the common attributes:
- ids, names, dupnames, source, and classes.
- -->
- <!-- == compound_body_element -->
- <xsl:template
- match="field_list">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (field_name, field_body)
- Attributes: The field element contains only the common attributes: ids,
- names, dupnames, source, and classes.
- -->
- <!-- == compound_body_subelement -->
- <xsl:template
- match="field">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:BandI"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ********************************************************************** -->
-
- <!--
- Content Model: %text.model;
- Attributes: The field_name element contains only the common attributes:
- ids, names, dupnames, source, and classes.
- -->
- <!-- == simple_body_subelement -->
- <xsl:template
- match="field_name">
- <xsl:text>:</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>: </xsl:text>
- <!-- no EOL: field_body starts on same line -->
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (%body.elements;)*
- Attributes: The field_body element contains only the common attributes:
- ids, names, dupnames, source, and classes.
- -->
- <!-- == compound_body_subelement -->
- <xsl:template
- match="field_body">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (option_list_item +)
- Attributes: The option_list element contains only the common attributes:
- ids, names, dupnames, source, and classes.
- -->
- <!-- == compound_body_element -->
- <xsl:template
- match="option_list">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:blank"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (option_group, description)
- Attributes: The option_list_item element contains only the common
- attributes: ids, names, dupnames, source, and classes.
- -->
- <!-- == compound_body_subelement -->
- <xsl:template
- match="option_list_item">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:indent"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (option_group, description)
- Attributes: The option_group element contains only the common attributes:
- ids, names, dupnames, source, and classes.
- -->
- <!-- == compound_body_subelement -->
- <xsl:template
- match="option_group">
- <xsl:apply-templates/>
- &tEOL;
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (option_string, option_argument *)
- Attributes: The option element contains only the common attributes: ids,
- names, dupnames, source, and classes.
- -->
- <!-- == compound_body_subelement -->
- <xsl:template
- match="option">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:apply-templates/>
- <xsl:if
- test="generate-id(current()) != generate-id(../*[last()])">
- <!-- No comma after final option -->
- <xsl:text>, </xsl:text>
- </xsl:if>
- <!-- no EOL: description on same line -->
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (#PCDATA)
- Attributes: The option_string element contains only the common attributes:
- ids, names, dupnames, source, and classes.
- -->
- <!-- == simple_body_subelement -->
- <xsl:template
- match="option_string">
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (#PCDATA)
- Attributes: The option_argument element contains the common attributes
- (ids, names, dupnames, source, and classes), plus delimiter.
- delimiter contains the text preceding the option_argument:
- either the text separating it from the option_string (typically
- either "=" or " ")
- or the text between option arguments (typically either "," or " ").
- -->
- <!-- == simple_body_subelement -->
- <xsl:template
- match="option_argument">
- <xsl:value-of
- select="@delimiter"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (%body.elements;)+
- Attributes: The description element contains only the common attributes:
- ids, names, dupnames, source, and classes.
- -->
- <!-- == compound_body_subelement -->
- <xsl:template
- match="description">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:apply-templates/>
- &tEOL;
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (%body.elements;)+
- Attributes: The list_item element contains only the common attributes:
- ids, names, dupnames, source, and classes
-
- BULLET LIST
- bullet is used to record the style of bullet from the input data.
- In documents processed from reStructuredText, it contains one of "-",
- "+", or "*". It may be ignored in processing.
- -->
- <!-- == compound_body_subelement -->
- <xsl:template
- match="list_item"
- mode="bullet_list">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:BandI"/>
- <xsl:value-of
- select="../@bullet"/>
- &tSP; <!-- space after bullet -->
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- ENUMERATED LIST
- enumtype is used to record the intended enumeration sequence, one of
- "arabic" (1, 2, 3, ...), "loweralpha" (a, b, c, ..., z), "upperalpha" (A, B,
- C, ..., Z), "lowerroman" (i, ii, iii, iv, ..., mmmmcmxcix [4999]), or
- "upperroman" (I, II, III, IV, ..., MMMMCMXCIX [4999]).
- prefix stores the formatting characters used before the enumerator. In
- documents originating from reStructuredText data, it will contain either ""
- (empty string) or "(" (left parenthesis). It may or may not affect
- processing.
- suffix stores the formatting characters used after the enumerator. In
- documents originating from reStructuredText data, it will contain either "."
- (period) or ")" (right parenthesis). Depending on the capabilities of the
- output format, this attribute may or may not affect processing.
- start contains the ordinal value of the first item in the list, in
- decimal. For lists beginning at value 1 ("1", "a", "A", "i", or "I"), this
- attribute may be omitted.
-
- -->
- <!-- == compound_body_subelement -->
- <xsl:template
- match="list_item"
- mode="enumerated_list">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:BandI"/>
- <xsl:call-template
- name="u:outputEnumerator"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- Outputs a complete enumerator when called in an
- enumerated_list/list_item -->
- <xsl:template
- name="u:outputEnumerator">
- <!-- Use parent's numeration attribute -->
- <xsl:variable
- name="enumType"
- select="../@enumtype"/>
- <!-- Determine starting point -->
- <xsl:variable
- name="start">
- <xsl:choose>
- <xsl:when
- test="../@start">
- <xsl:value-of
- select="../@start"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
- select="1"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- Determine position of this item in its real context -->
- <xsl:variable
- name="position">
- <xsl:variable
- name="wanted"
- select="generate-id()"/>
- <!-- Generate the right current node list -->
- <xsl:for-each
- select="../list_item">
- <xsl:if
- test="generate-id() = $wanted">
- <xsl:value-of
- select="position()"/>
- </xsl:if>
- </xsl:for-each>
- </xsl:variable>
- <!-- Determine encoding of the number for the given numeration -->
- <xsl:variable
- name="cur">
- <xsl:call-template
- name="u:position2Enumerator">
- <xsl:with-param
- name="enumType"
- select="$enumType"/>
- <xsl:with-param
- name="position"
- select="$position"/>
- <xsl:with-param
- name="start"
- select="$start"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Determine encoding of the maximum number -->
- <xsl:variable
- name="max">
- <xsl:call-template
- name="u:position2Enumerator">
- <xsl:with-param
- name="enumType"
- select="$enumType"/>
- <xsl:with-param
- name="position"
- select="count(../list_item)"/>
- <xsl:with-param
- name="start"
- select="$start"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Output complete enumerator -->
- <xsl:value-of
- select="../@prefix"/>
- <xsl:value-of
- select="$cur"/>
- <xsl:value-of
- select="../@suffix"/>
- <!-- Output at least one trailing space -->
- &tSP;
- <!-- Output more whitespace to align with the maximum enumerator -->
- <xsl:if
- test="$enumType != 'lowerroman' and $enumType != 'upperroman'">
- <!-- Assumes that the maximum number has maximum string length -->
- <xsl:value-of
- select="str:padding(string-length($max) - string-length($cur))"/>
- </xsl:if>
- </xsl:template>
-
- <!-- Determine the right ordinal enumerator based on the parameters -->
- <xsl:template
- name="u:position2Enumerator">
- <xsl:param
- name="enumType"/>
- <xsl:param
- name="start"/>
- <xsl:param
- name="position"/>
- <!-- Determine logical number -->
- <xsl:variable
- name="ordinal"
- select="$start - 1 + $position"/>
- <xsl:choose>
- <xsl:when
- test="$enumType = 'arabic'">
- <xsl:value-of
- select="$ordinal"/>
- </xsl:when>
- <xsl:when
- test="$enumType = 'loweralpha'">
- <xsl:value-of
- select="substring('abcdefghijklmnopqrstzuvwxyz', $ordinal, 1)"/>
- </xsl:when>
- <xsl:when
- test="$enumType = 'upperalpha'">
- <xsl:value-of
- select="substring('ABCDEFGHIJKLMNOPQRSTZUVWXYZ', $ordinal, 1)"/>
- </xsl:when>
- <!-- TODO Support for counting roman numbers -->
- <xsl:when
- test="$enumType = 'lowerroman'">
- <xsl:text>i</xsl:text>
- </xsl:when>
- <xsl:when
- test="$enumType = 'upperroman'">
- <xsl:text>I</xsl:text>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!-- ******************************************************************** -->
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (title?, tgroup+)
- Attributes: The table element contains the common attributes and:
- frame, colsep, rowsep, pgwide
- -->
- <!-- == compound_body_element -->
- <xsl:template
- match="table">
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:blank"/>
- <xsl:apply-templates
- select="tgroup"/>
- <xsl:if
- test="title">
- <!-- TODO A table title must be rendered by using the `.. table::'
- directive -->
- <xsl:call-template
- name="u:BandI"/>
- <xsl:apply-templates
- select="title"/>
- &tEOL;
- </xsl:if>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (colspec*, thead?, tbody)
- Attributes: The tgroup element contains the common attributes and:
- cols, colsep, rowsep, align
- -->
- <!-- == compound_body_subelement -->
- <xsl:template
- match="tgroup">
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: EMPTY
- Attributes: The colspec element contains the common attributes and:
- colnum, colname, colwidth, colsep, rowsep, align, char, charoff
-
- The colwidth attribute gives the width of the respective column in characters
- including padding whitespace but no separator markup.
- -->
- <!-- == simple_body_subelement -->
- <!-- @colwidth needed by children but element has no own output -->
- <xsl:template
- match="colspec"/>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (row+)
- Attributes: The thead element contains the common attributes and:
- valign
- -->
- <!-- == compound_body_subelement -->
- <xsl:template
- match="thead">
- <xsl:apply-templates/>
- </xsl:template>
-
- <!--
- Content Model: (row+)
- Attributes: The tbody element contains the common attributes and:
- valign
- -->
- <!-- == compound_body_subelement -->
- <xsl:template
- match="tbody">
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (entry+)
- Attributes: The row element contains the common attributes and:
- rowsep, valign
- -->
- <!-- == compound_body_subelement -->
- <xsl:template
- match="row">
- <!-- Separator line above unless first row of a tbody with no previous
- thead (in this case the separator line is output already as the
- closing separator line of thead) -->
- <xsl:if
- test="position() > 1 or parent::thead or parent::tbody and not(../../thead)">
- <xsl:call-template
- name="u:rowSeparatorLine"/>
- </xsl:if>
- <!-- Determine heights in physical lines of all entries -->
- <xsl:variable
- name="heights">
- <xsl:for-each
- select="entry">
- <xsl:variable
- name="text">
- <!-- Catch the text of all entries -->
- <xsl:apply-templates/>
- </xsl:variable>
- <!-- Compute height of this entry; leading and trailing EOL must be
- subtracted -->
- <xsl:value-of
- select="string-length($text) - string-length(translate($text, '
', '')) - 1"/>
- &tSP; <!-- A space as a list separator -->
- </xsl:for-each>
- </xsl:variable>
- <!-- Determine maximum height so every entry must be this high -->
- <xsl:variable
- name="maxHeight"
- select="math:max(str:tokenize(normalize-space($heights)))"/>
- <!-- Output all the physical lines of this row -->
- <xsl:call-template
- name="u:rowLines">
- <xsl:with-param
- name="currentLine"
- select="1"/>
- <xsl:with-param
- name="maxLine"
- select="$maxHeight"/>
- </xsl:call-template>
- <!-- Output final separator line if this is the last row -->
- <xsl:if
- test="position() = last()">
- <xsl:call-template
- name="u:rowSeparatorLine">
- <xsl:with-param
- name="char">
- <!-- Determine correct character for the separator line -->
- <xsl:choose>
- <xsl:when
- test="parent::thead">
- <xsl:value-of
- select="'='"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
- select="'-'"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <!-- Output physical line $currentLine of a row and continue until
- line $maxLine is output -->
- <xsl:template
- name="u:rowLines">
- <xsl:param
- name="currentLine"/>
- <xsl:param
- name="maxLine"/>
- <xsl:if
- test="$currentLine <= $maxLine">
- <!-- If there are still physical lines to output do it -->
- <xsl:call-template
- name="u:indent"/>
- <!-- Leading bar -->
- <xsl:text>|</xsl:text>
- <xsl:apply-templates>
- <xsl:with-param
- name="currentLine"
- select="$currentLine"/>
- </xsl:apply-templates>
- <!-- End of this physical line -->
- &tEOL;
- <!-- Continue with the next physical line -->
- <xsl:call-template
- name="u:rowLines">
- <xsl:with-param
- name="currentLine"
- select="$currentLine + 1"/>
- <xsl:with-param
- name="maxLine"
- select="$maxLine"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <!-- Output a separator line with all the right characters -->
- <xsl:template
- name="u:rowSeparatorLine">
- <xsl:param
- name="char"
- select="'-'"/>
- <xsl:call-template
- name="u:indent"/>
- <xsl:text>+</xsl:text>
- <xsl:for-each
- select="../../colspec">
- <xsl:value-of
- select="str:padding(@colwidth, $char)"/>
- <xsl:text>+</xsl:text>
- </xsl:for-each>
- &tEOL;
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: (%body.elements;)*
- Attributes: The entry element contains the common attributes and:
- colname, namest, morerows, colsep, rowsep, align, char, charoff, valign and
- morecols
- -->
- <!-- == compound_body_subelement -->
- <xsl:template
- match="entry">
- <!-- TODO `classes` attribute needs support -->
- <!-- This is called in two ways; if $currentLine = 0 all physical lines
- of this entry must be output; if $currentLine > 0 the physical line
- with exactly this number shall be output -->
- <xsl:param
- name="currentLine"
- select="0"/>
- <xsl:variable
- name="column"
- select="position() + sum(preceding-sibling::entry/@morecols)"/>
- <!-- Determine width in characters needed for this entry -->
- <xsl:variable
- name="width">
- <xsl:call-template
- name="u:computeEntryWidth">
- <xsl:with-param
- name="colspecs"
- select="../../../colspec"/>
- <xsl:with-param
- name="column"
- select="$column"/>
- <xsl:with-param
- name="span"
- select="@morecols"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Output the entry completely or a certain physical line -->
- <xsl:call-template
- name="u:outputEntry">
- <xsl:with-param
- name="string">
- <!-- Capture physical lines of the entry in a variable -->
- <xsl:apply-templates/>
- </xsl:with-param>
- <xsl:with-param
- name="width"
- select="$width"/>
- <xsl:with-param
- name="expectedIndent">
- <!-- Capture indent for the entry generated by the normal template
- rules to remove it later -->
- <xsl:call-template
- name="u:indent"/>
- </xsl:with-param>
- <xsl:with-param
- name="outputLine"
- select="$currentLine"/>
- </xsl:call-template>
- <!-- Final bar after the entry -->
- <xsl:text>|</xsl:text>
- </xsl:template>
-
- <!-- Compute width of the entry -->
- <xsl:template
- name="u:computeEntryWidth">
- <!-- The colspec elements of all columns -->
- <xsl:param
- name="colspecs"/>
- <!-- Column of this entry -->
- <xsl:param
- name="column"/>
- <!-- Number of columns this entry spans -->
- <xsl:param
- name="span"
- select="0"/>
- <xsl:param
- name="sum"
- select="0"/>
- <xsl:choose>
- <xsl:when
- test="$span">
- <!-- If entry spans multiple columns compute their width -->
- <xsl:call-template
- name="u:computeEntryWidth">
- <xsl:with-param
- name="colspecs"
- select="$colspecs"/>
- <xsl:with-param
- name="column"
- select="$column + 1"/>
- <xsl:with-param
- name="span"
- select="$span - 1"/>
- <!-- Add the separator character and the following column width -->
- <xsl:with-param
- name="sum"
- select="$sum + 1 + $colspecs[$column]/@colwidth"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <!-- Does not span more columns so return sum and width of this
- column -->
- <xsl:value-of
- select="$sum + $colspecs[$column]/@colwidth"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- Outputs one or all lines of a table entry as a string trimmed left and
- padded -->
- <xsl:template
- name="u:outputEntry">
- <!-- Width of the entry; there is no provision for actual physical lines
- longer than this width -->
- <xsl:param
- name="width"/>
- <!-- The string containing the remaining physical lines; may be an empty
- string -->
- <xsl:param
- name="string"
- select="''"/>
- <!-- The indendation which is expected to be prefixed before every
- physical line -->
- <xsl:param
- name="expectedIndent"
- select="''"/>
- <!-- Is this the first call to this template -->
- <xsl:param
- name="isFirst"
- select="true()"/>
- <!-- Number of physical line to output or 0 to output all lines -->
- <xsl:param
- name="outputLine"
- select="0"/>
- <!-- Output is wanted if all or the first physical line are to be
- output -->
- <xsl:variable
- name="doOutput"
- select="$outputLine = 0 or $outputLine = 1"/>
- <xsl:variable
- name="stringLFHalfTrimmed">
- <xsl:choose>
- <xsl:when
- test="$isFirst and substring($string, 1, 1) = '
'">
- <!-- Remove leading linefeed if this is the first time -->
- <xsl:value-of
- select="substring($string, 2)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
- select="$string"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable
- name="stringLFTrimmed">
- <xsl:choose>
- <xsl:when
- test="$isFirst and substring($stringLFHalfTrimmed, string-length($stringLFHalfTrimmed), 1) = '
'">
- <!-- Remove trailing linefeed if this is the first time -->
- <xsl:value-of
- select="substring($stringLFHalfTrimmed, 1, string-length($stringLFHalfTrimmed) - 1)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
- select="$stringLFHalfTrimmed"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- Determine remaining lines after the first one -->
- <xsl:variable
- name="remainingLines">
- <xsl:if
- test="contains($stringLFTrimmed, '
')">
- <xsl:value-of
- select="substring-after($stringLFTrimmed, '
')"/>
- </xsl:if>
- </xsl:variable>
- <xsl:if
- test="$doOutput">
- <!-- If this physical line must be output determine the first physical
- line -->
- <xsl:variable
- name="firstLine">
- <xsl:choose>
- <xsl:when
- test="string-length($remainingLines)">
- <xsl:value-of
- select="substring-before($stringLFTrimmed, '
')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
- select="$stringLFTrimmed"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- Remove the leading indentation from the physical line which is
- brought there by the normal templates -->
- <xsl:variable
- name="trimmed">
- <xsl:if
- test="string-length($firstLine)">
- <!-- Trim only non-empty lines -->
- <xsl:value-of
- select="substring-after($firstLine, $expectedIndent)"/>
- </xsl:if>
- </xsl:variable>
- <!-- Pad the line with a leading and a trailing space -->
- <xsl:variable
- name="padded"
- select="concat(' ', $trimmed, ' ')"/>
- <!-- Output the padded value -->
- <xsl:value-of
- select="$padded"/>
- <!-- Fill up the width of the entry with spaces -->
- <xsl:if
- test="$width - string-length($padded) < 0">
- <xsl:message>
- <xsl:text>WARNING: Table column too narrow (minimum: </xsl:text>
- <xsl:value-of
- select="string-length($padded)"/>
- <xsl:text>)</xsl:text>
- &tEOL;
- </xsl:message>
- </xsl:if>
- <xsl:value-of
- select="str:padding($width - string-length($padded))"/>
- </xsl:if>
- <xsl:if
- test="$outputLine > 1 or $outputLine = 0 and string-length($remainingLines)">
- <!-- If a following physical line must be output or if all physical
- lines shall be output and there are remaining physical lines -->
- <xsl:if
- test="$outputLine = 0">
- <!-- Output linefeed only if we output all the lines -->
- &tEOL;
- </xsl:if>
- <!-- Output the remaining lines -->
- <xsl:call-template
- name="u:outputEntry">
- <xsl:with-param
- name="width"
- select="$width"/>
- <xsl:with-param
- name="string"
- select="$remainingLines"/>
- <xsl:with-param
- name="expectedIndent"
- select="$expectedIndent"/>
- <xsl:with-param
- name="isFirst"
- select="false()"/>
- <xsl:with-param
- name="outputLine">
- <xsl:choose>
- <xsl:when
- test="$outputLine = 0">
- <xsl:value-of
- select="0"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
- select="$outputLine - 1"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <!-- ******************************************************************** -->
- <!-- ******************************************************************** -->
-
- <!-- == inline_element -->
- <xsl:template
- match="citation_reference">
- <xsl:call-template
- name="u:bkslshEscPre"/>
- <xsl:text>[</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>]_</xsl:text>
- <xsl:call-template
- name="u:bkslshEscSuf"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- == inline_element -->
- <xsl:template
- match="emphasis">
- <xsl:call-template
- name="u:bkslshEscPre"/>
- <xsl:text>*</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>*</xsl:text>
- <xsl:call-template
- name="u:bkslshEscSuf"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- user-numbered footnotes lack @auto -->
- <!-- == inline_element -->
- <xsl:template
- match="footnote_reference[not(@auto)]">
- <xsl:call-template
- name="u:bkslshEscPre"/>
- <xsl:text>[</xsl:text>
- <xsl:value-of
- select="text()"/>
- <xsl:text>]_</xsl:text>
- <xsl:call-template
- name="u:bkslshEscSuf"/>
- <!-- child paragraph provides blank line -->
- </xsl:template>
-
- <!-- automatically numbered footnotes have @auto -->
- <!-- if @names is different from label content, it is a named footnote -->
- <!-- == inline_element -->
- <xsl:template
- match="footnote_reference[@auto='1']">
- <xsl:variable
- name="ref"
- select="@refid"/>
- <xsl:if
- test="not(starts-with(//footnote[@ids=$ref]/@names, 'TARGET_NOTE:\ '))">
- <!-- Not a generated footnote reference for a `.. target-notes::';
- such footnote reference and the preceding space should be
- embedded in `generated'! -->
- <xsl:call-template
- name="u:bkslshEscPre"/>
- <xsl:text>[#</xsl:text>
- <xsl:if
- test="//footnote[@ids=$ref]/@names != //footnote[@ids=$ref]/label">
- <xsl:call-template
- name="u:outputNames">
- <xsl:with-param
- name="names"
- select="//footnote[@ids=$ref]/@names"/>
- </xsl:call-template>
- </xsl:if>
- <xsl:text>]_</xsl:text>
- <xsl:call-template
- name="u:bkslshEscSuf"/>
- </xsl:if>
- </xsl:template>
-
- <!-- automatically symboled footnotes have @auto=* -->
- <!-- == inline_element -->
- <xsl:template
- match="footnote_reference[@auto='*']">
- <xsl:call-template
- name="u:bkslshEscPre"/>
- <xsl:text>[*]_</xsl:text>
- <xsl:call-template
- name="u:bkslshEscSuf"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: %text.model;
- -->
- <!-- == inline_element -->
- <xsl:template
- match="literal">
- <xsl:call-template
- name="u:bkslshEscPre"/>
- <xsl:text>``</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>``</xsl:text>
- <xsl:call-template
- name="u:bkslshEscSuf"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- Attribute combinations found in `standard' text and other examples:
- @refuri = standalone hyperlink
- @ids @refid = TOC, probably all in <generated>
- @name @refuri with matching <target> in document = named external hyperlink _
- @name @refuri immediately followed by matching <target> = named embedded URI _
- @name @refuri with no matching <target> in document = anonymous embedded URI __
- @anonymous @name @refuri with no matching <target> in document = anonymous explicit URI __
- @name @refid = internal cross-reference _
- @anonymous @name @refid = anonymous implicit internal reference __
- @name @refid image = clickable image to internal reference _
- @refuri image = clickable image to standalone hyperlink
-
- A target matches if target/@names contains the lower cased, whitespace
- quoted reference/@name
- -->
-
- <!-- Standalone hyperlink -->
- <!-- == inline_element -->
- <xsl:template
- match="reference[not(@name or @anonymous)]">
- <xsl:call-template
- name="u:bkslshEscPre"/>
- <xsl:choose>
- <xsl:when
- test="starts-with(., 'PEP ')">
- <xsl:text>:PEP:`</xsl:text>
- <xsl:value-of
- select="substring-after(., 'PEP ')"/>
- <xsl:text>`</xsl:text>
- </xsl:when>
- <xsl:when
- test="starts-with(., 'RFC ')">
- <xsl:text>:RFC:`</xsl:text>
- <xsl:value-of
- select="substring-after(., 'RFC ')"/>
- <xsl:text>`</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:call-template
- name="u:bkslshEscSuf"/>
- </xsl:template>
-
- <!-- External references -->
- <!-- == inline_element -->
- <xsl:template
- match="reference[@name and @refuri]">
- <!-- Determine normalized name by downcasing it -->
- <xsl:variable
- name="normalized"
- select="translate(normalize-space(@name), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
- <xsl:variable
- name="quoted"
- select="str:replace($normalized, ' ', '\ ')"/>
- <xsl:variable
- name="matching"
- select="//target[contains(@names, $quoted)]"/>
- <xsl:call-template
- name="u:inlineReference">
- <xsl:with-param
- name="anonymous"
- select="not($matching) or @anonymous"/>
- <xsl:with-param
- name="embedded"
- select="not(@anonymous) and (not($matching) or generate-id(following-sibling::node()[1]) = generate-id($matching))"/>
- </xsl:call-template>
- </xsl:template>
-
- <!-- Internal references -->
- <!-- == inline_element -->
- <xsl:template
- match="reference[@name and @refid]">
- <xsl:call-template
- name="u:inlineReference">
- <xsl:with-param
- name="anonymous"
- select="@anonymous"/>
- </xsl:call-template>
- </xsl:template>
-
- <!-- Image references -->
- <!-- == inline_element -->
- <xsl:template
- match="reference[image]">
- <!-- All done by the `image' tag -->
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: %text.model;
- -->
- <!-- == inline_element -->
- <xsl:template
- match="strong">
- <xsl:call-template
- name="u:bkslshEscPre"/>
- <xsl:text>**</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>**</xsl:text>
- <xsl:call-template
- name="u:bkslshEscSuf"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- == inline_element -->
- <xsl:template
- match="subscript">
- <xsl:call-template
- name="u:bkslshEscPre"/>
- <xsl:text>:sub:`</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>`</xsl:text>
- <xsl:call-template
- name="u:bkslshEscSuf"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- == inline_element -->
- <xsl:template
- match="superscript">
- <xsl:call-template
- name="u:bkslshEscPre"/>
- <xsl:text>:sup:`</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>`</xsl:text>
- <xsl:call-template
- name="u:bkslshEscSuf"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- The target element has various roles depending on context; they are
- all handled here -->
- <!-- == simple_body_element == inline_element == directive -->
- <xsl:template
- match="target">
- <xsl:choose>
- <xsl:when
- test="name(preceding-sibling::*[1]) = 'reference'">
- <!-- An embedded inline target - handled by the reference itself -->
- </xsl:when>
- <xsl:when
- test="contains($inline_containers, concat('*', name(..), '*'))">
- <!-- An inline target of some sort -->
- <xsl:call-template
- name="u:inlineReference">
- <xsl:with-param
- name="isTarget"
- select="true()"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when
- test="@anonymous">
- <!-- An anonymous target directive -->
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>__ </xsl:text>
- <xsl:choose>
- <xsl:when
- test="@refid">
- <xsl:call-template
- name="u:outputNamesRefid"/>
- <xsl:text>_</xsl:text>
- </xsl:when>
- <xsl:when
- test="@refuri">
- <xsl:value-of
- select="@refuri"/>
- </xsl:when>
- </xsl:choose>
- &tEOL;
- </xsl:when>
- <xsl:when
- test="@names | @refid">
- <!-- A target directive -->
- <xsl:call-template
- name="u:outputClass"/>
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>.. _</xsl:text>
- <xsl:choose>
- <xsl:when
- test="@refid">
- <xsl:call-template
- name="u:outputNamesRefid"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable
- name="quoteNeeded"
- select="contains(@names, ':')"/>
- <xsl:if
- test="$quoteNeeded">
- <xsl:text>`</xsl:text>
- </xsl:if>
- <xsl:call-template
- name="u:outputNames"/>
- <xsl:if
- test="$quoteNeeded">
- <xsl:text>`</xsl:text>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>:</xsl:text>
- <xsl:if
- test="@refuri">
- <xsl:text> </xsl:text>
- <xsl:value-of
- select="@refuri"/>
- </xsl:if>
- &tEOL;
- </xsl:when>
- <xsl:otherwise>
- <!-- Should not happen -->
- <xsl:call-template
- name="u:notSupported"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: %text.model;
- -->
- <!-- == inline_element -->
- <xsl:template
- match="title_reference">
- <xsl:call-template
- name="u:bkslshEscPre"/>
- <xsl:text>`</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>`</xsl:text>
- <xsl:call-template
- name="u:bkslshEscSuf"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Content Model: %text.model;
- -->
- <!-- == inline_element -->
- <xsl:template
- match="inline">
- <!-- TODO `role' directives must be generated for plain and derived
- user-defined roles. -->
- <xsl:call-template
- name="u:bkslshEscPre"/>
- <xsl:text>:</xsl:text>
- <xsl:value-of
- select="@classes"/>
- <xsl:text>:`</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>`</xsl:text>
- <xsl:call-template
- name="u:bkslshEscSuf"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- TODO `meta` directive must be implemented. -->
-
- <!-- ******************************************************************** -->
-
- <!--
- Docutils wraps generated elements around text that is inserted (generated) by
- Docutils; i.e., text that was not in the document, like section numbers
- inserted by the "sectnum" directive.
- -->
- <!-- == inline_element -->
- <xsl:template
- match="generated"/>
-
- <!-- == inline_element -->
- <xsl:template
- match="problematic">
- <!-- Simply output the contained text because this is probably the
- original text-->
- <xsl:value-of
- select="text()"/>
- </xsl:template>
-
- <!-- == compound_body_element -->
- <xsl:template
- match="system_message"/>
-
- <!-- ******************************************************************** -->
- <!-- ******************************************************************** -->
-
- <!--
- When a block of text contains linefeeds, it was indented relative to a marker
- on the first line
- -->
- <xsl:template
- match="text()">
- <xsl:call-template
- name="u:indentLF"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
- <!-- ******************************************************************** -->
-
- <!-- Add a blank line if necessary and indent -->
- <xsl:template
- name="u:BandI">
- <xsl:call-template
- name="u:blank"/>
- <xsl:call-template
- name="u:indent"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- Add a blank line in certain contexts -->
- <xsl:template
- name="u:blank">
- <xsl:apply-templates
- mode="blankSkipInline"
- select="preceding::*[1]"/>
- </xsl:template>
-
- <!-- Find the preceding element we are really interested in and act
- according to this element -->
- <xsl:template
- mode="blankSkipInline"
- match="*">
- <xsl:choose>
- <!-- Skip all inline elements and body subelements and check their
- parents -->
- <xsl:when
- test="contains(concat($inline_elements, $simple_body_subelements, $compound_body_subelements), concat('*', name(.), '*'))">
- <xsl:apply-templates
- mode="blankSkipInline"
- select=".."/>
- </xsl:when>
- <xsl:otherwise>
- <!-- Reached the type of element we decide on -->
- <xsl:if
- test="contains($blank_after, concat('*', name(.), '*'))">
- &tCR;
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!--
- Indent a block if it's a child of...
- -->
- <data:lookup>
- <node
- name="address"
- indent="10"/>
- <node
- name="author"
- indent="9"/>
- <node
- name="authors"
- indent="10"/>
- <node
- name="contact"
- indent="10"/>
- <node
- name="copyright"
- indent="12"/>
- <node
- name="date"
- indent="7"/>
- <node
- name="organization"
- indent="15"/>
- <node
- name="revision"
- indent="11"/>
- <node
- name="status"
- indent="9"/>
- <node
- name="version"
- indent="10"/>
- <!-- This is only for `bullet_list/list_item';
- `enumerated_list/list_item' is handled special -->
- <node
- name="list_item"
- indent="2"/>
- <node
- name="definition_list_item"
- indent="4"/>
- <node
- name="field_body"
- indent="4"/>
- <node
- name="option_list_item"
- indent="4"/>
- <!-- This is also the indentation if block_quote comes as one of the
- special directives -->
- <node
- name="block_quote"
- indent="4"/>
- <node
- name="literal_block"
- indent="4"/>
- <node
- name="attribution"
- indent="3"/>
- <node
- name="line"
- indent="2"/>
- </data:lookup>
-
- <!-- Do indent according to ancestor -->
- <xsl:template
- name="u:indent">
- <!-- In some cases the ancestors to indent for need to be determined
- by the calling template -->
- <xsl:param
- name="ancestors"
- select="ancestor::*"/>
- <xsl:for-each
- select="$ancestors">
- <xsl:variable
- name="this"
- select="name()"/>
- <xsl:choose>
- <xsl:when
- test="contains($directives, concat('*', $this, '*'))">
- <!-- TODO Indentation of lines after some directives must be
- indented to align with the directive instead of a
- fixed indentation; however, this is rather complicated
- since identation for parameters should be fixed -->
- <xsl:value-of
- select="str:padding(3)"/>
- </xsl:when>
- <xsl:when
- test="$this = 'list_item' and parent::enumerated_list">
- <!-- Enumerated list items base their indentation on the
- numeration -->
- <xsl:variable
- name="enumerator">
- <xsl:call-template
- name="u:outputEnumerator"/>
- </xsl:variable>
- <xsl:value-of
- select="str:padding(string-length($enumerator))"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
- select="str:padding(document('')//data:lookup/node[@name=$this]/@indent)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- Indent a text containing line feeds correctly -->
- <xsl:template
- name="u:indentLF">
- <xsl:param
- name="string"
- select="."/>
- <!-- A fixed indentation may be given by caller -->
- <xsl:param
- name="indent">
- <!-- If not given compute it -->
- <xsl:call-template
- name="u:indent"/>
- </xsl:param>
- <xsl:choose>
- <xsl:when
- test="contains($string,'
')">
- <!-- Output first physical line -->
- <xsl:value-of
- select="substring-before($string, '
')"/>
- &tEOL;
- <!-- Indent before the next line -->
- <xsl:value-of
- select="$indent"/>
- <!-- Output remaining physical lines -->
- <xsl:call-template
- name="u:indentLF">
- <xsl:with-param
- name="string"
- select="substring-after($string, '
')"/>
- <xsl:with-param
- name="indent"
- select="$indent"/>
- </xsl:call-template>
- </xsl:when>
- <!-- String does not contain newline, so just output it -->
- <xsl:otherwise>
- <xsl:value-of
- select="$string"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- Do output for those elements which do fold their inline content -->
- <xsl:template
- name="u:outputFolding">
- <!-- The prefix text to be output before the body -->
- <xsl:param
- name="prefix"
- select="''"/>
- <!-- The indentation for this body -->
- <xsl:param
- name="indent">
- <xsl:call-template
- name="u:indent">
- <xsl:with-param
- name="ancestors"
- select="ancestor-or-self::*"/>
- </xsl:call-template>
- </xsl:param>
- <xsl:variable
- name="string">
- <!-- TODO Whitespace count of inline literals must be preserved -->
- <xsl:apply-templates/>
- </xsl:variable>
- <!-- Always output prefix with all trailing and leading spaces -->
- <xsl:value-of
- select="$prefix"/>
- <xsl:choose>
- <xsl:when
- test="$fold > 0">
- <xsl:variable
- name="normalized"
- select="normalize-space($string)"/>
- <xsl:choose>
- <xsl:when
- test="$string = ''">
- <!-- Empty strings need no output -->
- </xsl:when>
- <xsl:when
- test="$normalized = ''">
- <!-- Only white-space in string; output a single space here -->
- &tSP;
- </xsl:when>
- <xsl:otherwise>
- <!-- Output leading white-space here -->
- <xsl:if
- test="normalize-space(substring($string, 1, 1)) = ''">
- &tSP;
- </xsl:if>
- <xsl:call-template
- name="u:indentFold">
- <xsl:with-param
- name="string"
- select="$normalized"/>
- <xsl:with-param
- name="indent"
- select="$indent"/>
- <xsl:with-param
- name="cursorColumn"
- select="string-length($indent) + string-length($prefix)"/>
- </xsl:call-template>
- <!-- Output trailing white-space here -->
- <xsl:if
- test="normalize-space(substring($string, string-length($string), 1)) = ''">
- &tSP;
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
- select="$string"/>
- </xsl:otherwise>
- </xsl:choose>
- &tEOL;
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- Indent a string with folding -->
- <xsl:template
- name="u:indentFold">
- <!-- Normalized string to output -->
- <xsl:param
- name="string"/>
- <!-- Indentation to use for a new line -->
- <xsl:param
- name="indent"/>
- <!-- Current output column -->
- <!-- TODO This is not a correct assumption for field definitions where
- the field name effectively determines the column of the first
- line -->
- <xsl:param
- name="cursorColumn"
- select="string-length($indent)"/>
- <!-- Do we start on a new (indented) line? -->
- <xsl:param
- name="isNewLine"
- select="true()"/>
- <xsl:variable
- name="firstWord">
- <xsl:choose>
- <!-- TODO Quoted spaces must not end a word -->
- <xsl:when
- test="contains($string, ' ')">
- <xsl:value-of
- select="substring-before($string, ' ')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
- select="$string"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable
- name="rest"
- select="substring-after($string, ' ')"/>
- <xsl:choose>
- <xsl:when
- test="$string = ''"/>
- <xsl:when
- test="$isNewLine">
- <!-- Output at least first word -->
- <xsl:value-of
- select="$firstWord"/>
- <xsl:call-template
- name="u:indentFold">
- <xsl:with-param
- name="string"
- select="$rest"/>
- <xsl:with-param
- name="indent"
- select="$indent"/>
- <xsl:with-param
- name="cursorColumn"
- select="$cursorColumn + string-length($firstWord)"/>
- <xsl:with-param
- name="isNewLine"
- select="false()"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when
- test="$cursorColumn + 1 + string-length($firstWord) > $fold">
- <!-- Line would get too long; start new line, indent and continue -->
- &tEOL;
- <xsl:value-of
- select="$indent"/>
- <xsl:call-template
- name="u:indentFold">
- <xsl:with-param
- name="string"
- select="$string"/>
- <xsl:with-param
- name="indent"
- select="$indent"/>
- <xsl:with-param
- name="cursorColumn"
- select="string-length($indent)"/>
- <xsl:with-param
- name="isNewLine"
- select="true()"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <!-- In a line and first word fits; separate and add word -->
- &tSP;
- <xsl:value-of
- select="$firstWord"/>
- <xsl:call-template
- name="u:indentFold">
- <xsl:with-param
- name="string"
- select="$rest"/>
- <xsl:with-param
- name="indent"
- select="$indent"/>
- <xsl:with-param
- name="cursorColumn"
- select="$cursorColumn + 1 + string-length($firstWord)"/>
- <xsl:with-param
- name="isNewLine"
- select="false()"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- Output attributes of the current element as a field list -->
- <xsl:template
- name="u:params">
- <xsl:param
- name="params"
- select="@*"/>
- <!-- Ancestors are needed for determining indentation; caller may give
- them -->
- <xsl:param
- name="ancestors"
- select="ancestor-or-self::*"/>
- <xsl:for-each
- select="$params">
- <!-- Skip URIs based on parent -->
- <xsl:if
- test="name() != 'uri' and name() != 'xml:space'">
- <xsl:call-template
- name="u:param">
- <xsl:with-param
- name="ancestors"
- select="$ancestors"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <!-- Output one attribute of the current element as a field list -->
- <xsl:template
- name="u:param">
- <xsl:param
- name="name"
- select="name()"/>
- <xsl:param
- name="value"
- select="."/>
- <!-- Ancestors are needed for determining indentation; caller may give
- them -->
- <xsl:param
- name="ancestors"
- select="ancestor::*"/>
- <xsl:call-template
- name="u:indent">
- <xsl:with-param
- name="ancestors"
- select="$ancestors"/>
- </xsl:call-template>
- <xsl:text>:</xsl:text>
- <xsl:choose>
- <xsl:when
- test="$name = 'classes'">
- <xsl:text>class</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
- select="$name"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>:</xsl:text>
- <xsl:if
- test="$value">
- <xsl:text> </xsl:text>
- <xsl:value-of
- select="$value"/>
- </xsl:if>
- &tEOL;
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- Output `\' or `\ ' before some inline element if necessary -->
- <xsl:template
- name="u:bkslshEscPre">
- <!-- Get the sibling node directly before the current element -->
- <xsl:variable
- name="before"
- select="preceding-sibling::node()[1]"/>
- <xsl:choose>
- <!-- No sibling before this node -->
- <xsl:when
- test="not($before)"/>
- <!-- Element directly before this - must be another inline element -->
- <xsl:when
- test="name($before)">
- <!-- So separate it by a quoted space -->
- <xsl:text>\ </xsl:text>
- </xsl:when>
- <!-- Node directly before this is text - check it -->
- <xsl:when
- test="not(contains(concat($apos, ' 
	
"([{<-/:'), substring($before, string-length($before), 1)))">
- <!-- Does not end in one of the allowed characters so separate it -->
- <xsl:text>\ </xsl:text>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!-- Output `\' after some inline element if necessary -->
- <xsl:template
- name="u:bkslshEscSuf">
- <!-- Get the sibling node directly after the current element -->
- <xsl:variable
- name="after"
- select="following-sibling::node()[1]"/>
- <xsl:choose>
- <!-- No sibling after this node -->
- <xsl:when
- test="not($after)"/>
- <!-- Element directly after this - must be another inline element
- handling itself -->
- <xsl:when
- test="name($after)"/>
- <!-- Node directly after this is text - check it -->
- <xsl:when
- test="not(contains(concat($apos, ' 
	
")]}>-/:.,;!?\'), substring($after, 1, 1)))">
- <!-- Does not start with one of the allowed characters so separate
- it -->
- <xsl:text>\</xsl:text>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <xsl:template
- name="u:notSupported">
- <xsl:call-template
- name="u:BandI"/>
- <xsl:text>######## NOT SUPPORTED: `</xsl:text>
- <xsl:value-of
- select="name(.)"/>
- <xsl:text>' ########</xsl:text>
- &tEOL;
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <xsl:template
- name="u:overline">
- <!-- Length of the rendered(!) text -->
- <xsl:param
- name="length"/>
- <!-- Depth 1 and 2 are document title and subtitle while depths
- greater than 2 are normal section titles -->
- <xsl:param
- name="depth"/>
- <!-- Test whether a overline is wanted at all -->
- <xsl:if
- test="substring($adornment, 2 * ($depth - 1) + 1, 1) = 'o'">
- <xsl:value-of
- select="str:padding($length, substring($adornment, 2 * ($depth - 1) + 2, 1))"/>
- &tEOL;
- </xsl:if>
- </xsl:template>
-
- <xsl:template
- name="u:underline">
- <!-- Length of the rendered(!) text -->
- <xsl:param
- name="length"/>
- <!-- Depth 1 and 2 are document title and subtitle while depths
- greater than 2 are normal section titles -->
- <xsl:param
- name="depth"/>
- <xsl:value-of
- select="str:padding($length, substring($adornment, 2 * ($depth - 1) + 2, 1))"/>
- &tEOL;
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- Output a non-standalone reference or target -->
- <xsl:template
- name="u:inlineReference">
- <xsl:param
- name="anonymous"
- select="false()"/>
- <xsl:param
- name="embedded"
- select="false()"/>
- <!-- Is this a target instead of a reference? -->
- <xsl:param
- name="isTarget"
- select="false()"/>
- <xsl:param
- name="text"
- select="node()"/>
- <xsl:call-template
- name="u:bkslshEscPre"/>
- <!-- Delimiter only if link contains other than alphanumerics -->
- <xsl:variable
- name="delimiter">
- <xsl:if
- test="* or translate($text, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', '') or $embedded">
- <xsl:text>`</xsl:text>
- </xsl:if>
- </xsl:variable>
- <xsl:if
- test="$isTarget">
- <xsl:text>_</xsl:text>
- </xsl:if>
- <xsl:value-of
- select="$delimiter"/>
- <xsl:apply-templates
- select="$text"/>
- <xsl:if
- test="$embedded">
- <xsl:text> <</xsl:text>
- <xsl:value-of
- select="@refuri"/>
- <xsl:text>></xsl:text>
- </xsl:if>
- <xsl:value-of
- select="$delimiter"/>
- <xsl:if
- test="not($isTarget)">
- <xsl:text>_</xsl:text>
- <xsl:if
- test="$anonymous">
- <xsl:text>_</xsl:text>
- </xsl:if>
- </xsl:if>
- <xsl:call-template
- name="u:bkslshEscSuf"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- Output a class directive for the directly following element. -->
- <!-- TODO A class directive can also be used as a container putting the
- respective attribute to its content; however, this is not
- reflected in XML - you'd need to check a sequence of elements
- whether they all have the same attribute; furthermore class
- settings for block quotes needs to be treated special -->
- <xsl:template
- name="u:outputClass">
- <!-- Blank line already output? -->
- <xsl:param
- name="alreadyBlanked"
- select="false()"/>
- <!-- Indentation already output? -->
- <xsl:param
- name="alreadyIndented"
- select="false()"/>
- <!-- Add a blank line after class directive? -->
- <xsl:param
- name="blankAfter"
- select="false()"/>
- <xsl:if
- test="@classes">
- <xsl:if
- test="not($alreadyBlanked)">
- <xsl:call-template
- name="u:blank"/>
- </xsl:if>
- <xsl:if
- test="not($alreadyIndented)">
- <xsl:call-template
- name="u:indent"/>
- </xsl:if>
- <xsl:text>.. class:: </xsl:text>
- <xsl:value-of
- select="@classes"/>
- &tEOL;
- <xsl:if
- test="$blankAfter">
- &tCR;
- </xsl:if>
- </xsl:if>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- Output a names attribute at index considering quoted spaces. -->
- <xsl:template
- name="u:outputNames">
- <!-- Blank line already output? -->
- <xsl:param
- name="names"
- select="@names"/>
- <xsl:param
- name="index"
- select="0"/>
- <xsl:value-of
- select="str:replace(str:tokenize(normalize-space(str:replace($names, '\ ', '|')))[position() = $index + 1], '|', ' ')"/>
- </xsl:template>
-
- <!-- ******************************************************************** -->
-
- <!-- Output a names attribute for a refid. -->
- <xsl:template
- name="u:outputNamesRefid">
- <xsl:param
- name="refid"
- select="@refid"/>
- <!-- Determine the elements which is referred -->
- <xsl:variable
- name="refElem"
- select="//*[@ids and math:max(dyn:map(str:tokenize(normalize-space(@ids)), 'number($refid = .)')) > 0]"/>
- <xsl:call-template
- name="u:outputNames">
- <xsl:with-param
- name="names"
- select="$refElem/@names"/>
- <xsl:with-param
- name="index"
- select="math:max(dyn:map(str:tokenize(normalize-space($refElem/@ids)), 'number($refid = .) * position() - 1'))"/>
- </xsl:call-template>
- </xsl:template>
-
- <!-- ******************************************************************** -->
- <!-- ******************************************************************** -->
-
- <!-- Report unknown tags -->
- <xsl:template
- match="*">
- <xsl:message>
- <xsl:text>`</xsl:text>
- <xsl:value-of
- select="name(.)"/>
- <xsl:text>' encountered</xsl:text>
- <xsl:if
- test="parent::*">
- <xsl:text> in `</xsl:text>
- <xsl:value-of
- select="name(parent::*)"/>
- <xsl:text>'</xsl:text>
- </xsl:if>
- <xsl:text>, but no template matches.</xsl:text>
- </xsl:message>
- </xsl:template>
-
-</xsl:stylesheet>
-
-<!-- ********************************************************************** -->
-<!-- ********************************************************************** -->
-<!-- ********************************************************************** -->
-<!-- POD manual page
-
-=head1 NAME
-
-xml2rst-nopy.xsl - An XSLT script to convert Docutils XML to reStructuredText
-
-=head1 SYNOPSIS
-
- xsltproc docutils.xml xml2rst-nopy.xsl
-
-=head1 NOTE
-
-Today B<xml2rst-nopy.xsl> is not the recommended way to use
-B<xml2rst>. The preferred way is to install B<lxml> and use
-B<xml2rst.py> instead.
-
-=head1 DESCRIPTION
-
-B<xml2rst-nopy.xsl> is an XSLT script to convert Docutils XML to
-reStructuredText. You can use your favorite XSLT processor supporting
-EXSLT (e.g. xsltproc from the Gnome project) to generate
-reStructuredText from the Docutils intermediate XML representation.
-Its main use is to generate reStructuredText from some other format
-where a converter to Docutils XML already exists.
-
-=head2 Options
-
-The following options are supported. They are XSLT parameters for the
-whole script and must be given to the XSLT processor by the respective
-option (xsltproc: B<- -param> or B<- -stringparam>).
-
-=over 4
-
-=item adornment
-
-Configures title markup to use so different styles can be requested
-easily.
-
-The value of the parameter must be a string made up of a sequence of
-character pairs. The first character of a pair is C<o> (overline) or
-C<u> (underline) and the second character is the character to use for
-the markup.
-
-The first and the second character pair is used for document title and
-subtitle, the following pairs are used for section titles where the
-third pair is used for the top level section title.
-
-Defaults to C<o=o-u=u-u~u:u.u`>.
-
-=item fold
-
-Configures whether long text lines in paragraphs should be folded and
-to which length. This option is for input not coming from reST which
-may have no internal line feeds in plain text strings.
-
-If folding is enabled text strings not in a line feed preserving
-context are first white-space normalized and then broken according to
-the folding rules. Folding rules put out the first word and continue
-to do so with the following words unless the next word would cross
-the folding boundary. Words are delimited by white-space.
-
-Defaults to C<0>, i.e. no folding.
-
-=back
-
-=head2 Unsupported features
-
-It is generally not possible to create an exact reproduction of an
-original reStructuredText source from an intermediate XML file. The
-reason is that Docutils transports pretty much but not all information
-of the original source into the XML. Also the sequence is changed
-sometimes.
-
-However, the coverage of Docutils features of B<xml2rst-nopy.xsl> is
-pretty good. A few minor features are not supported:
-
-=over 4
-
-=item * Fully minimized style for literal blocks
-
-=item * Substitution references for C<replace::> substitutions
-
-=item * Counting roman numbers in enumerated lists
-
-=item * Special table types like C<list-table::> and C<csv-table::>
-
-=item * Custom role definitions
-
-=back
-
-=head1 INSTALLATION
-
-Installation is not necessary. Just use the file as downloaded with
-your favorite XSLT processor supporting EXSLT. For instance you can
-use B<xsltproc> from the Gnome project.
-
-=head1 AUTHOR
-
-Stefan Merten <smerten(a)oekonux.de> based on works by David Priest.
-
-=head1 LICENSE
-
-This program is licensed under the terms of the GPL. See
-
- http://www.gnu.org/licenses/gpl.txt
-
-=head1 AVAILABILTY
-
-See
-
- http://www.merten-home.de/FreeSoftware/xml2rst/
-
-=cut
-
--->
Modified: branches/jrst-docutils-jython/pom.xml
===================================================================
--- branches/jrst-docutils-jython/pom.xml 2012-05-30 15:45:20 UTC (rev 689)
+++ branches/jrst-docutils-jython/pom.xml 2012-05-31 08:02:14 UTC (rev 690)
@@ -161,53 +161,6 @@
</dependency>
<dependency>
- <groupId>org.apache.xmlgraphics</groupId>
- <artifactId>fop</artifactId>
- <version>1.0</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis-ext</artifactId>
- </exclusion>
- <exclusion>
- <artifactId>xalan</artifactId>
- <groupId>xalan</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- <version>${xalanVersion}</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>xalan</groupId>
- <artifactId>serializer</artifactId>
- <version>${xalanVersion}</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
<groupId>net.sourceforge.saxon</groupId>
<artifactId>saxon</artifactId>
<version>9.1.0.8</version>
1
0
r689 - in branches/jrst-docutils-jython/jrst/src/main: java/org/nuiton/jrst resources/xsl
by jpages@users.nuiton.org 30 May '12
by jpages@users.nuiton.org 30 May '12
30 May '12
Author: jpages
Date: 2012-05-30 17:45:20 +0200 (Wed, 30 May 2012)
New Revision: 689
Url: http://nuiton.org/repositories/revision/jrst/689
Log:
Ajout de la feuille de style xml2rst.xsl qui avait ?\195?\169t?\195?\169 enlev?\195?\169e.
Added:
branches/jrst-docutils-jython/jrst/src/main/resources/xsl/xml2rst.xsl
Modified:
branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRST.java
Modified: branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRST.java
===================================================================
--- branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRST.java 2012-05-30 15:34:49 UTC (rev 688)
+++ branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRST.java 2012-05-30 15:45:20 UTC (rev 689)
@@ -118,6 +118,9 @@
/** XSL Stylesheet to transform Docbook into PDF. */
protected static final String DOCBOOK_2_FO = "/docbook/fo/docbook.xsl";
+ /** XSL Stylesheet to transform XML into RST. */
+ protected static final String XML_2_RST = "/xsl/xml2rst.xsl";
+
public static final String PATTERN_TYPE = "xml|xhtml|docbook|html|htmlInnerBody|xdoc|rst|fo|pdf";
/** HTML output format type */
@@ -174,7 +177,7 @@
stylesheets.put(TYPE_XHTML, RST_2_DOCBOOK + "," + DOCBOOK_2_XHTML);
stylesheets.put(TYPE_JAVAHELP, RST_2_DOCBOOK + "," + DOCBOOK_2_JAVAHELP);
stylesheets.put(TYPE_HTMLHELP, RST_2_DOCBOOK + "," + DOCBOOK_2_HTMLHELP);
- stylesheets.put(TYPE_RST, "");
+ stylesheets.put(TYPE_RST, XML_2_RST);
stylesheets.put(TYPE_FO, RST_2_DOCBOOK + "," + DOCBOOK_2_FO);
stylesheets.put(TYPE_PDF, RST_2_XHTML);
Added: branches/jrst-docutils-jython/jrst/src/main/resources/xsl/xml2rst.xsl
===================================================================
--- branches/jrst-docutils-jython/jrst/src/main/resources/xsl/xml2rst.xsl (rev 0)
+++ branches/jrst-docutils-jython/jrst/src/main/resources/xsl/xml2rst.xsl 2012-05-30 15:45:20 UTC (rev 689)
@@ -0,0 +1,3744 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY CR "
">
+<!-- "xml:space='preserve'" is needed for use with libxslt -->
+<!-- "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'" is needed for
+ use with xsltproc -->
+<!-- Used to create a blank line -->
+<!ENTITY tCR "<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xml:space='preserve'>&CR;</xsl:text>">
+<!-- Used when the line before must be ended -->
+<!ENTITY tEOL "<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xml:space='preserve'>&CR;</xsl:text>">
+<!ENTITY tSP "<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xml:space='preserve'> </xsl:text>">
+]>
+
+<!--
+ Copyright (C) 2005, 2006 Stefan Merten, David Priest
+ Copyright (C) 2009, 2010, 2011 Stefan Merten
+
+ xml2rst.xsl is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+-->
+
+<!-- ********************************************************************** -->
+<!-- ********************************************************************** -->
+
+<!-- These elements in the DTD need support:
+
+ - ``colspec`` has attribute "stub %yesorno; #IMPLIED"
+
+ - ``document`` has attribute "title CDATA #IMPLIED"
+
+ Probably rendered by the `.. title::` directive
+
+ -->
+
+<!--
+Set namespace extensions. These are used as [shortname]:[tag] throughout the
+XSL-FO files.
+xsl: eXtensible Stylesheet Language
+u: user extensions (indicates utility 'call-template' routines defined in
+these XSL files)
+data: Data elements used by the stylesheet
+-->
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:u="u"
+ xmlns:data="a"
+ exclude-result-prefixes="data"
+ xmlns:str="http://exslt.org/strings"
+ xmlns:dyn="http://exslt.org/dynamic"
+ xmlns:math="http://exslt.org/math"
+ extension-element-prefixes="str dyn math">
+
+ <!-- xmlns:regexp="http://exslt.org/regular-expressions" not supported :-( -->
+
+ <xsl:output
+ method="text"
+ omit-xml-declaration="yes"
+ indent="no"/>
+
+ <!-- ******************************************************************** -->
+ <!-- ******************************************************************** -->
+
+ <!-- Parameter to configure title markup; see manual page for description -->
+ <xsl:param
+ name="adornment"
+ select="'o=o-u=u-u~u`u,u.'"/>
+
+ <!-- Parameter for folding long lines; see manual page for description -->
+ <xsl:param
+ name="fold"
+ select="0"/>
+
+ <!-- ******************************************************************** -->
+ <!-- ******************************************************************** -->
+
+ <xsl:variable
+ name="apos"
+ select='"'"'/>
+
+ <xsl:variable
+ name="structural_elements"
+ select="'*document*section*topic*sidebar*'"/>
+
+ <xsl:variable
+ name="structural_subelements"
+ select="'*title*subtitle*docinfo*decoration*transition*'"/>
+
+ <xsl:variable
+ name="bibliographic_elements"
+ select="'*address*author*authors*contact*copyright*date*field*organization*revision*status*version*'"/>
+
+ <xsl:variable
+ name="decorative_elements"
+ select="'*footer*header*'"/>
+
+ <xsl:variable
+ name="simple_body_elements_no_substitution"
+ select="'*comment*doctest_block*image*literal_block*paragraph*pending*raw*rubric*target*'"/>
+
+ <xsl:variable
+ name="folding_elements"
+ select="concat('*comment*paragraph*rubric*attribution*caption*line*', substring-after($bibliographic_elements, '*'))"/>
+
+ <xsl:variable
+ name="simple_body_elements"
+ select="concat($simple_body_elements_no_substitution, 'substitution_definition*')"/>
+
+ <xsl:variable
+ name="compound_body_elements"
+ select="'*admonition*attention*block_quote*bullet_list*caution*citation*compound*danger*definition_list*enumerated_list*error*field_list*figure*footnote*hint*important*line_block*note*option_list*system_message*table*tip*warning*container*'"/>
+
+ <xsl:variable
+ name="body_elements"
+ select="concat($simple_body_elements, substring-after($compound_body_elements, '*'))"/>
+
+ <xsl:variable
+ name="admonitions"
+ select="'*admonition*attention*caution*danger*error*hint*important*note*tip*warning*'"/>
+
+ <xsl:variable
+ name="simple_body_subelements"
+ select="'*attribution*caption*classifier*colspec*field_name*label*line*option_argument*option_string*term*'"/>
+
+ <xsl:variable
+ name="compound_body_subelements"
+ select="'*definition*definition_list_item*description*entry*field*field_body*legend*list_item*option*option_group*option_list_item*row*tbody*tgroup*thead*'"/>
+
+ <xsl:variable
+ name="inline_elements"
+ select="'*abbreviation*acronym*citation_reference*emphasis*footnote_reference*generated*image*inline*literal*problematic*reference*strong*subscript*substitution_reference*superscript*target*title_reference*raw*'"/>
+
+ <xsl:variable
+ name="inline_containers"
+ select="concat($simple_body_elements_no_substitution, substring-after($inline_elements, '*'))"/>
+
+ <xsl:variable
+ name="directives"
+ select="'*admonition*attention*caution*comment*danger*error*footnote*hint*important*note*tip*warning*image*figure*topic*sidebar*rubric*meta*raw*citation*compound*substitution_definition*container*'"/>
+
+ <xsl:variable
+ name="titled_elements"
+ select="'*sidebar*topic*admonition*'"/>
+
+ <xsl:variable
+ name="blank_after"
+ select="concat($structural_elements, substring-after($structural_subelements, '*'), substring-after($body_elements, '*'))"/>
+
+ <xsl:variable
+ name="adornment_characters"
+ select="concat($apos, '!"#$%&()*+,-./:;<=>?@[\]^_`{|}~')"/>
+
+ <!-- ******************************************************************** -->
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: ((title, subtitle?)?, docinfo?, decoration?,
+ %structure.model;)
+
+ Attributes: The document element contains only the common attributes: ids,
+ names, dupnames, source, and classes.
+
+ Depending on the source of the data and the stage of processing, the
+ "document" may not initially contain a "title". A document title is not
+ directly representable in reStructuredText. Instead, a lone top-level section
+ may have its title promoted to become the document title, and similarly for a
+ lone second-level (sub)section's title to become the document subtitle. The
+ "docinfo" may be transformed from an initial field_list, and "decoration" is
+ usually constructed programmatically.
+ -->
+ <!-- == structural_element -->
+ <xsl:template
+ match="document">
+ <xsl:if
+ test="//generated[@classes = 'sectnum']">
+ <xsl:text>.. section-numbering::</xsl:text>
+ &tEOL;
+ &tCR;
+ </xsl:if>
+ <xsl:call-template
+ name="u:outputClass">
+ <xsl:with-param
+ name="blankAfter"
+ select="true()"/>
+ </xsl:call-template>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (title, %structure.model;)
+ Attributes: The section element contains only the common attributes: ids,
+ names, dupnames, source, and classes.
+ -->
+ <!-- == structural_element -->
+ <xsl:template
+ match="section">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:blank"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- == structural_element -->
+ <xsl:template
+ match="section[@classes = 'system-messages']"/>
+ <!-- Ignore system messages completely -->
+ <!-- This should be really in `generated' -->
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (title, subtitle?, (%body.elements;)+)
+ Attributes: The sidebar element contains only the common attributes: ids,
+ names, dupnames, source, and classes.
+ -->
+ <!-- == structural_element == directive -->
+ <xsl:template
+ match="sidebar">
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. sidebar:: </xsl:text>
+ <xsl:value-of
+ select="title"/>
+ &tEOL;
+ <xsl:if
+ test="subtitle">
+ <xsl:call-template
+ name="u:param">
+ <xsl:with-param
+ name="name"
+ select="'subtitle'"/>
+ <xsl:with-param
+ name="value"
+ select="subtitle"/>
+ <xsl:with-param
+ name="ancestors"
+ select="ancestor-or-self::*"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:call-template
+ name="u:params"/>
+ <!-- Always blank line after parameter block -->
+ &tCR;
+ <xsl:apply-templates
+ select="*[not(self::title) and not(self::subtitle)]"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (title?, (%body.elements;)+)
+ Attributes: The topic element contains only the common attributes: ids,
+ names, dupnames, source, and classes.
+ -->
+ <!-- == structural_element == directive -->
+ <xsl:template
+ match="topic">
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. topic:: </xsl:text>
+ <xsl:value-of
+ select="title"/>
+ &tEOL;
+ <xsl:call-template
+ name="u:params"/>
+ <xsl:apply-templates
+ select="*[not(self::title)]"/>
+ </xsl:template>
+
+ <!-- == structural_element == directive -->
+ <xsl:template
+ match="topic[starts-with(@classes, 'contents')]">
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. contents:: </xsl:text>
+ <xsl:apply-templates
+ select="title"/>
+ &tEOL;
+ <xsl:call-template
+ name="u:params">
+ <xsl:with-param
+ name="params"
+ select="@*[name() != 'ids' and name() != 'names' and name() != 'classes']"/>
+ </xsl:call-template>
+ <xsl:variable
+ name="isLocal"
+ select="substring-before(@classes, ' local')"/>
+ <xsl:variable
+ name="realClassesLocal"
+ select="normalize-space(substring-after(@classes, 'contents'))"/>
+ <xsl:variable
+ name="realClassesNode">
+ <xsl:choose>
+ <xsl:when
+ test="$isLocal">
+ <xsl:value-of
+ select="normalize-space(substring-before($realClassesLocal, 'local'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
+ select="$realClassesLocal"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable
+ name="realClasses"
+ select="string($realClassesNode)"/>
+ <xsl:if
+ test="$isLocal">
+ <xsl:call-template
+ name="u:param">
+ <xsl:with-param
+ name="name"
+ select="'local'"/>
+ <xsl:with-param
+ name="value"
+ select="''"/>
+ <xsl:with-param
+ name="ancestors"
+ select="ancestor-or-self::*"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if
+ test="$realClasses">
+ <xsl:call-template
+ name="u:param">
+ <xsl:with-param
+ name="name"
+ select="'class'"/>
+ <xsl:with-param
+ name="value"
+ select="$realClasses"/>
+ <xsl:with-param
+ name="ancestors"
+ select="ancestor-or-self::*"/>
+ </xsl:call-template>
+ </xsl:if>
+ <!-- Autogenerated content is discarded -->
+ &tCR;
+ </xsl:template>
+
+ <!-- == structural_element == directive -->
+ <xsl:template
+ match="topic[@classes='dedication' or @classes='abstract']">
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>:</xsl:text>
+ <xsl:apply-templates
+ select="title"/>
+ <xsl:text>: </xsl:text>
+ &tEOL;
+ <xsl:apply-templates
+ select="*[not(self::title)]"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (title, (%body.elements;)+)
+ Attributes: The admonition element contains only the common attributes:
+ ids, names, dupnames, source, and classes.
+ -->
+ <!-- == compound_body_element == directive -->
+ <xsl:template
+ match="admonition">
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. admonition:: </xsl:text>
+ <xsl:apply-templates
+ select="title"/>
+ &tEOL;
+ <xsl:call-template
+ name="u:params">
+ <xsl:with-param
+ name="params"
+ select="@*[name() != 'classes' or not(starts-with(., 'admonition-'))]"/>
+ </xsl:call-template>
+ <xsl:call-template
+ name="u:indent"/>
+ <xsl:apply-templates
+ select="*[not(self::title)]"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (%body.elements;)+
+ Attributes: The note element contains only the common attributes: ids,
+ names, dupnames, source, and classes.
+ -->
+ <!-- == compound_body_element == directive -->
+ <xsl:template
+ match="attention | caution | danger | error | hint | important | note | tip | warning">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. </xsl:text>
+ <xsl:value-of
+ select="name()"/>
+ <xsl:text>:: </xsl:text>
+ <xsl:call-template
+ name="u:params">
+ <xsl:with-param
+ name="params"
+ select="@*[name() != 'classes']"/>
+ </xsl:call-template>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (header?, footer?)
+ Attributes: The decoration element contains only the common attributes:
+ ids, names, dupnames, source, and classes.
+
+ Although the content model doesn't specifically require contents, no empty
+ decoration elements are ever created.
+ -->
+ <!-- == structural_subelement -->
+ <xsl:template
+ match="//document/decoration">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- TODO To be rendered as `.. header::` directive -->
+ <!-- == decorative_element -->
+ <xsl:template
+ match="//document/decoration/header">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- TODO To be rendered as `.. footer::` directive -->
+ <!-- == decorative_element -->
+ <xsl:template
+ match="//document/decoration/footer">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (%bibliographic.elements;)+
+ Attributes: The docinfo element contains only the common attributes: ids,
+ names, dupnames, source, and classes.
+ -->
+ <!-- == structural_subelement -->
+ <xsl:template
+ match="docinfo">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:blank"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: ((author, organization?, address?, contact?)+)
+ Attributes: The authors element contains only the common attributes: ids,
+ names, dupnames, source, and classes.
+
+ In reStructuredText, multiple author's names are separated with semicolons
+ (";") or commas (","); semicolons take precedence. There is currently no way
+ to represent the author's organization, address, or contact in a
+ reStructuredText "Authors" field.
+ -->
+ <!-- == bibliographic_element == folding_element -->
+ <xsl:template
+ match="docinfo/authors">
+ <xsl:call-template
+ name="u:outputFolding">
+ <xsl:with-param
+ name="prefix">
+ <xsl:text>:</xsl:text>
+ <xsl:value-of
+ select="name()"/>
+ <xsl:text>: </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!--
+ Content Model: %text.model;
+ Attributes: All docinfo elements contains the common attributes (ids,
+ names, dupnames, source, and classes)
+ Some docinfo elements also have xml:space.
+ -->
+ <xsl:template
+ match="docinfo/authors/*">
+ <xsl:apply-templates/>
+ <!-- no semicolon after final author -->
+ <xsl:if
+ test="generate-id(current()) != generate-id(../*[last()])">
+ <xsl:text>; </xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <!--
+ Content Model: (field_name, field_body)
+ Attributes: The field element contains only the common attributes: ids,
+ names, dupnames, source, and classes.
+ -->
+ <!-- == bibliographic_element -->
+ <xsl:template
+ match="docinfo/field">
+ <!-- contents handled by ordinary field lists -->
+ <xsl:apply-templates/>
+ <!-- Supply an EOL because following elements do not recognize this -->
+ &tEOL;
+ </xsl:template>
+
+ <!--
+ Content Model: %text.model;
+ Attributes: All docinfo elements contains the common attributes (ids,
+ names, dupnames, source, and classes)
+ Some docinfo elements also have xml:space.
+ -->
+ <!-- == bibliographic_element == folding_element -->
+ <xsl:template
+ match="docinfo/*[name()!='authors' and name()!='field']">
+ <xsl:call-template
+ name="u:outputFolding">
+ <xsl:with-param
+ name="prefix">
+ <xsl:text>:</xsl:text>
+ <xsl:value-of
+ select="name()"/>
+ <xsl:text>: </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: EMPTY
+ Attributes: The transition element contains only the common attributes:
+ ids, names, dupnames, source, and classes.
+ -->
+ <!-- == structural_subelement -->
+ <xsl:template
+ match="transition">
+ <xsl:call-template
+ name="u:outputClass"/>
+ &tCR; <!-- req: blank line before -->
+ <xsl:text>-----</xsl:text>
+ &tEOL;
+ <!-- Add a required blank line after unless class follows immediately -->
+ <xsl:if
+ test="not(following-sibling::*[1]/@classes)">
+ &tCR;
+ </xsl:if>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+ <!-- ******************************************************************** -->
+
+ <!--
+ IFF there is a /document/title element, it is the publication's title. All
+ other titles will appear within sections.
+
+ Content Model: %text.model;
+ Attributes: The title element contains the common attributes (ids, names,
+ dupnames, source, and classes), plus refid and auto.
+ refid is used as a backlink to a table of contents entry.
+ auto is used to indicate (with value "1") that the title has been
+ numbered automatically.
+ -->
+ <!-- == structural_subelement -->
+ <xsl:template
+ match="//document/title">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:variable
+ name="textWS">
+ <!-- Catch the title text as it is rendered so its length can be
+ determined -->
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:variable
+ name="text"
+ select="normalize-space($textWS)"/>
+ <xsl:variable
+ name="length"
+ select="string-length($text)"/>
+ <xsl:call-template
+ name="u:overline">
+ <xsl:with-param
+ name="length"
+ select="$length"/>
+ <xsl:with-param
+ name="depth"
+ select="1"/>
+ </xsl:call-template>
+ <xsl:value-of
+ select="$text"/>
+ &tEOL;
+ <xsl:call-template
+ name="u:underline">
+ <xsl:with-param
+ name="length"
+ select="$length"/>
+ <xsl:with-param
+ name="depth"
+ select="1"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Title Underlines are defined by their position within the tree.
+
+ Content Model: %text.model;
+ Attributes: The title element contains the common attributes (ids, names,
+ dupnames, source, and classes), plus refid and auto.
+ refid is used as a backlink to a table of contents entry.
+ auto is used to indicate (with value "1") that the title has been
+ numbered automatically.
+ -->
+ <!-- == structural_subelement -->
+ <xsl:template
+ match="section/title">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:variable
+ name="textWS">
+ <!-- catch the title text as it is rendered -->
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:variable
+ name="text"
+ select="normalize-space($textWS)"/>
+ <xsl:variable
+ name="length"
+ select="string-length($text)"/>
+ <xsl:variable
+ name="depth"
+ select="count(ancestor::section)"/>
+ <xsl:call-template
+ name="u:overline">
+ <xsl:with-param
+ name="length"
+ select="$length"/>
+ <xsl:with-param
+ name="depth"
+ select="$depth + 2"/>
+ </xsl:call-template>
+ <xsl:value-of
+ select="$text"/>
+ &tEOL;
+ <xsl:call-template
+ name="u:underline">
+ <xsl:with-param
+ name="length"
+ select="$length"/>
+ <xsl:with-param
+ name="depth"
+ select="$depth + 2"/>
+ </xsl:call-template>
+ <!-- Add a blank line after unless structure follows immediately -->
+ <xsl:if
+ test="not(contains(concat($structural_elements, $compound_body_elements), concat('*', name(following-sibling::*[1]), '*')) or following-sibling::*[1]/@classes)">
+ &tCR;
+ </xsl:if>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: %text.model;
+ Attributes: The title element contains the common attributes (ids, names,
+ dupnames, source, and classes), plus refid and auto.
+ refid is used as a backlink to a table of contents entry.
+ auto is used to indicate (with value "1") that the title has been
+ numbered automatically.
+ -->
+ <!-- == structural_subelement -->
+ <xsl:template
+ match="title">
+ <xsl:call-template
+ name="u:outputClass">
+ <xsl:with-param
+ name="alreadyBlanked"
+ select="true()"/>
+ </xsl:call-template>
+ <!-- blank line provided by parent -->
+ <xsl:apply-templates/>
+ <!-- no EOL: provided by parent -->
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ IFF there is a /document/title element, it is the publication's title. All
+ other titles will appear within sections.
+
+ Content Model: %text.model;
+ Attributes: The subtitle element contains only the common attributes:
+ ids, names, dupnames, source, and classes.
+ -->
+ <!-- == structural_subelement -->
+ <xsl:template
+ match="//document/subtitle">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:variable
+ name="textWS">
+ <!-- Catch the title text as it is rendered -->
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:variable
+ name="text"
+ select="normalize-space($textWS)"/>
+ <xsl:variable
+ name="length"
+ select="string-length($text)"/>
+
+ <!-- always a blank line above -->
+ &tCR;
+ <xsl:call-template
+ name="u:overline">
+ <xsl:with-param
+ name="length"
+ select="$length"/>
+ <xsl:with-param
+ name="depth"
+ select="2"/>
+ </xsl:call-template>
+ <xsl:value-of
+ select="$text"/>
+ &tEOL;
+ <xsl:call-template
+ name="u:underline">
+ <xsl:with-param
+ name="length"
+ select="$length"/>
+ <xsl:with-param
+ name="depth"
+ select="2"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: %text.model;
+ Attributes: The subtitle element contains only the common attributes: ids,
+ names, dupnames, source, and classes.
+ -->
+ <!-- == structural_subelement -->
+ <xsl:template
+ match="sidebar/subtitle">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:indent"/>
+ <xsl:apply-templates/>
+ &tEOL;
+ &tCR;
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: %text.model;
+ Attributes: The comment element contains only the common attributes: ids,
+ names, dupnames, source, and classes.
+ -->
+ <!-- == simple_body_element == folding_element == directive -->
+ <xsl:template
+ match="comment">
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:call-template
+ name="u:outputFolding">
+ <xsl:with-param
+ name="prefix">
+ <xsl:text>.. </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: %text.model;
+ Attributes: The doctest_block element contains the common attributes (ids,
+ names, dupnames, source, and classes), plus xml:space.
+ -->
+ <!-- == simple_body_element -->
+ <xsl:template
+ match="doctest_block">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:apply-templates/>
+ &tEOL;
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- An image element can have various roles; they are all covered here -->
+ <!-- == simple_body_element == inline_element == directive -->
+ <xsl:template
+ match="image">
+ <xsl:choose>
+ <xsl:when
+ test="contains($inline_containers, concat('*', name(..), '*')) and @alt">
+ <!-- An inline image with an `@alt' - must be a substitution
+ reference -->
+ <xsl:text>|</xsl:text>
+ <!-- Original text is lost - use what we have -->
+ <xsl:value-of
+ select="@alt"/>
+ <xsl:text>|</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- A directive -->
+ <xsl:if
+ test="not(parent::figure)">
+ <xsl:if
+ test="not(parent::substitution_definition)">
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. </xsl:text>
+ </xsl:if>
+ <xsl:text>image:: </xsl:text>
+ </xsl:if>
+ <xsl:value-of
+ select="@uri"/>
+ &tEOL;
+ <xsl:choose>
+ <xsl:when
+ test="parent::figure">
+ <!-- `@classes' is special because it is in the parent -->
+ <xsl:if
+ test="../@classes">
+ <xsl:call-template
+ name="u:param">
+ <xsl:with-param
+ name="name"
+ select="'figclass'"/>
+ <xsl:with-param
+ name="value"
+ select="../@classes"/>
+ <xsl:with-param
+ name="ancestors"
+ select="ancestor::*"/>
+ </xsl:call-template>
+ </xsl:if>
+ <!-- `@align' is special because it is in the parent -->
+ <xsl:if
+ test="../@align">
+ <xsl:call-template
+ name="u:param">
+ <xsl:with-param
+ name="name"
+ select="'align'"/>
+ <xsl:with-param
+ name="value"
+ select="../@align"/>
+ <xsl:with-param
+ name="ancestors"
+ select="ancestor::*"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:call-template
+ name="u:params">
+ <!-- `figure' would add one level of indentation -->
+ <xsl:with-param
+ name="ancestors"
+ select="ancestor::*"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when
+ test="parent::substitution_definition">
+ <xsl:call-template
+ name="u:params">
+ <!-- `@alt' only for the real images -->
+ <xsl:with-param
+ name="params"
+ select="@*[name() != 'alt']"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template
+ name="u:params">
+ <xsl:with-param
+ name="params"
+ select="@*[name() != 'ids' and name() != 'names']"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if
+ test="parent::reference">
+ <!-- A clickable image -->
+ <xsl:call-template
+ name="u:param">
+ <xsl:with-param
+ name="name"
+ select="'target'"/>
+ <xsl:with-param
+ name="value">
+ <xsl:choose>
+ <xsl:when
+ test="../@name">
+ <!-- An internal link -->
+ <xsl:call-template
+ name="u:inlineReference">
+ <xsl:with-param
+ name="text"
+ select="../@refid"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- An external link -->
+ <xsl:value-of
+ select="../@refuri"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param
+ name="ancestors"
+ select="ancestor-or-self::*"/>
+ </xsl:call-template>
+ </xsl:if>
+ <!-- Always blank line after parameter block -->
+ &tCR;
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (line_block | line)+
+ Attributes: The line_block element contains the common attributes (ids,
+ names, dupnames, source, and classes), plus xml:space.
+ -->
+ <!-- == compound_body_element -->
+ <xsl:template
+ match="line_block">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:variable
+ name="isEmbedded"
+ select="name(..) = 'line_block'"/>
+ <xsl:if
+ test="not($isEmbedded)">
+ <xsl:call-template
+ name="u:blank"/>
+ </xsl:if>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: %text.model;
+ Attributes: The line element contains the common attributes (ids,
+ names, dupnames, source, and classes).
+ -->
+ <!-- == simple_body_subelement == folding_element -->
+ <xsl:template
+ match="line">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:variable
+ name="indent">
+ <xsl:call-template
+ name="u:indent"/>
+ </xsl:variable>
+ <xsl:value-of
+ select="$indent"/>
+ <xsl:choose>
+ <xsl:when
+ test="node()">
+ <!-- Only for non-empty lines -->
+ <xsl:variable
+ name="lineBlockIndent">
+ <!-- Very special indendation for nested `line_block's -->
+ <xsl:for-each
+ select="ancestor::line_block[position() > 1]">
+ <xsl:value-of
+ select="str:padding(4)"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:call-template
+ name="u:outputFolding">
+ <xsl:with-param
+ name="prefix">
+ <xsl:text>| </xsl:text>
+ <xsl:value-of
+ select="$lineBlockIndent"/>
+ </xsl:with-param>
+ <xsl:with-param
+ name="indent"
+ select="concat($indent, ' ', $lineBlockIndent)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>|</xsl:text>
+ &tEOL;
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: %text.model;
+ Attributes: The literal_block element contains the common attributes (ids,
+ names, dupnames, source, and classes), plus xml:space.
+ -->
+ <!-- == simple_body_element == directive -->
+ <xsl:template
+ match="literal_block">
+ <xsl:choose>
+ <xsl:when
+ test=".//*[contains($inline_elements, concat('*', name(), '*'))]">
+ <!-- If it contains inline elements this is a parsed-literal -->
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. parsed-literal::</xsl:text>
+ &tEOL;
+ <xsl:call-template
+ name="u:params"/>
+ &tCR;
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template
+ name="u:outputClass"/>
+ <!-- TODO Support for the (fully) minimized style would be nice but
+ is difficult to accomplish because there is a linefeed
+ already when we arrive here :-( -->
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>::</xsl:text>
+ &tEOL;
+ &tCR;
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable
+ name="isQuotedLiteral">
+ <xsl:call-template
+ name="u:isQuotedLiteral"/>
+ </xsl:variable>
+ <!-- Indent correctly depending on quoted literal or not -->
+ <xsl:choose>
+ <xsl:when
+ test="string-length($isQuotedLiteral)">
+ <xsl:call-template
+ name="u:indent">
+ <xsl:with-param
+ name="ancestors"
+ select="ancestor::*"/>
+ </xsl:call-template>
+ <xsl:apply-templates
+ mode="quotedLiteral"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template
+ name="u:indent">
+ <xsl:with-param
+ name="ancestors"
+ select="ancestor-or-self::*"/>
+ </xsl:call-template>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+ &tEOL;
+ </xsl:template>
+
+ <!-- Indent a text of a quoted literal containing line feeds correctly -->
+ <xsl:template
+ match="text()"
+ mode="quotedLiteral">
+ <xsl:call-template
+ name="u:indentLF">
+ <xsl:with-param
+ name="indent">
+ <xsl:call-template
+ name="u:indent">
+ <xsl:with-param
+ name="ancestors"
+ select="ancestor::*[position() > 1]"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- Determine whether `$text' is a quoted literal and return the quote
+ character if so -->
+ <xsl:template
+ name="u:isQuotedLiteral">
+ <xsl:param
+ name="text"
+ select="text()"/>
+ <xsl:param
+ name="quote"
+ select="substring($text, 1, 1)"/>
+ <xsl:if
+ test="contains($adornment_characters, $quote) and substring($text, 1, 1) = $quote">
+ <!-- Given quote is an adornment character and first character is this
+ quote -->
+ <xsl:choose>
+ <xsl:when
+ test="contains($text, '
')">
+ <!-- Test the remaining lines -->
+ <xsl:call-template
+ name="u:isQuotedLiteral">
+ <xsl:with-param
+ name="text"
+ select="substring-after($text, '
')"/>
+ <xsl:with-param
+ name="quote"
+ select="$quote"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- No more lines to test so this is a quoted literal -->
+ <xsl:value-of
+ select="$quote"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: %text.model;
+ Attributes: The paragraph element contains only the common attributes:
+ ids, names, dupnames, source, and classes.
+ -->
+ <!-- == simple_body_element == folding_element -->
+ <xsl:template
+ match="paragraph">
+ <xsl:variable
+ name="previous"
+ select="preceding-sibling::*[1]"/>
+ <!-- Do indent except first element in some compound elements -->
+ <xsl:variable
+ name="needsIndent"
+ select="($previous or not(parent::list_item or parent::field_body or contains($admonitions, concat('*', name(..), '*')))) and name($previous) != 'label'"/>
+ <!-- Blank line in front if following a body element, except first
+ elements in some compound elements -->
+ <xsl:variable
+ name="needsBlank"
+ select="($previous or not(parent::list_item or ../parent::option_list_item or parent::field_body or parent::document or contains($admonitions, concat('*', name(..), '*')))) and (not($previous) or contains($body_elements, concat('*', name($previous), '*')) or name($previous) = 'title' and contains($titled_elements, concat('*', name(..), '*')) or name($previous) = 'docinfo')"/>
+ <xsl:if
+ test="$needsBlank">
+ &tCR;
+ </xsl:if>
+ <xsl:if
+ test="$needsIndent">
+ <xsl:call-template
+ name="u:indent"/>
+ </xsl:if>
+ <xsl:if
+ test="@classes">
+ <!-- This paragraph has a classes attribute - always needs newline and
+ indent -->
+ <xsl:call-template
+ name="u:outputClass">
+ <xsl:with-param
+ name="alreadyBlanked"
+ select="$needsBlank"/>
+ <xsl:with-param
+ name="alreadyIndented"
+ select="$needsIndent"/>
+ </xsl:call-template>
+ <xsl:call-template
+ name="u:BandI"/>
+ </xsl:if>
+ <xsl:call-template
+ name="u:outputFolding"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- == simple_body_element -->
+ <xsl:template
+ match="pending">
+ <xsl:call-template
+ name="u:notSupported"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- == simple_body_element == inline_element == directive -->
+ <xsl:template
+ match="raw">
+ <xsl:choose>
+ <xsl:when
+ test="contains($inline_containers, concat('*', name(..), '*'))">
+ <!-- Used as a custom role -->
+ <!-- TODO `role' directives must be generated for user-defined raw
+ roles. -->
+ <!-- The name of the custom role is not contained in the input -->
+ <xsl:text>:RAW-ROLE:`</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>`</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- A directive -->
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. raw:: </xsl:text>
+ <xsl:value-of
+ select="@format"/>
+ &tEOL;
+ <xsl:call-template
+ name="u:params">
+ <xsl:with-param
+ name="params"
+ select="@*[name() != 'format' and name() != 'classes']"/>
+ </xsl:call-template>
+ &tCR;
+ <xsl:call-template
+ name="u:indent">
+ <xsl:with-param
+ name="ancestors"
+ select="ancestor-or-self::*"/>
+ </xsl:call-template>
+ <xsl:apply-templates/>
+ &tEOL;
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- == simple_body_element == folding_element == directive -->
+ <xsl:template
+ match="rubric">
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:call-template
+ name="u:outputFolding">
+ <xsl:with-param
+ name="prefix">
+ <xsl:text>.. rubric:: </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template
+ name="u:params"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- == compound_body_element == directive -->
+ <xsl:template
+ match="compound">
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. compound::</xsl:text>
+ &tEOL;
+ <xsl:call-template
+ name="u:params"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- == compound_body_element == directive -->
+ <xsl:template
+ match="container">
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. container::</xsl:text>
+ <xsl:if
+ test="@classes">
+ &tSP;
+ <xsl:value-of
+ select="@classes"/>
+ </xsl:if>
+ &tEOL;
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- == simple_body_element == directive -->
+ <xsl:template
+ match="substitution_definition">
+ <!-- More than one child or not a directive is a replacement text -->
+ <xsl:variable
+ name="isReplace"
+ select="not(* and count(node()) = 1 and contains($directives, concat('*', name(*[1]), '*')))"/>
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:variable
+ name="prefix">
+ <xsl:text>.. |</xsl:text>
+ <xsl:call-template
+ name="u:outputNames"/>
+ <xsl:text>| </xsl:text>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when
+ test="$isReplace">
+ <!-- TODO Substitution references for replace can not be found because
+ they are not marked as such; embedding them in `generated'
+ would be nice -->
+ <xsl:call-template
+ name="u:outputFolding">
+ <xsl:with-param
+ name="prefix">
+ <xsl:value-of
+ select="$prefix"/>
+ <xsl:text>replace:: </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
+ select="$prefix"/>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: ((%body.elements;)+, attribution?)
+ Attributes: The block_quote element contains only the common attributes:
+ ids, names, dupnames, source, and classes.
+ -->
+ <!-- == compound_body_element -->
+ <xsl:template
+ match="block_quote">
+ <xsl:if
+ test="@classes = 'epigraph' or @classes = 'highlights' or @classes = 'pull-quote'">
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. </xsl:text>
+ <xsl:value-of
+ select="@classes"/>
+ <xsl:text>::</xsl:text>
+ &tEOL;
+ <xsl:call-template
+ name="u:params"/>
+ </xsl:if>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- == simple_body_subelement == folding_element -->
+ <xsl:template
+ match="attribution">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <!-- blank line between quote and attribution -->
+ &tCR;
+ <xsl:call-template
+ name="u:indent"/>
+ <xsl:call-template
+ name="u:outputFolding">
+ <xsl:with-param
+ name="prefix">
+ <xsl:text>-- </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- == compound_body_element == directive -->
+ <xsl:template
+ match="citation">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. [</xsl:text>
+ <xsl:value-of
+ select="label"/>
+ <xsl:text>] </xsl:text>
+ <xsl:apply-templates
+ select="*[not(self::label)]"/>
+ </xsl:template>
+
+ <!-- == simple_body_subelement -->
+ <xsl:template
+ match="citation/label">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- == compound_body_element == directive -->
+ <xsl:template
+ match="figure">
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. figure:: </xsl:text>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- == simple_body_subelement == folding_element -->
+ <xsl:template
+ match="caption">
+ <xsl:call-template
+ name="u:indent"/>
+ <xsl:call-template
+ name="u:outputFolding"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="legend">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- TODO Footnotes should continue on line of definition -->
+
+ <!-- user-numbered footnotes lack @auto -->
+ <!-- == compound_body_element == directive -->
+ <xsl:template
+ match="footnote[not(@auto)]">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. [</xsl:text>
+ <xsl:apply-templates
+ select="label"/>
+ <xsl:text>] </xsl:text>
+ <xsl:apply-templates
+ select="*[not(self::label)]"/>
+ </xsl:template>
+
+ <!-- autonumbered footnotes have @auto -->
+ <!-- if the target footnote_reference@names matches its label, it was not a
+ numbered-name footnote -->
+ <!-- == compound_body_element == directive -->
+ <xsl:template
+ match="footnote[@auto='1']">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. [#</xsl:text>
+ <xsl:if
+ test="@names = @ids">
+ <xsl:call-template
+ name="u:outputNames"/>
+ </xsl:if>
+ <xsl:text>] </xsl:text>
+ <xsl:apply-templates
+ select="*[not(self::label)]"/>
+ </xsl:template>
+
+ <!-- autosymboled footnotes have @auto -->
+ <!-- == compound_body_element == directive -->
+ <xsl:template
+ match="footnote[@auto='*']">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. [*] </xsl:text>
+ <xsl:apply-templates
+ select="*[not(self::label)]"/>
+ </xsl:template>
+
+ <!-- == compound_body_element == directive -->
+ <xsl:template
+ match="footnote[starts-with(@names, 'TARGET_NOTE:\ ')]">
+ <!-- This is not a footnote but a hint for a directive -->
+ <xsl:if
+ test="generate-id(//footnote[starts-with(@names, 'TARGET_NOTE:\ ')][1]) = generate-id(.)">
+ <!-- Only for the first one -->
+ <xsl:call-template
+ name="u:BandI"/>
+ <!-- TODO May have a `classes` attribute -->
+ <xsl:text>.. target-notes::</xsl:text>
+ &tEOL;
+ </xsl:if>
+ </xsl:template>
+
+ <!-- == simple_body_subelement -->
+ <xsl:template
+ match="footnote/label">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (list_item +)
+ Attributes: The bullet_list element contains the common attributes (ids,
+ names, dupnames, source, and classes), plus bullet.
+ bullet is used to record the style of bullet from the input data.
+ In documents processed from reStructuredText, it contains one of "-",
+ "+", or "*". It may be ignored in processing.
+ -->
+ <!-- == compound_body_element -->
+ <xsl:template
+ match="bullet_list">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:apply-templates
+ mode="bullet_list"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (definition_list_item +)
+ Attributes: The definition_list element contains only the common
+ attributes: ids, names, dupnames, source, and classes.
+ -->
+ <!-- == compound_body_element -->
+ <xsl:template
+ match="definition_list">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (term, classifier?, definition)
+ Attributes: The definition_list_item element contains only the common
+ attributes: ids, names, dupnames, source, and classes.
+ -->
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="definition_list_item">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: %text.model;
+ Attributes: The term element contains only the common attributes: ids,
+ names, dupnames, source, and classes.
+ -->
+ <!-- == simple_body_subelement -->
+ <xsl:template
+ match="term">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: %text.model;
+ Attributes: The classifier element contains only the common attributes:
+ ids, names, dupnames, source, and classes.
+ -->
+ <!-- == simple_body_subelement -->
+ <xsl:template
+ match="classifier">
+ <xsl:text> : </xsl:text>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (%body.elements;)+
+ Attributes: The definition element contains only the common attributes:
+ ids, names, dupnames, source, and classes.
+ -->
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="definition">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (list_item +)
+ Attributes: The enumerated_list element contains the common attributes
+ (ids, names, dupnames, source, and classes), plus enumtype, prefix, suffix, and
+ start.
+ enumtype is used to record the intended enumeration sequence, one
+ of "arabic" (1, 2, 3, ...), "loweralpha" (a, b, c, ..., z), "upperalpha" (A,
+ B, C, ..., Z), "lowerroman" (i, ii, iii, iv, ..., mmmmcmxcix [4999]), or
+ "upperroman" (I, II, III, IV, ..., MMMMCMXCIX [4999]).
+ prefix stores the formatting characters used before the enumerator. In
+ documents originating from reStructuredText data, it will contain either ""
+ (empty string) or "(" (left parenthesis). It may or may not affect
+ processing.
+ suffix stores the formatting characters used after the enumerator. In
+ documents originating from reStructuredText data, it will contain either "."
+ (period) or ")" (right parenthesis). Depending on the capabilities of the
+ output format, this attribute may or may not affect processing.
+ start contains the ordinal value of the first item in the list, in
+ decimal. For lists beginning at value 1 ("1", "a", "A", "i", or "I"), this
+ attribute may be omitted.
+ -->
+ <!-- == compound_body_element -->
+ <xsl:template
+ match="enumerated_list">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:apply-templates
+ mode="enumerated_list"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (field +)
+ Attributes: The field_list element contains only the common attributes:
+ ids, names, dupnames, source, and classes.
+ -->
+ <!-- == compound_body_element -->
+ <xsl:template
+ match="field_list">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (field_name, field_body)
+ Attributes: The field element contains only the common attributes: ids,
+ names, dupnames, source, and classes.
+ -->
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="field">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ********************************************************************** -->
+
+ <!--
+ Content Model: %text.model;
+ Attributes: The field_name element contains only the common attributes:
+ ids, names, dupnames, source, and classes.
+ -->
+ <!-- == simple_body_subelement -->
+ <xsl:template
+ match="field_name">
+ <xsl:text>:</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>: </xsl:text>
+ <!-- no EOL: field_body starts on same line -->
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (%body.elements;)*
+ Attributes: The field_body element contains only the common attributes:
+ ids, names, dupnames, source, and classes.
+ -->
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="field_body">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (option_list_item +)
+ Attributes: The option_list element contains only the common attributes:
+ ids, names, dupnames, source, and classes.
+ -->
+ <!-- == compound_body_element -->
+ <xsl:template
+ match="option_list">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:blank"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (option_group, description)
+ Attributes: The option_list_item element contains only the common
+ attributes: ids, names, dupnames, source, and classes.
+ -->
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="option_list_item">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:indent"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (option_group, description)
+ Attributes: The option_group element contains only the common attributes:
+ ids, names, dupnames, source, and classes.
+ -->
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="option_group">
+ <xsl:apply-templates/>
+ &tEOL;
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (option_string, option_argument *)
+ Attributes: The option element contains only the common attributes: ids,
+ names, dupnames, source, and classes.
+ -->
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="option">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:apply-templates/>
+ <xsl:if
+ test="generate-id(current()) != generate-id(../*[last()])">
+ <!-- No comma after final option -->
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <!-- no EOL: description on same line -->
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (#PCDATA)
+ Attributes: The option_string element contains only the common attributes:
+ ids, names, dupnames, source, and classes.
+ -->
+ <!-- == simple_body_subelement -->
+ <xsl:template
+ match="option_string">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (#PCDATA)
+ Attributes: The option_argument element contains the common attributes
+ (ids, names, dupnames, source, and classes), plus delimiter.
+ delimiter contains the text preceding the option_argument:
+ either the text separating it from the option_string (typically
+ either "=" or " ")
+ or the text between option arguments (typically either "," or " ").
+ -->
+ <!-- == simple_body_subelement -->
+ <xsl:template
+ match="option_argument">
+ <xsl:value-of
+ select="@delimiter"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (%body.elements;)+
+ Attributes: The description element contains only the common attributes:
+ ids, names, dupnames, source, and classes.
+ -->
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="description">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:apply-templates/>
+ &tEOL;
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (%body.elements;)+
+ Attributes: The list_item element contains only the common attributes:
+ ids, names, dupnames, source, and classes
+
+ BULLET LIST
+ bullet is used to record the style of bullet from the input data.
+ In documents processed from reStructuredText, it contains one of "-",
+ "+", or "*". It may be ignored in processing.
+ -->
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="list_item"
+ mode="bullet_list">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:value-of
+ select="../@bullet"/>
+ &tSP; <!-- space after bullet -->
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ ENUMERATED LIST
+ enumtype is used to record the intended enumeration sequence, one of
+ "arabic" (1, 2, 3, ...), "loweralpha" (a, b, c, ..., z), "upperalpha" (A, B,
+ C, ..., Z), "lowerroman" (i, ii, iii, iv, ..., mmmmcmxcix [4999]), or
+ "upperroman" (I, II, III, IV, ..., MMMMCMXCIX [4999]).
+ prefix stores the formatting characters used before the enumerator. In
+ documents originating from reStructuredText data, it will contain either ""
+ (empty string) or "(" (left parenthesis). It may or may not affect
+ processing.
+ suffix stores the formatting characters used after the enumerator. In
+ documents originating from reStructuredText data, it will contain either "."
+ (period) or ")" (right parenthesis). Depending on the capabilities of the
+ output format, this attribute may or may not affect processing.
+ start contains the ordinal value of the first item in the list, in
+ decimal. For lists beginning at value 1 ("1", "a", "A", "i", or "I"), this
+ attribute may be omitted.
+
+ -->
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="list_item"
+ mode="enumerated_list">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:call-template
+ name="u:outputEnumerator"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- Outputs a complete enumerator when called in an
+ enumerated_list/list_item -->
+ <xsl:template
+ name="u:outputEnumerator">
+ <!-- Use parent's numeration attribute -->
+ <xsl:variable
+ name="enumType"
+ select="../@enumtype"/>
+ <!-- Determine starting point -->
+ <xsl:variable
+ name="start">
+ <xsl:choose>
+ <xsl:when
+ test="../@start">
+ <xsl:value-of
+ select="../@start"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
+ select="1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Determine position of this item in its real context -->
+ <xsl:variable
+ name="position">
+ <xsl:variable
+ name="wanted"
+ select="generate-id()"/>
+ <!-- Generate the right current node list -->
+ <xsl:for-each
+ select="../list_item">
+ <xsl:if
+ test="generate-id() = $wanted">
+ <xsl:value-of
+ select="position()"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <!-- Determine encoding of the number for the given numeration -->
+ <xsl:variable
+ name="cur">
+ <xsl:call-template
+ name="u:position2Enumerator">
+ <xsl:with-param
+ name="enumType"
+ select="$enumType"/>
+ <xsl:with-param
+ name="position"
+ select="$position"/>
+ <xsl:with-param
+ name="start"
+ select="$start"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- Determine encoding of the maximum number -->
+ <xsl:variable
+ name="max">
+ <xsl:call-template
+ name="u:position2Enumerator">
+ <xsl:with-param
+ name="enumType"
+ select="$enumType"/>
+ <xsl:with-param
+ name="position"
+ select="count(../list_item)"/>
+ <xsl:with-param
+ name="start"
+ select="$start"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- Output complete enumerator -->
+ <xsl:value-of
+ select="../@prefix"/>
+ <xsl:value-of
+ select="$cur"/>
+ <xsl:value-of
+ select="../@suffix"/>
+ <!-- Output at least one trailing space -->
+ &tSP;
+ <!-- Output more whitespace to align with the maximum enumerator -->
+ <xsl:if
+ test="$enumType != 'lowerroman' and $enumType != 'upperroman'">
+ <!-- Assumes that the maximum number has maximum string length -->
+ <xsl:value-of
+ select="str:padding(string-length($max) - string-length($cur))"/>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Determine the right ordinal enumerator based on the parameters -->
+ <xsl:template
+ name="u:position2Enumerator">
+ <xsl:param
+ name="enumType"/>
+ <xsl:param
+ name="start"/>
+ <xsl:param
+ name="position"/>
+ <!-- Determine logical number -->
+ <xsl:variable
+ name="ordinal"
+ select="$start - 1 + $position"/>
+ <xsl:choose>
+ <xsl:when
+ test="$enumType = 'arabic'">
+ <xsl:value-of
+ select="$ordinal"/>
+ </xsl:when>
+ <xsl:when
+ test="$enumType = 'loweralpha'">
+ <xsl:value-of
+ select="substring('abcdefghijklmnopqrstzuvwxyz', $ordinal, 1)"/>
+ </xsl:when>
+ <xsl:when
+ test="$enumType = 'upperalpha'">
+ <xsl:value-of
+ select="substring('ABCDEFGHIJKLMNOPQRSTZUVWXYZ', $ordinal, 1)"/>
+ </xsl:when>
+ <!-- TODO Support for counting roman numbers -->
+ <xsl:when
+ test="$enumType = 'lowerroman'">
+ <xsl:text>i</xsl:text>
+ </xsl:when>
+ <xsl:when
+ test="$enumType = 'upperroman'">
+ <xsl:text>I</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (title?, tgroup+)
+ Attributes: The table element contains the common attributes and:
+ frame, colsep, rowsep, pgwide
+ -->
+ <!-- == compound_body_element -->
+ <xsl:template
+ match="table">
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:blank"/>
+ <xsl:apply-templates
+ select="tgroup"/>
+ <xsl:if
+ test="title">
+ <!-- TODO A table title must be rendered by using the `.. table::'
+ directive -->
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:apply-templates
+ select="title"/>
+ &tEOL;
+ </xsl:if>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (colspec*, thead?, tbody)
+ Attributes: The tgroup element contains the common attributes and:
+ cols, colsep, rowsep, align
+ -->
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="tgroup">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: EMPTY
+ Attributes: The colspec element contains the common attributes and:
+ colnum, colname, colwidth, colsep, rowsep, align, char, charoff
+
+ The colwidth attribute gives the width of the respective column in characters
+ including padding whitespace but no separator markup.
+ -->
+ <!-- == simple_body_subelement -->
+ <!-- @colwidth needed by children but element has no own output -->
+ <xsl:template
+ match="colspec"/>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (row+)
+ Attributes: The thead element contains the common attributes and:
+ valign
+ -->
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="thead">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!--
+ Content Model: (row+)
+ Attributes: The tbody element contains the common attributes and:
+ valign
+ -->
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="tbody">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (entry+)
+ Attributes: The row element contains the common attributes and:
+ rowsep, valign
+ -->
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="row">
+ <!-- Separator line above unless first row of a tbody with no previous
+ thead (in this case the separator line is output already as the
+ closing separator line of thead) -->
+ <xsl:if
+ test="position() > 1 or parent::thead or parent::tbody and not(../../thead)">
+ <xsl:call-template
+ name="u:rowSeparatorLine"/>
+ </xsl:if>
+ <!-- Determine heights in physical lines of all entries -->
+ <xsl:variable
+ name="heights">
+ <xsl:for-each
+ select="entry">
+ <xsl:variable
+ name="text">
+ <!-- Catch the text of all entries -->
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <!-- Compute height of this entry; leading and trailing EOL must be
+ subtracted -->
+ <xsl:value-of
+ select="string-length($text) - string-length(translate($text, '
', '')) - 1"/>
+ &tSP; <!-- A space as a list separator -->
+ </xsl:for-each>
+ </xsl:variable>
+ <!-- Determine maximum height so every entry must be this high -->
+ <xsl:variable
+ name="maxHeight"
+ select="math:max(str:tokenize(normalize-space($heights)))"/>
+ <!-- Output all the physical lines of this row -->
+ <xsl:call-template
+ name="u:rowLines">
+ <xsl:with-param
+ name="currentLine"
+ select="1"/>
+ <xsl:with-param
+ name="maxLine"
+ select="$maxHeight"/>
+ </xsl:call-template>
+ <!-- Output final separator line if this is the last row -->
+ <xsl:if
+ test="position() = last()">
+ <xsl:call-template
+ name="u:rowSeparatorLine">
+ <xsl:with-param
+ name="char">
+ <!-- Determine correct character for the separator line -->
+ <xsl:choose>
+ <xsl:when
+ test="parent::thead">
+ <xsl:value-of
+ select="'='"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
+ select="'-'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Output physical line $currentLine of a row and continue until
+ line $maxLine is output -->
+ <xsl:template
+ name="u:rowLines">
+ <xsl:param
+ name="currentLine"/>
+ <xsl:param
+ name="maxLine"/>
+ <xsl:if
+ test="$currentLine <= $maxLine">
+ <!-- If there are still physical lines to output do it -->
+ <xsl:call-template
+ name="u:indent"/>
+ <!-- Leading bar -->
+ <xsl:text>|</xsl:text>
+ <xsl:apply-templates>
+ <xsl:with-param
+ name="currentLine"
+ select="$currentLine"/>
+ </xsl:apply-templates>
+ <!-- End of this physical line -->
+ &tEOL;
+ <!-- Continue with the next physical line -->
+ <xsl:call-template
+ name="u:rowLines">
+ <xsl:with-param
+ name="currentLine"
+ select="$currentLine + 1"/>
+ <xsl:with-param
+ name="maxLine"
+ select="$maxLine"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Output a separator line with all the right characters -->
+ <xsl:template
+ name="u:rowSeparatorLine">
+ <xsl:param
+ name="char"
+ select="'-'"/>
+ <xsl:call-template
+ name="u:indent"/>
+ <xsl:text>+</xsl:text>
+ <xsl:for-each
+ select="../../colspec">
+ <xsl:value-of
+ select="str:padding(@colwidth, $char)"/>
+ <xsl:text>+</xsl:text>
+ </xsl:for-each>
+ &tEOL;
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: (%body.elements;)*
+ Attributes: The entry element contains the common attributes and:
+ colname, namest, morerows, colsep, rowsep, align, char, charoff, valign and
+ morecols
+ -->
+ <!-- == compound_body_subelement -->
+ <xsl:template
+ match="entry">
+ <!-- TODO `classes` attribute needs support -->
+ <!-- This is called in two ways; if $currentLine = 0 all physical lines
+ of this entry must be output; if $currentLine > 0 the physical line
+ with exactly this number shall be output -->
+ <xsl:param
+ name="currentLine"
+ select="0"/>
+ <xsl:variable
+ name="column"
+ select="position() + sum(preceding-sibling::entry/@morecols)"/>
+ <!-- Determine width in characters needed for this entry -->
+ <xsl:variable
+ name="width">
+ <xsl:call-template
+ name="u:computeEntryWidth">
+ <xsl:with-param
+ name="colspecs"
+ select="../../../colspec"/>
+ <xsl:with-param
+ name="column"
+ select="$column"/>
+ <xsl:with-param
+ name="span"
+ select="@morecols"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- Output the entry completely or a certain physical line -->
+ <xsl:call-template
+ name="u:outputEntry">
+ <xsl:with-param
+ name="string">
+ <!-- Capture physical lines of the entry in a variable -->
+ <xsl:apply-templates/>
+ </xsl:with-param>
+ <xsl:with-param
+ name="width"
+ select="$width"/>
+ <xsl:with-param
+ name="expectedIndent">
+ <!-- Capture indent for the entry generated by the normal template
+ rules to remove it later -->
+ <xsl:call-template
+ name="u:indent"/>
+ </xsl:with-param>
+ <xsl:with-param
+ name="outputLine"
+ select="$currentLine"/>
+ </xsl:call-template>
+ <!-- Final bar after the entry -->
+ <xsl:text>|</xsl:text>
+ </xsl:template>
+
+ <!-- Compute width of the entry -->
+ <xsl:template
+ name="u:computeEntryWidth">
+ <!-- The colspec elements of all columns -->
+ <xsl:param
+ name="colspecs"/>
+ <!-- Column of this entry -->
+ <xsl:param
+ name="column"/>
+ <!-- Number of columns this entry spans -->
+ <xsl:param
+ name="span"
+ select="0"/>
+ <xsl:param
+ name="sum"
+ select="0"/>
+ <xsl:choose>
+ <xsl:when
+ test="$span">
+ <!-- If entry spans multiple columns compute their width -->
+ <xsl:call-template
+ name="u:computeEntryWidth">
+ <xsl:with-param
+ name="colspecs"
+ select="$colspecs"/>
+ <xsl:with-param
+ name="column"
+ select="$column + 1"/>
+ <xsl:with-param
+ name="span"
+ select="$span - 1"/>
+ <!-- Add the separator character and the following column width -->
+ <xsl:with-param
+ name="sum"
+ select="$sum + 1 + $colspecs[$column]/@colwidth"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Does not span more columns so return sum and width of this
+ column -->
+ <xsl:value-of
+ select="$sum + $colspecs[$column]/@colwidth"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Outputs one or all lines of a table entry as a string trimmed left and
+ padded -->
+ <xsl:template
+ name="u:outputEntry">
+ <!-- Width of the entry; there is no provision for actual physical lines
+ longer than this width -->
+ <xsl:param
+ name="width"/>
+ <!-- The string containing the remaining physical lines; may be an empty
+ string -->
+ <xsl:param
+ name="string"
+ select="''"/>
+ <!-- The indendation which is expected to be prefixed before every
+ physical line -->
+ <xsl:param
+ name="expectedIndent"
+ select="''"/>
+ <!-- Is this the first call to this template -->
+ <xsl:param
+ name="isFirst"
+ select="true()"/>
+ <!-- Number of physical line to output or 0 to output all lines -->
+ <xsl:param
+ name="outputLine"
+ select="0"/>
+ <!-- Output is wanted if all or the first physical line are to be
+ output -->
+ <xsl:variable
+ name="doOutput"
+ select="$outputLine = 0 or $outputLine = 1"/>
+ <xsl:variable
+ name="stringLFHalfTrimmed">
+ <xsl:choose>
+ <xsl:when
+ test="$isFirst and substring($string, 1, 1) = '
'">
+ <!-- Remove leading linefeed if this is the first time -->
+ <xsl:value-of
+ select="substring($string, 2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
+ select="$string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable
+ name="stringLFTrimmed">
+ <xsl:choose>
+ <xsl:when
+ test="$isFirst and substring($stringLFHalfTrimmed, string-length($stringLFHalfTrimmed), 1) = '
'">
+ <!-- Remove trailing linefeed if this is the first time -->
+ <xsl:value-of
+ select="substring($stringLFHalfTrimmed, 1, string-length($stringLFHalfTrimmed) - 1)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
+ select="$stringLFHalfTrimmed"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Determine remaining lines after the first one -->
+ <xsl:variable
+ name="remainingLines">
+ <xsl:if
+ test="contains($stringLFTrimmed, '
')">
+ <xsl:value-of
+ select="substring-after($stringLFTrimmed, '
')"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:if
+ test="$doOutput">
+ <!-- If this physical line must be output determine the first physical
+ line -->
+ <xsl:variable
+ name="firstLine">
+ <xsl:choose>
+ <xsl:when
+ test="string-length($remainingLines)">
+ <xsl:value-of
+ select="substring-before($stringLFTrimmed, '
')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
+ select="$stringLFTrimmed"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Remove the leading indentation from the physical line which is
+ brought there by the normal templates -->
+ <xsl:variable
+ name="trimmed">
+ <xsl:if
+ test="string-length($firstLine)">
+ <!-- Trim only non-empty lines -->
+ <xsl:value-of
+ select="substring-after($firstLine, $expectedIndent)"/>
+ </xsl:if>
+ </xsl:variable>
+ <!-- Pad the line with a leading and a trailing space -->
+ <xsl:variable
+ name="padded"
+ select="concat(' ', $trimmed, ' ')"/>
+ <!-- Output the padded value -->
+ <xsl:value-of
+ select="$padded"/>
+ <!-- Fill up the width of the entry with spaces -->
+ <xsl:if
+ test="$width - string-length($padded) < 0">
+ <xsl:message>
+ <xsl:text>WARNING: Table column too narrow (minimum: </xsl:text>
+ <xsl:value-of
+ select="string-length($padded)"/>
+ <xsl:text>)</xsl:text>
+ &tEOL;
+ </xsl:message>
+ </xsl:if>
+ <xsl:value-of
+ select="str:padding($width - string-length($padded))"/>
+ </xsl:if>
+ <xsl:if
+ test="$outputLine > 1 or $outputLine = 0 and string-length($remainingLines)">
+ <!-- If a following physical line must be output or if all physical
+ lines shall be output and there are remaining physical lines -->
+ <xsl:if
+ test="$outputLine = 0">
+ <!-- Output linefeed only if we output all the lines -->
+ &tEOL;
+ </xsl:if>
+ <!-- Output the remaining lines -->
+ <xsl:call-template
+ name="u:outputEntry">
+ <xsl:with-param
+ name="width"
+ select="$width"/>
+ <xsl:with-param
+ name="string"
+ select="$remainingLines"/>
+ <xsl:with-param
+ name="expectedIndent"
+ select="$expectedIndent"/>
+ <xsl:with-param
+ name="isFirst"
+ select="false()"/>
+ <xsl:with-param
+ name="outputLine">
+ <xsl:choose>
+ <xsl:when
+ test="$outputLine = 0">
+ <xsl:value-of
+ select="0"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
+ select="$outputLine - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+ <!-- ******************************************************************** -->
+
+ <!-- == inline_element -->
+ <xsl:template
+ match="citation_reference">
+ <xsl:call-template
+ name="u:bkslshEscPre"/>
+ <xsl:text>[</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>]_</xsl:text>
+ <xsl:call-template
+ name="u:bkslshEscSuf"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- == inline_element -->
+ <xsl:template
+ match="emphasis">
+ <xsl:call-template
+ name="u:bkslshEscPre"/>
+ <xsl:text>*</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>*</xsl:text>
+ <xsl:call-template
+ name="u:bkslshEscSuf"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- user-numbered footnotes lack @auto -->
+ <!-- == inline_element -->
+ <xsl:template
+ match="footnote_reference[not(@auto)]">
+ <xsl:call-template
+ name="u:bkslshEscPre"/>
+ <xsl:text>[</xsl:text>
+ <xsl:value-of
+ select="text()"/>
+ <xsl:text>]_</xsl:text>
+ <xsl:call-template
+ name="u:bkslshEscSuf"/>
+ <!-- child paragraph provides blank line -->
+ </xsl:template>
+
+ <!-- automatically numbered footnotes have @auto -->
+ <!-- if @names is different from label content, it is a named footnote -->
+ <!-- == inline_element -->
+ <xsl:template
+ match="footnote_reference[@auto='1']">
+ <xsl:variable
+ name="ref"
+ select="@refid"/>
+ <xsl:if
+ test="not(starts-with(//footnote[@ids=$ref]/@names, 'TARGET_NOTE:\ '))">
+ <!-- Not a generated footnote reference for a `.. target-notes::';
+ such footnote reference and the preceding space should be
+ embedded in `generated'! -->
+ <xsl:call-template
+ name="u:bkslshEscPre"/>
+ <xsl:text>[#</xsl:text>
+ <xsl:if
+ test="//footnote[@ids=$ref]/@names != //footnote[@ids=$ref]/label">
+ <xsl:call-template
+ name="u:outputNames">
+ <xsl:with-param
+ name="names"
+ select="//footnote[@ids=$ref]/@names"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:text>]_</xsl:text>
+ <xsl:call-template
+ name="u:bkslshEscSuf"/>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- automatically symboled footnotes have @auto=* -->
+ <!-- == inline_element -->
+ <xsl:template
+ match="footnote_reference[@auto='*']">
+ <xsl:call-template
+ name="u:bkslshEscPre"/>
+ <xsl:text>[*]_</xsl:text>
+ <xsl:call-template
+ name="u:bkslshEscSuf"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: %text.model;
+ -->
+ <!-- == inline_element -->
+ <xsl:template
+ match="literal">
+ <xsl:call-template
+ name="u:bkslshEscPre"/>
+ <xsl:text>``</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>``</xsl:text>
+ <xsl:call-template
+ name="u:bkslshEscSuf"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- Attribute combinations found in `standard' text and other examples:
+ @refuri = standalone hyperlink
+ @ids @refid = TOC, probably all in <generated>
+ @name @refuri with matching <target> in document = named external hyperlink _
+ @name @refuri immediately followed by matching <target> = named embedded URI _
+ @name @refuri with no matching <target> in document = anonymous embedded URI __
+ @anonymous @name @refuri with no matching <target> in document = anonymous explicit URI __
+ @name @refid = internal cross-reference _
+ @anonymous @name @refid = anonymous implicit internal reference __
+ @name @refid image = clickable image to internal reference _
+ @refuri image = clickable image to standalone hyperlink
+
+ A target matches if target/@names contains the lower cased, whitespace
+ quoted reference/@name
+ -->
+
+ <!-- Standalone hyperlink -->
+ <!-- == inline_element -->
+ <xsl:template
+ match="reference[not(@name or @anonymous)]">
+ <xsl:call-template
+ name="u:bkslshEscPre"/>
+ <xsl:choose>
+ <xsl:when
+ test="starts-with(., 'PEP ')">
+ <xsl:text>:PEP:`</xsl:text>
+ <xsl:value-of
+ select="substring-after(., 'PEP ')"/>
+ <xsl:text>`</xsl:text>
+ </xsl:when>
+ <xsl:when
+ test="starts-with(., 'RFC ')">
+ <xsl:text>:RFC:`</xsl:text>
+ <xsl:value-of
+ select="substring-after(., 'RFC ')"/>
+ <xsl:text>`</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template
+ name="u:bkslshEscSuf"/>
+ </xsl:template>
+
+ <!-- External references -->
+ <!-- == inline_element -->
+ <xsl:template
+ match="reference[@name and @refuri]">
+ <!-- Determine normalized name by downcasing it -->
+ <xsl:variable
+ name="normalized"
+ select="translate(normalize-space(@name), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
+ <xsl:variable
+ name="quoted"
+ select="str:replace($normalized, ' ', '\ ')"/>
+ <xsl:variable
+ name="matching"
+ select="//target[contains(@names, $quoted)]"/>
+ <xsl:call-template
+ name="u:inlineReference">
+ <xsl:with-param
+ name="anonymous"
+ select="not($matching) or @anonymous"/>
+ <xsl:with-param
+ name="embedded"
+ select="not(@anonymous) and (not($matching) or generate-id(following-sibling::node()[1]) = generate-id($matching))"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- Internal references -->
+ <!-- == inline_element -->
+ <xsl:template
+ match="reference[@name and @refid]">
+ <xsl:call-template
+ name="u:inlineReference">
+ <xsl:with-param
+ name="anonymous"
+ select="@anonymous"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- Image references -->
+ <!-- == inline_element -->
+ <xsl:template
+ match="reference[image]">
+ <!-- All done by the `image' tag -->
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: %text.model;
+ -->
+ <!-- == inline_element -->
+ <xsl:template
+ match="strong">
+ <xsl:call-template
+ name="u:bkslshEscPre"/>
+ <xsl:text>**</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>**</xsl:text>
+ <xsl:call-template
+ name="u:bkslshEscSuf"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- == inline_element -->
+ <xsl:template
+ match="subscript">
+ <xsl:call-template
+ name="u:bkslshEscPre"/>
+ <xsl:text>:sub:`</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>`</xsl:text>
+ <xsl:call-template
+ name="u:bkslshEscSuf"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- == inline_element -->
+ <xsl:template
+ match="superscript">
+ <xsl:call-template
+ name="u:bkslshEscPre"/>
+ <xsl:text>:sup:`</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>`</xsl:text>
+ <xsl:call-template
+ name="u:bkslshEscSuf"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- The target element has various roles depending on context; they are
+ all handled here -->
+ <!-- == simple_body_element == inline_element == directive -->
+ <xsl:template
+ match="target">
+ <xsl:choose>
+ <xsl:when
+ test="name(preceding-sibling::*[1]) = 'reference'">
+ <!-- An embedded inline target - handled by the reference itself -->
+ </xsl:when>
+ <xsl:when
+ test="contains($inline_containers, concat('*', name(..), '*'))">
+ <!-- An inline target of some sort -->
+ <xsl:call-template
+ name="u:inlineReference">
+ <xsl:with-param
+ name="isTarget"
+ select="true()"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when
+ test="@anonymous">
+ <!-- An anonymous target directive -->
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>__ </xsl:text>
+ <xsl:choose>
+ <xsl:when
+ test="@refid">
+ <xsl:call-template
+ name="u:outputNamesRefid"/>
+ <xsl:text>_</xsl:text>
+ </xsl:when>
+ <xsl:when
+ test="@refuri">
+ <xsl:value-of
+ select="@refuri"/>
+ </xsl:when>
+ </xsl:choose>
+ &tEOL;
+ </xsl:when>
+ <xsl:when
+ test="@names | @refid">
+ <!-- A target directive -->
+ <xsl:call-template
+ name="u:outputClass"/>
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>.. _</xsl:text>
+ <xsl:choose>
+ <xsl:when
+ test="@refid">
+ <xsl:call-template
+ name="u:outputNamesRefid"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable
+ name="quoteNeeded"
+ select="contains(@names, ':')"/>
+ <xsl:if
+ test="$quoteNeeded">
+ <xsl:text>`</xsl:text>
+ </xsl:if>
+ <xsl:call-template
+ name="u:outputNames"/>
+ <xsl:if
+ test="$quoteNeeded">
+ <xsl:text>`</xsl:text>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>:</xsl:text>
+ <xsl:if
+ test="@refuri">
+ <xsl:text> </xsl:text>
+ <xsl:value-of
+ select="@refuri"/>
+ </xsl:if>
+ &tEOL;
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Should not happen -->
+ <xsl:call-template
+ name="u:notSupported"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: %text.model;
+ -->
+ <!-- == inline_element -->
+ <xsl:template
+ match="title_reference">
+ <xsl:call-template
+ name="u:bkslshEscPre"/>
+ <xsl:text>`</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>`</xsl:text>
+ <xsl:call-template
+ name="u:bkslshEscSuf"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Content Model: %text.model;
+ -->
+ <!-- == inline_element -->
+ <xsl:template
+ match="inline">
+ <!-- TODO `role' directives must be generated for plain and derived
+ user-defined roles. -->
+ <xsl:call-template
+ name="u:bkslshEscPre"/>
+ <xsl:text>:</xsl:text>
+ <xsl:value-of
+ select="@classes"/>
+ <xsl:text>:`</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>`</xsl:text>
+ <xsl:call-template
+ name="u:bkslshEscSuf"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- TODO `meta` directive must be implemented. -->
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Docutils wraps generated elements around text that is inserted (generated) by
+ Docutils; i.e., text that was not in the document, like section numbers
+ inserted by the "sectnum" directive.
+ -->
+ <!-- == inline_element -->
+ <xsl:template
+ match="generated"/>
+
+ <!-- == inline_element -->
+ <xsl:template
+ match="problematic">
+ <!-- Simply output the contained text because this is probably the
+ original text-->
+ <xsl:value-of
+ select="text()"/>
+ </xsl:template>
+
+ <!-- == compound_body_element -->
+ <xsl:template
+ match="system_message"/>
+
+ <!-- ******************************************************************** -->
+ <!-- ******************************************************************** -->
+
+ <!--
+ When a block of text contains linefeeds, it was indented relative to a marker
+ on the first line
+ -->
+ <xsl:template
+ match="text()">
+ <xsl:call-template
+ name="u:indentLF"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+ <!-- ******************************************************************** -->
+
+ <!-- Add a blank line if necessary and indent -->
+ <xsl:template
+ name="u:BandI">
+ <xsl:call-template
+ name="u:blank"/>
+ <xsl:call-template
+ name="u:indent"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- Add a blank line in certain contexts -->
+ <xsl:template
+ name="u:blank">
+ <xsl:apply-templates
+ mode="blankSkipInline"
+ select="preceding::*[1]"/>
+ </xsl:template>
+
+ <!-- Find the preceding element we are really interested in and act
+ according to this element -->
+ <xsl:template
+ mode="blankSkipInline"
+ match="*">
+ <xsl:choose>
+ <!-- Skip all inline elements and body subelements and check their
+ parents -->
+ <xsl:when
+ test="contains(concat($inline_elements, $simple_body_subelements, $compound_body_subelements), concat('*', name(.), '*'))">
+ <xsl:apply-templates
+ mode="blankSkipInline"
+ select=".."/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Reached the type of element we decide on -->
+ <xsl:if
+ test="contains($blank_after, concat('*', name(.), '*'))">
+ &tCR;
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!--
+ Indent a block if it's a child of...
+ -->
+ <data:lookup>
+ <node
+ name="address"
+ indent="10"/>
+ <node
+ name="author"
+ indent="9"/>
+ <node
+ name="authors"
+ indent="10"/>
+ <node
+ name="contact"
+ indent="10"/>
+ <node
+ name="copyright"
+ indent="12"/>
+ <node
+ name="date"
+ indent="7"/>
+ <node
+ name="organization"
+ indent="15"/>
+ <node
+ name="revision"
+ indent="11"/>
+ <node
+ name="status"
+ indent="9"/>
+ <node
+ name="version"
+ indent="10"/>
+ <!-- This is only for `bullet_list/list_item';
+ `enumerated_list/list_item' is handled special -->
+ <node
+ name="list_item"
+ indent="2"/>
+ <node
+ name="definition_list_item"
+ indent="4"/>
+ <node
+ name="field_body"
+ indent="4"/>
+ <node
+ name="option_list_item"
+ indent="4"/>
+ <!-- This is also the indentation if block_quote comes as one of the
+ special directives -->
+ <node
+ name="block_quote"
+ indent="4"/>
+ <node
+ name="literal_block"
+ indent="4"/>
+ <node
+ name="attribution"
+ indent="3"/>
+ <node
+ name="line"
+ indent="2"/>
+ </data:lookup>
+
+ <!-- Do indent according to ancestor -->
+ <xsl:template
+ name="u:indent">
+ <!-- In some cases the ancestors to indent for need to be determined
+ by the calling template -->
+ <xsl:param
+ name="ancestors"
+ select="ancestor::*"/>
+ <xsl:for-each
+ select="$ancestors">
+ <xsl:variable
+ name="this"
+ select="name()"/>
+ <xsl:choose>
+ <xsl:when
+ test="contains($directives, concat('*', $this, '*'))">
+ <!-- TODO Indentation of lines after some directives must be
+ indented to align with the directive instead of a
+ fixed indentation; however, this is rather complicated
+ since identation for parameters should be fixed -->
+ <xsl:value-of
+ select="str:padding(3)"/>
+ </xsl:when>
+ <xsl:when
+ test="$this = 'list_item' and parent::enumerated_list">
+ <!-- Enumerated list items base their indentation on the
+ numeration -->
+ <xsl:variable
+ name="enumerator">
+ <xsl:call-template
+ name="u:outputEnumerator"/>
+ </xsl:variable>
+ <xsl:value-of
+ select="str:padding(string-length($enumerator))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
+ select="str:padding(document('')//data:lookup/node[@name=$this]/@indent)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- Indent a text containing line feeds correctly -->
+ <xsl:template
+ name="u:indentLF">
+ <xsl:param
+ name="string"
+ select="."/>
+ <!-- A fixed indentation may be given by caller -->
+ <xsl:param
+ name="indent">
+ <!-- If not given compute it -->
+ <xsl:call-template
+ name="u:indent"/>
+ </xsl:param>
+ <xsl:choose>
+ <xsl:when
+ test="contains($string,'
')">
+ <!-- Output first physical line -->
+ <xsl:value-of
+ select="substring-before($string, '
')"/>
+ &tEOL;
+ <!-- Indent before the next line -->
+ <xsl:value-of
+ select="$indent"/>
+ <!-- Output remaining physical lines -->
+ <xsl:call-template
+ name="u:indentLF">
+ <xsl:with-param
+ name="string"
+ select="substring-after($string, '
')"/>
+ <xsl:with-param
+ name="indent"
+ select="$indent"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- String does not contain newline, so just output it -->
+ <xsl:otherwise>
+ <xsl:value-of
+ select="$string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- Do output for those elements which do fold their inline content -->
+ <xsl:template
+ name="u:outputFolding">
+ <!-- The prefix text to be output before the body -->
+ <xsl:param
+ name="prefix"
+ select="''"/>
+ <!-- The indentation for this body -->
+ <xsl:param
+ name="indent">
+ <xsl:call-template
+ name="u:indent">
+ <xsl:with-param
+ name="ancestors"
+ select="ancestor-or-self::*"/>
+ </xsl:call-template>
+ </xsl:param>
+ <xsl:variable
+ name="string">
+ <!-- TODO Whitespace count of inline literals must be preserved -->
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <!-- Always output prefix with all trailing and leading spaces -->
+ <xsl:value-of
+ select="$prefix"/>
+ <xsl:choose>
+ <xsl:when
+ test="$fold > 0">
+ <xsl:variable
+ name="normalized"
+ select="normalize-space($string)"/>
+ <xsl:choose>
+ <xsl:when
+ test="$string = ''">
+ <!-- Empty strings need no output -->
+ </xsl:when>
+ <xsl:when
+ test="$normalized = ''">
+ <!-- Only white-space in string; output a single space here -->
+ &tSP;
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Output leading white-space here -->
+ <xsl:if
+ test="normalize-space(substring($string, 1, 1)) = ''">
+ &tSP;
+ </xsl:if>
+ <xsl:call-template
+ name="u:indentFold">
+ <xsl:with-param
+ name="string"
+ select="$normalized"/>
+ <xsl:with-param
+ name="indent"
+ select="$indent"/>
+ <xsl:with-param
+ name="cursorColumn"
+ select="string-length($indent) + string-length($prefix)"/>
+ </xsl:call-template>
+ <!-- Output trailing white-space here -->
+ <xsl:if
+ test="normalize-space(substring($string, string-length($string), 1)) = ''">
+ &tSP;
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
+ select="$string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ &tEOL;
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- Indent a string with folding -->
+ <xsl:template
+ name="u:indentFold">
+ <!-- Normalized string to output -->
+ <xsl:param
+ name="string"/>
+ <!-- Indentation to use for a new line -->
+ <xsl:param
+ name="indent"/>
+ <!-- Current output column -->
+ <!-- TODO This is not a correct assumption for field definitions where
+ the field name effectively determines the column of the first
+ line -->
+ <xsl:param
+ name="cursorColumn"
+ select="string-length($indent)"/>
+ <!-- Do we start on a new (indented) line? -->
+ <xsl:param
+ name="isNewLine"
+ select="true()"/>
+ <xsl:variable
+ name="firstWord">
+ <xsl:choose>
+ <!-- TODO Quoted spaces must not end a word -->
+ <xsl:when
+ test="contains($string, ' ')">
+ <xsl:value-of
+ select="substring-before($string, ' ')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
+ select="$string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable
+ name="rest"
+ select="substring-after($string, ' ')"/>
+ <xsl:choose>
+ <xsl:when
+ test="$string = ''"/>
+ <xsl:when
+ test="$isNewLine">
+ <!-- Output at least first word -->
+ <xsl:value-of
+ select="$firstWord"/>
+ <xsl:call-template
+ name="u:indentFold">
+ <xsl:with-param
+ name="string"
+ select="$rest"/>
+ <xsl:with-param
+ name="indent"
+ select="$indent"/>
+ <xsl:with-param
+ name="cursorColumn"
+ select="$cursorColumn + string-length($firstWord)"/>
+ <xsl:with-param
+ name="isNewLine"
+ select="false()"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when
+ test="$cursorColumn + 1 + string-length($firstWord) > $fold">
+ <!-- Line would get too long; start new line, indent and continue -->
+ &tEOL;
+ <xsl:value-of
+ select="$indent"/>
+ <xsl:call-template
+ name="u:indentFold">
+ <xsl:with-param
+ name="string"
+ select="$string"/>
+ <xsl:with-param
+ name="indent"
+ select="$indent"/>
+ <xsl:with-param
+ name="cursorColumn"
+ select="string-length($indent)"/>
+ <xsl:with-param
+ name="isNewLine"
+ select="true()"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- In a line and first word fits; separate and add word -->
+ &tSP;
+ <xsl:value-of
+ select="$firstWord"/>
+ <xsl:call-template
+ name="u:indentFold">
+ <xsl:with-param
+ name="string"
+ select="$rest"/>
+ <xsl:with-param
+ name="indent"
+ select="$indent"/>
+ <xsl:with-param
+ name="cursorColumn"
+ select="$cursorColumn + 1 + string-length($firstWord)"/>
+ <xsl:with-param
+ name="isNewLine"
+ select="false()"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- Output attributes of the current element as a field list -->
+ <xsl:template
+ name="u:params">
+ <xsl:param
+ name="params"
+ select="@*"/>
+ <!-- Ancestors are needed for determining indentation; caller may give
+ them -->
+ <xsl:param
+ name="ancestors"
+ select="ancestor-or-self::*"/>
+ <xsl:for-each
+ select="$params">
+ <!-- Skip URIs based on parent -->
+ <xsl:if
+ test="name() != 'uri' and name() != 'xml:space'">
+ <xsl:call-template
+ name="u:param">
+ <xsl:with-param
+ name="ancestors"
+ select="$ancestors"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+
+ <!-- Output one attribute of the current element as a field list -->
+ <xsl:template
+ name="u:param">
+ <xsl:param
+ name="name"
+ select="name()"/>
+ <xsl:param
+ name="value"
+ select="."/>
+ <!-- Ancestors are needed for determining indentation; caller may give
+ them -->
+ <xsl:param
+ name="ancestors"
+ select="ancestor::*"/>
+ <xsl:call-template
+ name="u:indent">
+ <xsl:with-param
+ name="ancestors"
+ select="$ancestors"/>
+ </xsl:call-template>
+ <xsl:text>:</xsl:text>
+ <xsl:choose>
+ <xsl:when
+ test="$name = 'classes'">
+ <xsl:text>class</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
+ select="$name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>:</xsl:text>
+ <xsl:if
+ test="$value">
+ <xsl:text> </xsl:text>
+ <xsl:value-of
+ select="$value"/>
+ </xsl:if>
+ &tEOL;
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- Output `\' or `\ ' before some inline element if necessary -->
+ <xsl:template
+ name="u:bkslshEscPre">
+ <!-- Get the sibling node directly before the current element -->
+ <xsl:variable
+ name="before"
+ select="preceding-sibling::node()[1]"/>
+ <xsl:choose>
+ <!-- No sibling before this node -->
+ <xsl:when
+ test="not($before)"/>
+ <!-- Element directly before this - must be another inline element -->
+ <xsl:when
+ test="name($before)">
+ <!-- So separate it by a quoted space -->
+ <xsl:text>\ </xsl:text>
+ </xsl:when>
+ <!-- Node directly before this is text - check it -->
+ <xsl:when
+ test="not(contains(concat($apos, ' 
	
"([{<-/:'), substring($before, string-length($before), 1)))">
+ <!-- Does not end in one of the allowed characters so separate it -->
+ <xsl:text>\ </xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Output `\' after some inline element if necessary -->
+ <xsl:template
+ name="u:bkslshEscSuf">
+ <!-- Get the sibling node directly after the current element -->
+ <xsl:variable
+ name="after"
+ select="following-sibling::node()[1]"/>
+ <xsl:choose>
+ <!-- No sibling after this node -->
+ <xsl:when
+ test="not($after)"/>
+ <!-- Element directly after this - must be another inline element
+ handling itself -->
+ <xsl:when
+ test="name($after)"/>
+ <!-- Node directly after this is text - check it -->
+ <xsl:when
+ test="not(contains(concat($apos, ' 
	
")]}>-/:.,;!?\'), substring($after, 1, 1)))">
+ <!-- Does not start with one of the allowed characters so separate
+ it -->
+ <xsl:text>\</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <xsl:template
+ name="u:notSupported">
+ <xsl:call-template
+ name="u:BandI"/>
+ <xsl:text>######## NOT SUPPORTED: `</xsl:text>
+ <xsl:value-of
+ select="name(.)"/>
+ <xsl:text>' ########</xsl:text>
+ &tEOL;
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <xsl:template
+ name="u:overline">
+ <!-- Length of the rendered(!) text -->
+ <xsl:param
+ name="length"/>
+ <!-- Depth 1 and 2 are document title and subtitle while depths
+ greater than 2 are normal section titles -->
+ <xsl:param
+ name="depth"/>
+ <!-- Test whether a overline is wanted at all -->
+ <xsl:if
+ test="substring($adornment, 2 * ($depth - 1) + 1, 1) = 'o'">
+ <xsl:value-of
+ select="str:padding($length, substring($adornment, 2 * ($depth - 1) + 2, 1))"/>
+ &tEOL;
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template
+ name="u:underline">
+ <!-- Length of the rendered(!) text -->
+ <xsl:param
+ name="length"/>
+ <!-- Depth 1 and 2 are document title and subtitle while depths
+ greater than 2 are normal section titles -->
+ <xsl:param
+ name="depth"/>
+ <xsl:value-of
+ select="str:padding($length, substring($adornment, 2 * ($depth - 1) + 2, 1))"/>
+ &tEOL;
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- Output a non-standalone reference or target -->
+ <xsl:template
+ name="u:inlineReference">
+ <xsl:param
+ name="anonymous"
+ select="false()"/>
+ <xsl:param
+ name="embedded"
+ select="false()"/>
+ <!-- Is this a target instead of a reference? -->
+ <xsl:param
+ name="isTarget"
+ select="false()"/>
+ <xsl:param
+ name="text"
+ select="node()"/>
+ <xsl:call-template
+ name="u:bkslshEscPre"/>
+ <!-- Delimiter only if link contains other than alphanumerics -->
+ <xsl:variable
+ name="delimiter">
+ <xsl:if
+ test="* or translate($text, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', '') or $embedded">
+ <xsl:text>`</xsl:text>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:if
+ test="$isTarget">
+ <xsl:text>_</xsl:text>
+ </xsl:if>
+ <xsl:value-of
+ select="$delimiter"/>
+ <xsl:apply-templates
+ select="$text"/>
+ <xsl:if
+ test="$embedded">
+ <xsl:text> <</xsl:text>
+ <xsl:value-of
+ select="@refuri"/>
+ <xsl:text>></xsl:text>
+ </xsl:if>
+ <xsl:value-of
+ select="$delimiter"/>
+ <xsl:if
+ test="not($isTarget)">
+ <xsl:text>_</xsl:text>
+ <xsl:if
+ test="$anonymous">
+ <xsl:text>_</xsl:text>
+ </xsl:if>
+ </xsl:if>
+ <xsl:call-template
+ name="u:bkslshEscSuf"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- Output a class directive for the directly following element. -->
+ <!-- TODO A class directive can also be used as a container putting the
+ respective attribute to its content; however, this is not
+ reflected in XML - you'd need to check a sequence of elements
+ whether they all have the same attribute; furthermore class
+ settings for block quotes needs to be treated special -->
+ <xsl:template
+ name="u:outputClass">
+ <!-- Blank line already output? -->
+ <xsl:param
+ name="alreadyBlanked"
+ select="false()"/>
+ <!-- Indentation already output? -->
+ <xsl:param
+ name="alreadyIndented"
+ select="false()"/>
+ <!-- Add a blank line after class directive? -->
+ <xsl:param
+ name="blankAfter"
+ select="false()"/>
+ <xsl:if
+ test="@classes">
+ <xsl:if
+ test="not($alreadyBlanked)">
+ <xsl:call-template
+ name="u:blank"/>
+ </xsl:if>
+ <xsl:if
+ test="not($alreadyIndented)">
+ <xsl:call-template
+ name="u:indent"/>
+ </xsl:if>
+ <xsl:text>.. class:: </xsl:text>
+ <xsl:value-of
+ select="@classes"/>
+ &tEOL;
+ <xsl:if
+ test="$blankAfter">
+ &tCR;
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- Output a names attribute at index considering quoted spaces. -->
+ <xsl:template
+ name="u:outputNames">
+ <!-- Blank line already output? -->
+ <xsl:param
+ name="names"
+ select="@names"/>
+ <xsl:param
+ name="index"
+ select="0"/>
+ <xsl:value-of
+ select="str:replace(str:tokenize(normalize-space(str:replace($names, '\ ', '|')))[position() = $index + 1], '|', ' ')"/>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+
+ <!-- Output a names attribute for a refid. -->
+ <xsl:template
+ name="u:outputNamesRefid">
+ <xsl:param
+ name="refid"
+ select="@refid"/>
+ <!-- Determine the elements which is referred -->
+ <xsl:variable
+ name="refElem"
+ select="//*[@ids and math:max(dyn:map(str:tokenize(normalize-space(@ids)), 'number($refid = .)')) > 0]"/>
+ <xsl:call-template
+ name="u:outputNames">
+ <xsl:with-param
+ name="names"
+ select="$refElem/@names"/>
+ <xsl:with-param
+ name="index"
+ select="math:max(dyn:map(str:tokenize(normalize-space($refElem/@ids)), 'number($refid = .) * position() - 1'))"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- ******************************************************************** -->
+ <!-- ******************************************************************** -->
+
+ <!-- Report unknown tags -->
+ <xsl:template
+ match="*">
+ <xsl:message>
+ <xsl:text>`</xsl:text>
+ <xsl:value-of
+ select="name(.)"/>
+ <xsl:text>' encountered</xsl:text>
+ <xsl:if
+ test="parent::*">
+ <xsl:text> in `</xsl:text>
+ <xsl:value-of
+ select="name(parent::*)"/>
+ <xsl:text>'</xsl:text>
+ </xsl:if>
+ <xsl:text>, but no template matches.</xsl:text>
+ </xsl:message>
+ </xsl:template>
+
+</xsl:stylesheet>
+
+<!-- ********************************************************************** -->
+<!-- ********************************************************************** -->
+<!-- ********************************************************************** -->
+<!-- POD manual page
+
+=head1 NAME
+
+xml2rst-nopy.xsl - An XSLT script to convert Docutils XML to reStructuredText
+
+=head1 SYNOPSIS
+
+ xsltproc docutils.xml xml2rst-nopy.xsl
+
+=head1 NOTE
+
+Today B<xml2rst-nopy.xsl> is not the recommended way to use
+B<xml2rst>. The preferred way is to install B<lxml> and use
+B<xml2rst.py> instead.
+
+=head1 DESCRIPTION
+
+B<xml2rst-nopy.xsl> is an XSLT script to convert Docutils XML to
+reStructuredText. You can use your favorite XSLT processor supporting
+EXSLT (e.g. xsltproc from the Gnome project) to generate
+reStructuredText from the Docutils intermediate XML representation.
+Its main use is to generate reStructuredText from some other format
+where a converter to Docutils XML already exists.
+
+=head2 Options
+
+The following options are supported. They are XSLT parameters for the
+whole script and must be given to the XSLT processor by the respective
+option (xsltproc: B<- -param> or B<- -stringparam>).
+
+=over 4
+
+=item adornment
+
+Configures title markup to use so different styles can be requested
+easily.
+
+The value of the parameter must be a string made up of a sequence of
+character pairs. The first character of a pair is C<o> (overline) or
+C<u> (underline) and the second character is the character to use for
+the markup.
+
+The first and the second character pair is used for document title and
+subtitle, the following pairs are used for section titles where the
+third pair is used for the top level section title.
+
+Defaults to C<o=o-u=u-u~u:u.u`>.
+
+=item fold
+
+Configures whether long text lines in paragraphs should be folded and
+to which length. This option is for input not coming from reST which
+may have no internal line feeds in plain text strings.
+
+If folding is enabled text strings not in a line feed preserving
+context are first white-space normalized and then broken according to
+the folding rules. Folding rules put out the first word and continue
+to do so with the following words unless the next word would cross
+the folding boundary. Words are delimited by white-space.
+
+Defaults to C<0>, i.e. no folding.
+
+=back
+
+=head2 Unsupported features
+
+It is generally not possible to create an exact reproduction of an
+original reStructuredText source from an intermediate XML file. The
+reason is that Docutils transports pretty much but not all information
+of the original source into the XML. Also the sequence is changed
+sometimes.
+
+However, the coverage of Docutils features of B<xml2rst-nopy.xsl> is
+pretty good. A few minor features are not supported:
+
+=over 4
+
+=item * Fully minimized style for literal blocks
+
+=item * Substitution references for C<replace::> substitutions
+
+=item * Counting roman numbers in enumerated lists
+
+=item * Special table types like C<list-table::> and C<csv-table::>
+
+=item * Custom role definitions
+
+=back
+
+=head1 INSTALLATION
+
+Installation is not necessary. Just use the file as downloaded with
+your favorite XSLT processor supporting EXSLT. For instance you can
+use B<xsltproc> from the Gnome project.
+
+=head1 AUTHOR
+
+Stefan Merten <smerten(a)oekonux.de> based on works by David Priest.
+
+=head1 LICENSE
+
+This program is licensed under the terms of the GPL. See
+
+ http://www.gnu.org/licenses/gpl.txt
+
+=head1 AVAILABILTY
+
+See
+
+ http://www.merten-home.de/FreeSoftware/xml2rst/
+
+=cut
+
+-->
1
0
r688 - in branches/jrst-docutils-jython/jrst-doc/src/site: . en/rst en/rst/devel en/rst/devel/images en/rst/user en/rst/user/images resources resources/images resources/schemas rst rst/devel rst/user rst/user/images
by jpages@users.nuiton.org 30 May '12
by jpages@users.nuiton.org 30 May '12
30 May '12
Author: jpages
Date: 2012-05-30 17:34:49 +0200 (Wed, 30 May 2012)
New Revision: 688
Url: http://nuiton.org/repositories/revision/jrst/688
Log:
Correction de la documentation en tenant compte des remarques de Sylvain
Added:
branches/jrst-docutils-jython/jrst-doc/src/site/resources/images/
branches/jrst-docutils-jython/jrst-doc/src/site/resources/images/biohazard.png
Removed:
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/Todo.rst
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/images/DiagrammeClass.png
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/images/DiagrammeSequance.png
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/images/diagrammeGeneration.png
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/images/presentationXSL.png
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/functionality.rst
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/images/biohazard.png
branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/Todo.rst
branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/fonctionnalites.rst
branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/images/biohazard.png
Modified:
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/XSLpresentation.rst
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/developerDoc.rst
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/library.rst
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/index.rst
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/RSTpresentation.rst
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/index.rst
branches/jrst-docutils-jython/jrst-doc/src/site/resources/schemas/diagrammeClass.png
branches/jrst-docutils-jython/jrst-doc/src/site/resources/schemas/diagrammeSequence.png
branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/docDeveloppeur.rst
branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/librairies.rst
branches/jrst-docutils-jython/jrst-doc/src/site/rst/index.rst
branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/index.rst
branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/presentationRST.rst
branches/jrst-docutils-jython/jrst-doc/src/site/site_en.xml
branches/jrst-docutils-jython/jrst-doc/src/site/site_fr.xml
Deleted: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/Todo.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/Todo.rst 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/Todo.rst 2012-05-30 15:34:49 UTC (rev 688)
@@ -1,47 +0,0 @@
-.. -
-.. * #%L
-.. * JRst :: Documentation
-.. *
-.. * $Id$
-.. * $HeadURL$
-.. * %%
-.. * Copyright (C) 2009 - 2010 CodeLutin
-.. * %%
-.. * This program is free software: you can redistribute it and/or modify
-.. * it under the terms of the GNU Lesser General Public License as
-.. * published by the Free Software Foundation, either version 3 of the
-.. * License, or (at your option) any later version.
-.. *
-.. * This program is distributed in the hope that it will be useful,
-.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
-.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-.. * GNU General Lesser Public License for more details.
-.. *
-.. * You should have received a copy of the GNU General Lesser Public
-.. * License along with this program. If not, see
-.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
-.. * #L%
-.. -
-
-====
-Todo
-====
-
-This is a list of the tasks which remains to be made. If somebody wants to help
-or has ideas, don't hesitate.
-
-- multiformat date
-- xsl file to converts xhtml -> xdoc
-
-- English documentation (somebody to correct me :) )
-- ant rules to generation help like :
- <jrst include="..." exclude="..." destination="" extension="...."/>
- destination is destination folder
- extension is extension modification of the source file with this one.
-
-- export yo pretion, magic, or an other presentation tool.
-
-- to allow the importation of other format that rst, for example .sxw.
- to make possible the simple convertion of the .sxw in rst.
-
-- make a doclet to produce RST JavaDoc
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/XSLpresentation.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/XSLpresentation.rst 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/XSLpresentation.rst 2012-05-30 15:34:49 UTC (rev 688)
@@ -183,5 +183,5 @@
- Article : http://www.commentcamarche.net/xml/xmlxsl.php3
- Diagram : http://fr.wikipedia.org/wiki/Extended_stylesheet_language_transformations
-.. |presentationxsl| image:: images/presentationXSL.png
+.. |presentationxsl| image:: ../../schemas/presentationXSL.png
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/developerDoc.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/developerDoc.rst 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/developerDoc.rst 2012-05-30 15:34:49 UTC (rev 688)
@@ -32,28 +32,30 @@
Class diagram
=============
-.. image:: ../../schemas/diagrammeGeneration.png
+.. image:: ../../schemas/diagrammeClass.png
:align: center
-**JRST** Class contents main() method, it's looking after options, files reading and writing. Iinitially, it calls Jython_ class **PythonInterpreter** which allows to execute DocUtils' Python script to generate an intermediate file. Then it only remains to apply the wish XSL (if needed) by using **JRSTGenerator** Class.
+**JRST** Class contents main() method, it's looking after options, files reading and writing. Initially, it calls Jython_ class **PythonInterpreter** which allows to execute DocUtils' Python script to generate an intermediate file. Then it only remains to apply several desired XSL (if needed) by using **JRSTGenerator** Class.
+This sequence diagram describes the parser's mechanism throughout the generation :
+
+.. image:: ../../schemas/diagrammeSequence.png
+ :align: center
+
Generation
==========
-.. image:: ../../schemas/classDiagramme.png
+.. image:: ../../schemas/diagrammeGeneration.png
:align: center
Links :
- * xml2rst.xsl (convertion from xml of docutils towards rst) : http://www.merten-home.de/FreeSoftware/xml2rst
- * dn2dbk.xsl (convertion from xml of docutils towards docbook) : http://membres.lycos.fr/ebellot/dn2dbk
- * nwalsh xsl (convertion from docbook towards FO and xhtml) : http://nwalsh.com
+ * xml2rst.xsl (conversion from xml of docutils towards rst) : http://www.merten-home.de/FreeSoftware/xml2rst
+ * dn2dbk.xsl (conversion from xml of docutils towards docbook) : http://membres.lycos.fr/ebellot/dn2dbk
+ * nwalsh xsl (conversion from docbook towards FO and xhtml) : http://nwalsh.com
+ * IText (conversion from HTML towards PDF) : http://itextpdf.com/
- * XMLmind (convertion from FO towards ODT and RTF) : http://www.xmlmind.com/foconverter/what_is_xfc.html
- * FOP (convertion from FO towards PDF) : http://xmlgraphics.apache.org/fop
- * IText (convertion from HTML towards PDF) : http://itextpdf.com/
-
-Use exemple
+Use example
===========
We want to convert this following reStructuredText document (text.rst) to html (text.html) :
@@ -74,11 +76,6 @@
JRST -t html -o text.html text.rst
-This sequence diagramme describes the parser's mechanism throughout the generation :
-
-.. image:: ../../schemas/diagrammeSequence.png
- :align: center
-
**JRSTGenerator** Class with the XSL file rst2xhtml.xsl, returns following html file::
<?xml version="1.0" encoding="UTF-8"?>
@@ -124,7 +121,7 @@
Uses external XSL
=================
-JRST able to transform DocUtils XML with external XSL [2]_ files.
+JRST is able to transform DocUtils XML with external XSL [2]_ files.
You must use this following command::
JRST -x XSLfile, XSLfile2 RSTfile
Deleted: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/images/DiagrammeClass.png
===================================================================
(Binary files differ)
Deleted: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/images/DiagrammeSequance.png
===================================================================
(Binary files differ)
Deleted: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/images/diagrammeGeneration.png
===================================================================
(Binary files differ)
Deleted: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/images/presentationXSL.png
===================================================================
(Binary files differ)
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/library.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/library.rst 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/library.rst 2012-05-30 15:34:49 UTC (rev 688)
@@ -40,10 +40,10 @@
Librairy used to the XSL transformation.
-SDoc_
-=====
+IText_
+======
-SDoc_ provide Swing composants which includes syntax coloration for many languages.
+IText_ is a library to generate PDF documents from (x)HTML pages.
Xmlunit_
========
@@ -53,7 +53,7 @@
DocUtils_
=========
-DocUtils_ is a set of scripts to transform RST_ files into useful formats, such as HTML, ODT, Latex and more.
+DocUtils_ is a set of Python scripts to transform RST_ files into useful formats, such as HTML, ODT, Latex and more.
Jython_
=======
@@ -64,7 +64,7 @@
.. _dom4j: http://www.dom4j.org
.. _javax.xml.transform: http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.h…
-.. _SDoc: http://sdoc.sourceforge.net/wiki/pmwiki.php
+.. _IText: http://itextpdf.com/
.. _Xmlunit: http://xmlunit.sourceforge.net/
.. _RST: http://docutils.sourceforge.net/rst.html
.. _DocUtils: http://docutils.sourceforge.net/docs/ref/doctree.html
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/index.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/index.rst 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/index.rst 2012-05-30 15:34:49 UTC (rev 688)
@@ -27,8 +27,8 @@
reStructuredText_ parser : JRst
===============================
-Documentation utilisateur
-=========================
+User Documentation
+==================
.. contents::
@@ -43,16 +43,18 @@
document. RST has a so simple syntax that it becomes almost invisible.
JRST uses Jython_ and DocUtils_ to transform RST_ files to XML to create a tree representation
-document. It becomes easy to generate document representation towards differents
-fomats.
+document. It becomes easy to generate document representation towards different
+formats.
How to use it
-------------
JRST takes a reStructuredText_ file and generates XML file. Which could be used to produce
various files formats with generation XSL_ files. The available output formats are HTML, xhtml,
-rst, pdf, docbook, odt(Open-Office), rtf, or XML [1]_.
+rst, pdf, docbook or odt(Open-Office) [1]_.
+If JRST is launched without arguments, a graphical user interface is displayed for the user. Thus, we can choose easily files, output type or external XSL stylesheets to apply.
+
::
JRST myfile.rst
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/RSTpresentation.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/RSTpresentation.rst 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/RSTpresentation.rst 2012-05-30 15:34:49 UTC (rev 688)
@@ -367,18 +367,18 @@
To include an image in your document, you use the the ``image`` directive__.
For example::
- .. image:: images/biohazard.png
+ .. image:: ../../images/biohazard.png
results in:
-.. image:: images/biohazard.png
+.. image:: ../../images/biohazard.png
-The ``images/biohazard.png`` part indicates the filename of the image
+The ``../../images/biohazard.png`` part indicates the filename of the image
you wish to appear in the document. There's no restriction placed on
the image (format, size etc). If the image is to appear in HTML and
you wish to supply additional information, you may::
- .. image:: images/biohazard.png
+ .. image:: ../../images/biohazard.png
:height: 100
:width: 200
:scale: 50
Deleted: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/functionality.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/functionality.rst 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/functionality.rst 2012-05-30 15:34:49 UTC (rev 688)
@@ -1,274 +0,0 @@
-.. -
-.. * #%L
-.. * JRst :: Documentation
-.. *
-.. * $Id$
-.. * $HeadURL$
-.. * %%
-.. * Copyright (C) 2009 - 2010 CodeLutin
-.. * %%
-.. * This program is free software: you can redistribute it and/or modify
-.. * it under the terms of the GNU Lesser General Public License as
-.. * published by the Free Software Foundation, either version 3 of the
-.. * License, or (at your option) any later version.
-.. *
-.. * This program is distributed in the hope that it will be useful,
-.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
-.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-.. * GNU General Lesser Public License for more details.
-.. *
-.. * You should have received a copy of the GNU General Lesser Public
-.. * License along with this program. If not, see
-.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
-.. * #L%
-.. -
-
-=========================
-Functionalities suggested
-=========================
-
-Docutils DTD : http://docutils.sourceforge.net/docs/ref/doctree.html
-
-.. contents:: Summary
-
-Functionalities established
-===========================
-
-Root element
-------------
-
-- document_
-
-Title elements
---------------
-
-- subtitle_
-- title_
-
-Bibliographic elements
-----------------------
-
-- docinfo_
-- author_
-- authors_
-- organization_
-- address_
-- contact_
-- version_
-- revision_
-- status_
-- date_
-- copyright_
-
-Decoration elements
--------------------
-
-- decoration_
-- footer_
-- header_
-
-Structural elements
--------------------
-
-- section_
-- topic_
-- sidebar_
-- transition_
-
-Body elements
--------------
-
-- admonition_
-- attention_
-- block_quote_
-- bullet_list_
-- caution_
-- classifier_
-- danger_
-- definition_
-- definition_list_
-- definition_list_item_
-- description_
-- doctest_block_
-- enumerated_list_
-- error_
-- field_
-- field_body_
-- field_list_
-- field_name_
-- footnote_
-- hint_
-- image_
-- important_
-- line_
-- line_block_
-- list_item_
-- literal_block_
-- note_
-- option_
-- option_argument_
-- option_group_
-- option_list_
-- option_list_item_
-- option_string_
-- paragraph_
-- term_
-- tip_
-- warning_
-
-Table elements
---------------
-
-- table_
-- tbody_
-- entry_
-- row_
-- colspec_
-- thead_
-- tgroup_
-
-Inline elements
----------------
-
-- emphasis_
-- strong_
-- literal_
-- reference_
-- footnote_reference_
-
-
-Unimplemented functionalities
-=============================
-
-- abbreviation_
-- acronym_
-- attribution_
-- caption_
-- citation_
-- citation_reference_
-- comment_
-- compound_
-- container_
-- figure_
-- generated_
-- inline_
-- label_
-- legend_
-- pending_
-- problematic_
-- raw_
-- rubric_
-- subscript_
-- substitution_definition_
-- substitution_reference_
-- superscript_
-- system_message_
-- target_
-- title_reference_
-
-.. _abbreviation: http://docutils.sourceforge.net/docs/ref/doctree.html#abbreviation
-.. _acronym: http://docutils.sourceforge.net/docs/ref/doctree.html#acronym
-.. _address: http://docutils.sourceforge.net/docs/ref/doctree.html#address
-.. _admonition: http://docutils.sourceforge.net/docs/ref/doctree.html#admonition
-.. _attention: http://docutils.sourceforge.net/docs/ref/doctree.html#attention
-
-.. _attribution: http://docutils.sourceforge.net/docs/ref/doctree.html#attribution
-.. _author: http://docutils.sourceforge.net/docs/ref/doctree.html#author
-.. _authors: http://docutils.sourceforge.net/docs/ref/doctree.html#authors
-.. _block_quote: http://docutils.sourceforge.net/docs/ref/doctree.html#block-quote
-.. _bullet_list: http://docutils.sourceforge.net/docs/ref/doctree.html#bullet-list
-.. _caption: http://docutils.sourceforge.net/docs/ref/doctree.html#caption
-.. _caution: http://docutils.sourceforge.net/docs/ref/doctree.html#caution
-.. _citation: http://docutils.sourceforge.net/docs/ref/doctree.html#citation
-.. _citation_reference: http://docutils.sourceforge.net/docs/ref/doctree.html#citation-reference
-
-.. _classifier: http://docutils.sourceforge.net/docs/ref/doctree.html#classifier
-.. _colspec: http://docutils.sourceforge.net/docs/ref/doctree.html#colspec
-.. _comment: http://docutils.sourceforge.net/docs/ref/doctree.html#comment
-.. _compound: http://docutils.sourceforge.net/docs/ref/doctree.html#compound
-.. _contact: http://docutils.sourceforge.net/docs/ref/doctree.html#contact
-.. _container: http://docutils.sourceforge.net/docs/ref/doctree.html#container
-.. _copyright: http://docutils.sourceforge.net/docs/ref/doctree.html#copyright
-.. _danger: http://docutils.sourceforge.net/docs/ref/doctree.html#danger
-.. _date: http://docutils.sourceforge.net/docs/ref/doctree.html#date
-
-.. _decoration: http://docutils.sourceforge.net/docs/ref/doctree.html#decoration
-.. _definition: http://docutils.sourceforge.net/docs/ref/doctree.html#definition
-.. _definition_list: http://docutils.sourceforge.net/docs/ref/doctree.html#definition-list
-.. _definition_list_item: http://docutils.sourceforge.net/docs/ref/doctree.html#definition-list-item
-.. _description: http://docutils.sourceforge.net/docs/ref/doctree.html#description
-.. _docinfo: http://docutils.sourceforge.net/docs/ref/doctree.html#docinfo
-.. _doctest_block: http://docutils.sourceforge.net/docs/ref/doctree.html#doctest-block
-.. _document: http://docutils.sourceforge.net/docs/ref/doctree.html#document
-.. _emphasis: http://docutils.sourceforge.net/docs/ref/doctree.html#emphasis
-
-.. _entry: http://docutils.sourceforge.net/docs/ref/doctree.html#entry
-.. _enumerated_list: http://docutils.sourceforge.net/docs/ref/doctree.html#enumerated-list
-.. _error: http://docutils.sourceforge.net/docs/ref/doctree.html#error
-.. _field: http://docutils.sourceforge.net/docs/ref/doctree.html#field
-.. _field_body: http://docutils.sourceforge.net/docs/ref/doctree.html#field-body
-.. _field_list: http://docutils.sourceforge.net/docs/ref/doctree.html#field-list
-.. _field_name: http://docutils.sourceforge.net/docs/ref/doctree.html#field-name
-.. _figure: http://docutils.sourceforge.net/docs/ref/doctree.html#figure
-.. _footer: http://docutils.sourceforge.net/docs/ref/doctree.html#footer
-
-.. _footnote: http://docutils.sourceforge.net/docs/ref/doctree.html#footnote
-.. _footnote_reference: http://docutils.sourceforge.net/docs/ref/doctree.html#footnote-reference
-.. _generated: http://docutils.sourceforge.net/docs/ref/doctree.html#generated
-.. _header: http://docutils.sourceforge.net/docs/ref/doctree.html#header
-.. _hint: http://docutils.sourceforge.net/docs/ref/doctree.html#hint
-.. _image: http://docutils.sourceforge.net/docs/ref/doctree.html#image
-.. _important: http://docutils.sourceforge.net/docs/ref/doctree.html#important
-.. _inline: http://docutils.sourceforge.net/docs/ref/doctree.html#inline
-.. _label: http://docutils.sourceforge.net/docs/ref/doctree.html#label
-
-.. _legend: http://docutils.sourceforge.net/docs/ref/doctree.html#legend
-.. _line: http://docutils.sourceforge.net/docs/ref/doctree.html#line
-.. _line_block: http://docutils.sourceforge.net/docs/ref/doctree.html#line-block
-.. _list_item: http://docutils.sourceforge.net/docs/ref/doctree.html#list-item
-.. _literal: http://docutils.sourceforge.net/docs/ref/doctree.html#literal
-.. _literal_block: http://docutils.sourceforge.net/docs/ref/doctree.html#literal-block
-.. _note: http://docutils.sourceforge.net/docs/ref/doctree.html#note
-.. _option: http://docutils.sourceforge.net/docs/ref/doctree.html#option
-.. _option_argument: http://docutils.sourceforge.net/docs/ref/doctree.html#option-argument
-
-.. _option_group: http://docutils.sourceforge.net/docs/ref/doctree.html#option-group
-.. _option_list: http://docutils.sourceforge.net/docs/ref/doctree.html#option-list
-.. _option_list_item: http://docutils.sourceforge.net/docs/ref/doctree.html#option-list-item
-.. _option_string: http://docutils.sourceforge.net/docs/ref/doctree.html#option-string
-.. _organization: http://docutils.sourceforge.net/docs/ref/doctree.html#organization
-.. _paragraph: http://docutils.sourceforge.net/docs/ref/doctree.html#paragraph
-.. _pending: http://docutils.sourceforge.net/docs/ref/doctree.html#pending
-.. _problematic: http://docutils.sourceforge.net/docs/ref/doctree.html#problematic
-.. _raw: http://docutils.sourceforge.net/docs/ref/doctree.html#raw
-
-.. _reference: http://docutils.sourceforge.net/docs/ref/doctree.html#reference
-.. _revision: http://docutils.sourceforge.net/docs/ref/doctree.html#revision
-.. _row: http://docutils.sourceforge.net/docs/ref/doctree.html#row
-.. _rubric: http://docutils.sourceforge.net/docs/ref/doctree.html#rubric
-.. _section: http://docutils.sourceforge.net/docs/ref/doctree.html#section
-.. _sidebar: http://docutils.sourceforge.net/docs/ref/doctree.html#sidebar
-.. _status: http://docutils.sourceforge.net/docs/ref/doctree.html#status
-.. _strong: http://docutils.sourceforge.net/docs/ref/doctree.html#strong
-.. _subscript: http://docutils.sourceforge.net/docs/ref/doctree.html#subscript
-
-.. _substitution_definition: http://docutils.sourceforge.net/docs/ref/doctree.html#substitution-definiti…
-.. _substitution_reference: http://docutils.sourceforge.net/docs/ref/doctree.html#substitution-reference
-.. _subtitle: http://docutils.sourceforge.net/docs/ref/doctree.html#subtitle
-.. _superscript: http://docutils.sourceforge.net/docs/ref/doctree.html#superscript
-.. _system_message: http://docutils.sourceforge.net/docs/ref/doctree.html#system-message
-.. _table: http://docutils.sourceforge.net/docs/ref/doctree.html#table
-.. _target: http://docutils.sourceforge.net/docs/ref/doctree.html#target
-.. _tbody: http://docutils.sourceforge.net/docs/ref/doctree.html#tbody
-.. _term: http://docutils.sourceforge.net/docs/ref/doctree.html#term
-
-.. _tgroup: http://docutils.sourceforge.net/docs/ref/doctree.html#tgroup
-.. _thead: http://docutils.sourceforge.net/docs/ref/doctree.html#thead
-.. _tip: http://docutils.sourceforge.net/docs/ref/doctree.html#tip
-.. _title: http://docutils.sourceforge.net/docs/ref/doctree.html#title
-.. _title_reference: http://docutils.sourceforge.net/docs/ref/doctree.html#title-reference
-.. _topic: http://docutils.sourceforge.net/docs/ref/doctree.html#topic
-.. _transition: http://docutils.sourceforge.net/docs/ref/doctree.html#transition
-.. _version: http://docutils.sourceforge.net/docs/ref/doctree.html#version
-.. _warning: http://docutils.sourceforge.net/docs/ref/doctree.html#warning
-
Deleted: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/images/biohazard.png
===================================================================
(Binary files differ)
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/index.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/index.rst 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/user/index.rst 2012-05-30 15:34:49 UTC (rev 688)
@@ -27,8 +27,8 @@
reStructuredText_ parser : JRst
===============================
-Documentation utilisateur
-=========================
+User Documentation
+==================
.. contents::
@@ -43,16 +43,18 @@
document. RST has a so simple syntax that it becomes almost invisible.
JRST uses Jython_ and DocUtils_ to transform RST_ files to XML to create a tree representation
-document. It becomes easy to generate document representation towards differents
-fomats.
+document. It becomes easy to generate document representation towards different
+formats.
How to use it
-------------
JRST takes a reStructuredText_ file and generates XML file. Which could be used to produce
various files formats with generation XSL_ files. The available output formats are HTML, xhtml,
-rst, pdf, docbook, odt(Open-Office), rtf, or XML [1]_.
+rst, pdf, docbook or odt(Open-Office) [1]_.
+If JRST is launched without arguments, a graphical user interface is displayed for the user. Thus, we can choose easily files, output type or external XSL stylesheets to apply.
+
::
JRST myfile.rst
Copied: branches/jrst-docutils-jython/jrst-doc/src/site/resources/images/biohazard.png (from rev 685, branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/images/biohazard.png)
===================================================================
(Binary files differ)
Property changes on: branches/jrst-docutils-jython/jrst-doc/src/site/resources/images/biohazard.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/resources/schemas/diagrammeClass.png
===================================================================
(Binary files differ)
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/resources/schemas/diagrammeSequence.png
===================================================================
(Binary files differ)
Deleted: branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/Todo.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/Todo.rst 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/Todo.rst 2012-05-30 15:34:49 UTC (rev 688)
@@ -1,53 +0,0 @@
-.. -
-.. * #%L
-.. * JRst :: Documentation
-.. *
-.. * $Id$
-.. * $HeadURL$
-.. * %%
-.. * Copyright (C) 2009 - 2010 CodeLutin
-.. * %%
-.. * This program is free software: you can redistribute it and/or modify
-.. * it under the terms of the GNU Lesser General Public License as
-.. * published by the Free Software Foundation, either version 3 of the
-.. * License, or (at your option) any later version.
-.. *
-.. * This program is distributed in the hope that it will be useful,
-.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
-.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-.. * GNU General Lesser Public License for more details.
-.. *
-.. * You should have received a copy of the GNU General Lesser Public
-.. * License along with this program. If not, see
-.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
-.. * #L%
-.. -
-
-====
-Todo
-====
-
-Voici la liste des tâches qui reste à faire. Si quelqu'un souhaite aider, ou
-a une idée à proposer il ne faut pas hésiter.
-
-- intégrer une date multiformat
-- faire une feuille de style de conversion de xhtml -> xdoc
-
-- la documentation en anglais (si quelqu'un pouvait me relire :) )
-- faire une règle ant pour aider à la génération
- <jrst include="..." exclude="..." destination="" extension="...."/>
- destination est le répertoire destination
- extension est la modification de l'extension des fichiers sources avec
- cette extension
-
-- un export vers pretion, magic, ou autre outil de présentation.
-
-- permettre l'import de d'autre format que rst, par exemple .odt
- ce qui permettra de convertir simplement du .odt en rst.
-
-- Faire une doclet qui permette d'écrire les Javadocs en RST
-
-- Correction du bug sur les URIResolver, lors de la génération DocBook -> fo
- il va chercher les imports à la racine du jrst, et non dans le jar.
-
-- ajouter une directive pour supporter les equations mathematiques f(x)=a^3/x qui sera rendu graphiquement
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/docDeveloppeur.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/docDeveloppeur.rst 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/docDeveloppeur.rst 2012-05-30 15:34:49 UTC (rev 688)
@@ -36,8 +36,14 @@
:alt: Diagramme de classes
:align: center
-La classe **JRST** contient la méthode main(), elle gère les options, la lecture et l'écriture des fichiers. Elle appelle dans un premier temps la classe **PythonInterpreter** de Jython_ permettant d'exécuter les scripts en Python de DocUtils_ pour générer un fichier XML intermédiaire. Ensuite, il ne reste qu'à appliquer le XSL désiré (si besoin) grâce à la classe **JRSTGenerator**.
+La classe **JRST** contient la méthode main(), elle gère les options, la lecture et l'écriture des fichiers. Elle appelle dans un premier temps la classe **PythonInterpreter** de Jython_ permettant d'exécuter les scripts en Python de DocUtils_ pour générer un fichier XML intermédiaire. Ensuite, il ne reste qu'à appliquer le ou les XSL désiré(s) (si besoin) grâce à la classe **JRSTGenerator**.
+Ce diagramme de séquence décrit le fonctionnement du parseur tout au long de la génération :
+
+.. image:: ../schemas/diagrammeSequence.png
+ :alt: Diagramme de séquence d'une génération
+ :align: center
+
La génération
=============
@@ -50,9 +56,6 @@
* xml2rst.xsl (convertion de xml de docutils vers rst) : http://www.merten-home.de/FreeSoftware/xml2rst
* dn2dbk.xsl (convertion de xml de docutils vers docbook) : http://membres.lycos.fr/ebellot/dn2dbk
* les xsl de nwalsh (convertion de docbook vers FO et xhtml) : http://nwalsh.com
-
- * XMLmind (convertion de FO vers ODT et RTF) : http://www.xmlmind.com/foconverter/what_is_xfc.html
- * FOP (convertion de FO vers PDF) : http://xmlgraphics.apache.org/fop
* IText (convertion de HTML vers PDF) : http://itextpdf.com/
@@ -77,12 +80,6 @@
JRST -t html -o text.html text.rst
-Ce diagramme de séquence décrit le fonctionnement du parseur tout au long de la génération :
-
-.. image:: ../schemas/diagrammeSequence.png
- :alt: Diagramme de séquence d'une génération
- :align: center
-
La Classe **JRSTGenerator**, grâce au fichier XSL rst2xhtml.xsl, renvoie le fichier html suivant::
<?xml version="1.0" encoding="UTF-8"?>
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/librairies.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/librairies.rst 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/rst/devel/librairies.rst 2012-05-30 15:34:49 UTC (rev 688)
@@ -39,10 +39,10 @@
Librairie permettant la transformation XSL.
-SDoc_
-=====
+IText_
+======
-SDoc_ fournit des composants Swing qui inclut la coloration syntaxique pour de nombreux langages.
+IText_ est une bibliothèque permettant de générer des documents PDF à partir de pages (x)HTML.
Xmlunit_
========
@@ -52,7 +52,7 @@
DocUtils_
=========
-DocUtils_ est un ensemble de scripts permettant de transformer des fichiers RST_ en formats plus répendus comme le HTML, ODT, Latex et bien plus encore.
+DocUtils_ est un ensemble de scripts en Python permettant de transformer des fichiers RST_ en formats plus répendus comme le HTML, ODT, Latex et bien plus encore.
Jython_
=======
@@ -61,7 +61,7 @@
.. _dom4j: http://www.dom4j.org
.. _javax.xml.transform: http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.h…
-.. _SDoc: http://sdoc.sourceforge.net/wiki/pmwiki.php
+.. _IText: http://itextpdf.com/
.. _Xmlunit: http://xmlunit.sourceforge.net/
.. _RST: http://docutils.sourceforge.net/rst.html
.. _DocUtils: http://docutils.sourceforge.net/docs/ref/doctree.html
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/rst/index.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/rst/index.rst 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/rst/index.rst 2012-05-30 15:34:49 UTC (rev 688)
@@ -52,8 +52,10 @@
JRST prend un fichier reStructuredText_ en entrée et génère un fichier XML
qui pourra ensuite servir à produire divers formats de fichiers grâce à des fichiers
XSL de générations. Les formats de sortie disponibles sont le html, le xhtml, le rst,
-le pdf, le docbook_, le odt (Open-Office), le rtf, ou encore le XML [1]_.
+le pdf, le docbook_ ou de l'odt (Open-Office) [1]_.
+Lorsque JRST est lancé sans argument, une interface graphique est proposée à l'utilisateur. Ainsi, on peut choisir plus aisément les fichiers, le type de sortie ou bien les feuilles de style XSL externes à appliquer.
+
::
JRST myfile.rst
Deleted: branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/fonctionnalites.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/fonctionnalites.rst 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/fonctionnalites.rst 2012-05-30 15:34:49 UTC (rev 688)
@@ -1,273 +0,0 @@
-.. -
-.. * #%L
-.. * JRst :: Documentation
-.. *
-.. * $Id$
-.. * $HeadURL$
-.. * %%
-.. * Copyright (C) 2009 - 2010 CodeLutin
-.. * %%
-.. * This program is free software: you can redistribute it and/or modify
-.. * it under the terms of the GNU Lesser General Public License as
-.. * published by the Free Software Foundation, either version 3 of the
-.. * License, or (at your option) any later version.
-.. *
-.. * This program is distributed in the hope that it will be useful,
-.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
-.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-.. * GNU General Lesser Public License for more details.
-.. *
-.. * You should have received a copy of the GNU General Lesser Public
-.. * License along with this program. If not, see
-.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
-.. * #L%
-.. -
-
-=========================
-Fonctionnalités proposées
-=========================
-
-La DTD de Docutils : http://docutils.sourceforge.net/docs/ref/doctree.html
-
-.. contents:: Sommaire
-
-Fonctionnalités implantées
-==========================
-
-Element racine
---------------
-
-- document_
-
-Elements titre
---------------
-
-- subtitle_
-- title_
-
-Elements bibliographiques
--------------------------
-
-- docinfo_
-- author_
-- authors_
-- organization_
-- address_
-- contact_
-- version_
-- revision_
-- status_
-- date_
-- copyright_
-
-Elements de décoration
-----------------------
-
-- decoration_
-- footer_
-- header_
-
-Elements structurels
---------------------
-
-- section_
-- topic_
-- sidebar_
-- transition_
-
-Elements du corps
------------------
-
-- admonition_
-- attention_
-- block_quote_
-- bullet_list_
-- caution_
-- classifier_
-- danger_
-- definition_
-- definition_list_
-- definition_list_item_
-- description_
-- doctest_block_
-- enumerated_list_
-- error_
-- field_
-- field_body_
-- field_list_
-- field_name_
-- footnote_
-- hint_
-- image_
-- important_
-- line_
-- line_block_
-- list_item_
-- literal_block_
-- note_
-- option_
-- option_argument_
-- option_group_
-- option_list_
-- option_list_item_
-- option_string_
-- paragraph_
-- term_
-- tip_
-- warning_
-
-Elements des tableaux
----------------------
-
-- table_
-- tbody_
-- entry_
-- row_
-- colspec_
-- thead_
-- tgroup_
-
-Elements de la ligne
---------------------
-
-- emphasis_
-- strong_
-- literal_
-- reference_
-- footnote_reference_
-
-Fonctionnalités non-implantées
-==============================
-
-- abbreviation_
-- acronym_
-- attribution_
-- caption_
-- citation_
-- citation_reference_
-- comment_
-- compound_
-- container_
-- figure_
-- generated_
-- inline_
-- label_
-- legend_
-- pending_
-- problematic_
-- raw_
-- rubric_
-- subscript_
-- substitution_definition_
-- substitution_reference_
-- superscript_
-- system_message_
-- target_
-- title_reference_
-
-.. _abbreviation: http://docutils.sourceforge.net/docs/ref/doctree.html#abbreviation
-.. _acronym: http://docutils.sourceforge.net/docs/ref/doctree.html#acronym
-.. _address: http://docutils.sourceforge.net/docs/ref/doctree.html#address
-.. _admonition: http://docutils.sourceforge.net/docs/ref/doctree.html#admonition
-.. _attention: http://docutils.sourceforge.net/docs/ref/doctree.html#attention
-
-.. _attribution: http://docutils.sourceforge.net/docs/ref/doctree.html#attribution
-.. _author: http://docutils.sourceforge.net/docs/ref/doctree.html#author
-.. _authors: http://docutils.sourceforge.net/docs/ref/doctree.html#authors
-.. _block_quote: http://docutils.sourceforge.net/docs/ref/doctree.html#block-quote
-.. _bullet_list: http://docutils.sourceforge.net/docs/ref/doctree.html#bullet-list
-.. _caption: http://docutils.sourceforge.net/docs/ref/doctree.html#caption
-.. _caution: http://docutils.sourceforge.net/docs/ref/doctree.html#caution
-.. _citation: http://docutils.sourceforge.net/docs/ref/doctree.html#citation
-.. _citation_reference: http://docutils.sourceforge.net/docs/ref/doctree.html#citation-reference
-
-.. _classifier: http://docutils.sourceforge.net/docs/ref/doctree.html#classifier
-.. _colspec: http://docutils.sourceforge.net/docs/ref/doctree.html#colspec
-.. _comment: http://docutils.sourceforge.net/docs/ref/doctree.html#comment
-.. _compound: http://docutils.sourceforge.net/docs/ref/doctree.html#compound
-.. _contact: http://docutils.sourceforge.net/docs/ref/doctree.html#contact
-.. _container: http://docutils.sourceforge.net/docs/ref/doctree.html#container
-.. _copyright: http://docutils.sourceforge.net/docs/ref/doctree.html#copyright
-.. _danger: http://docutils.sourceforge.net/docs/ref/doctree.html#danger
-.. _date: http://docutils.sourceforge.net/docs/ref/doctree.html#date
-
-.. _decoration: http://docutils.sourceforge.net/docs/ref/doctree.html#decoration
-.. _definition: http://docutils.sourceforge.net/docs/ref/doctree.html#definition
-.. _definition_list: http://docutils.sourceforge.net/docs/ref/doctree.html#definition-list
-.. _definition_list_item: http://docutils.sourceforge.net/docs/ref/doctree.html#definition-list-item
-.. _description: http://docutils.sourceforge.net/docs/ref/doctree.html#description
-.. _docinfo: http://docutils.sourceforge.net/docs/ref/doctree.html#docinfo
-.. _doctest_block: http://docutils.sourceforge.net/docs/ref/doctree.html#doctest-block
-.. _document: http://docutils.sourceforge.net/docs/ref/doctree.html#document
-.. _emphasis: http://docutils.sourceforge.net/docs/ref/doctree.html#emphasis
-
-.. _entry: http://docutils.sourceforge.net/docs/ref/doctree.html#entry
-.. _enumerated_list: http://docutils.sourceforge.net/docs/ref/doctree.html#enumerated-list
-.. _error: http://docutils.sourceforge.net/docs/ref/doctree.html#error
-.. _field: http://docutils.sourceforge.net/docs/ref/doctree.html#field
-.. _field_body: http://docutils.sourceforge.net/docs/ref/doctree.html#field-body
-.. _field_list: http://docutils.sourceforge.net/docs/ref/doctree.html#field-list
-.. _field_name: http://docutils.sourceforge.net/docs/ref/doctree.html#field-name
-.. _figure: http://docutils.sourceforge.net/docs/ref/doctree.html#figure
-.. _footer: http://docutils.sourceforge.net/docs/ref/doctree.html#footer
-
-.. _footnote: http://docutils.sourceforge.net/docs/ref/doctree.html#footnote
-.. _footnote_reference: http://docutils.sourceforge.net/docs/ref/doctree.html#footnote-reference
-.. _generated: http://docutils.sourceforge.net/docs/ref/doctree.html#generated
-.. _header: http://docutils.sourceforge.net/docs/ref/doctree.html#header
-.. _hint: http://docutils.sourceforge.net/docs/ref/doctree.html#hint
-.. _image: http://docutils.sourceforge.net/docs/ref/doctree.html#image
-.. _important: http://docutils.sourceforge.net/docs/ref/doctree.html#important
-.. _inline: http://docutils.sourceforge.net/docs/ref/doctree.html#inline
-.. _label: http://docutils.sourceforge.net/docs/ref/doctree.html#label
-
-.. _legend: http://docutils.sourceforge.net/docs/ref/doctree.html#legend
-.. _line: http://docutils.sourceforge.net/docs/ref/doctree.html#line
-.. _line_block: http://docutils.sourceforge.net/docs/ref/doctree.html#line-block
-.. _list_item: http://docutils.sourceforge.net/docs/ref/doctree.html#list-item
-.. _literal: http://docutils.sourceforge.net/docs/ref/doctree.html#literal
-.. _literal_block: http://docutils.sourceforge.net/docs/ref/doctree.html#literal-block
-.. _note: http://docutils.sourceforge.net/docs/ref/doctree.html#note
-.. _option: http://docutils.sourceforge.net/docs/ref/doctree.html#option
-.. _option_argument: http://docutils.sourceforge.net/docs/ref/doctree.html#option-argument
-
-.. _option_group: http://docutils.sourceforge.net/docs/ref/doctree.html#option-group
-.. _option_list: http://docutils.sourceforge.net/docs/ref/doctree.html#option-list
-.. _option_list_item: http://docutils.sourceforge.net/docs/ref/doctree.html#option-list-item
-.. _option_string: http://docutils.sourceforge.net/docs/ref/doctree.html#option-string
-.. _organization: http://docutils.sourceforge.net/docs/ref/doctree.html#organization
-.. _paragraph: http://docutils.sourceforge.net/docs/ref/doctree.html#paragraph
-.. _pending: http://docutils.sourceforge.net/docs/ref/doctree.html#pending
-.. _problematic: http://docutils.sourceforge.net/docs/ref/doctree.html#problematic
-.. _raw: http://docutils.sourceforge.net/docs/ref/doctree.html#raw
-
-.. _reference: http://docutils.sourceforge.net/docs/ref/doctree.html#reference
-.. _revision: http://docutils.sourceforge.net/docs/ref/doctree.html#revision
-.. _row: http://docutils.sourceforge.net/docs/ref/doctree.html#row
-.. _rubric: http://docutils.sourceforge.net/docs/ref/doctree.html#rubric
-.. _section: http://docutils.sourceforge.net/docs/ref/doctree.html#section
-.. _sidebar: http://docutils.sourceforge.net/docs/ref/doctree.html#sidebar
-.. _status: http://docutils.sourceforge.net/docs/ref/doctree.html#status
-.. _strong: http://docutils.sourceforge.net/docs/ref/doctree.html#strong
-.. _subscript: http://docutils.sourceforge.net/docs/ref/doctree.html#subscript
-
-.. _substitution_definition: http://docutils.sourceforge.net/docs/ref/doctree.html#substitution-definiti…
-.. _substitution_reference: http://docutils.sourceforge.net/docs/ref/doctree.html#substitution-reference
-.. _subtitle: http://docutils.sourceforge.net/docs/ref/doctree.html#subtitle
-.. _superscript: http://docutils.sourceforge.net/docs/ref/doctree.html#superscript
-.. _system_message: http://docutils.sourceforge.net/docs/ref/doctree.html#system-message
-.. _table: http://docutils.sourceforge.net/docs/ref/doctree.html#table
-.. _target: http://docutils.sourceforge.net/docs/ref/doctree.html#target
-.. _tbody: http://docutils.sourceforge.net/docs/ref/doctree.html#tbody
-.. _term: http://docutils.sourceforge.net/docs/ref/doctree.html#term
-
-.. _tgroup: http://docutils.sourceforge.net/docs/ref/doctree.html#tgroup
-.. _thead: http://docutils.sourceforge.net/docs/ref/doctree.html#thead
-.. _tip: http://docutils.sourceforge.net/docs/ref/doctree.html#tip
-.. _title: http://docutils.sourceforge.net/docs/ref/doctree.html#title
-.. _title_reference: http://docutils.sourceforge.net/docs/ref/doctree.html#title-reference
-.. _topic: http://docutils.sourceforge.net/docs/ref/doctree.html#topic
-.. _transition: http://docutils.sourceforge.net/docs/ref/doctree.html#transition
-.. _version: http://docutils.sourceforge.net/docs/ref/doctree.html#version
-.. _warning: http://docutils.sourceforge.net/docs/ref/doctree.html#warning
-
Deleted: branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/images/biohazard.png
===================================================================
(Binary files differ)
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/index.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/index.rst 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/index.rst 2012-05-30 15:34:49 UTC (rev 688)
@@ -52,8 +52,10 @@
JRST prend un fichier reStructuredText_ en entrée et génère un fichier XML
qui pourra ensuite servir à produire divers formats de fichiers grâce à des fichiers
XSL de générations. Les formats de sortie disponibles sont le html, le xhtml, le rst,
-le pdf, le docbook_, le odt (Open-Office), le rtf, ou encore le XML [1]_.
+le pdf, le docbook_ ou de l'odt (Open-Office) [1]_.
+Lorsque JRST est lancé sans argument, une interface graphique est proposée à l'utilisateur. Ainsi, on peut choisir plus aisément les fichiers, le type de sortie ou bien les feuilles de style XSL externes à appliquer.
+
::
JRST myfile.rst
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/presentationRST.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/presentationRST.rst 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/rst/user/presentationRST.rst 2012-05-30 15:34:49 UTC (rev 688)
@@ -340,18 +340,18 @@
``image``.
Par exemple::
- .. image:: images/biohazard.png
+ .. image:: ../images/biohazard.png
Le résultat:
-.. image:: images/biohazard.png
+.. image:: ../images/biohazard.png
-La partie ``images/biohazard.png`` indique le chemin d'accès au fichier
+La partie ``../images/biohazard.png`` indique le chemin d'accès au fichier
de l'image qui doit apparaître. Il n'y a pas de restriction sur l'image
(format, taille etc). Si l'image doit apparaître en HTML et que vous
souhaitez lui ajouter des informations::
- .. image:: images/biohazard.png
+ .. image:: ../images/biohazard.png
:height: 100
:width: 200
:scale: 50
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/site_en.xml
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/site_en.xml 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/site_en.xml 2012-05-30 15:34:49 UTC (rev 688)
@@ -57,14 +57,12 @@
<menu name="User">
<item href="/user/index.html" name="About"/>
<item href="/user/RSTpresentation.html" name="A ReStructuredText Primer"/>
- <item href="/user/functionality.html" name="Functionalities suggested"/>
</menu>
<menu name="Developer">
<item name="Documentation" href="/devel/developerDoc.html"/>
<item name="A XSL primer" href="/devel/XSLpresentation.html"/>
<item name="Librairy used" href="/devel/library.html"/>
- <item name="Todo" href="/devel/Todo.html"/>
<item name="External documentation" href="/devel/externalDoc.html"/>
</menu>
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/site_fr.xml
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/site_fr.xml 2012-05-30 12:55:52 UTC (rev 687)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/site_fr.xml 2012-05-30 15:34:49 UTC (rev 688)
@@ -54,17 +54,15 @@
<menu ref="parent"/>
<menu name="Utilisateur">
- <item href="/user/index.html" name="Présentation du JRST"/>
+ <item href="/user/index.html" name="Présentation de JRST"/>
<item href="/user/presentationRST.html"
name="Introduction à ReStructuredText"/>
- <item href="/user/fonctionnalites.html" name="Fonctionnalités incluses"/>
</menu>
<menu name="Developpeur">
<item name="Fonctionnement" href="/devel/docDeveloppeur.html"/>
- <item name="Presentation au XSL" href="/devel/presentationXSL.html"/>
+ <item name="Presentation du XSL" href="/devel/presentationXSL.html"/>
<item name="Librairies utilisées" href="/devel/librairies.html"/>
- <item name="Todo" href="/devel/Todo.html"/>
<item name="Documentation externe" href="/devel/docExterne.html"/>
</menu>
1
0
30 May '12
Author: sletellier
Date: 2012-05-30 14:55:52 +0200 (Wed, 30 May 2012)
New Revision: 687
Url: http://nuiton.org/repositories/revision/jrst/687
Log:
Remove sdoc dependency and clean pom
Modified:
branches/jrst-docutils-jython/jrst/pom.xml
branches/jrst-docutils-jython/pom.xml
Modified: branches/jrst-docutils-jython/jrst/pom.xml
===================================================================
--- branches/jrst-docutils-jython/jrst/pom.xml 2012-05-30 10:14:27 UTC (rev 686)
+++ branches/jrst-docutils-jython/jrst/pom.xml 2012-05-30 12:55:52 UTC (rev 687)
@@ -93,26 +93,7 @@
<classifier>resources</classifier>
</dependency>
- <!-- Test librairies -->
<dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.nuiton.thirdparty</groupId>
- <artifactId>sdoc</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>runtime</scope>
@@ -123,7 +104,7 @@
<artifactId>jython-standalone</artifactId>
</dependency>
- <!-- itext -->
+ <!-- itext -->
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>core-renderer</artifactId>
@@ -136,6 +117,19 @@
<version>2.0.8</version>
</dependency>
+ <!-- Test librairies -->
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<!-- ************************************************************* -->
Modified: branches/jrst-docutils-jython/pom.xml
===================================================================
--- branches/jrst-docutils-jython/pom.xml 2012-05-30 10:14:27 UTC (rev 686)
+++ branches/jrst-docutils-jython/pom.xml 2012-05-30 12:55:52 UTC (rev 687)
@@ -214,13 +214,6 @@
</dependency>
<dependency>
- <groupId>org.nuiton.thirdparty</groupId>
- <artifactId>sdoc</artifactId>
- <version>0.5.0-beta-patchcl</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
1
0
r686 - in branches/jrst-docutils-jython/jrst/src: main/resources/xsl test/java/org/nuiton/jrst/bugs test/resources/bugs
by jpages@users.nuiton.org 30 May '12
by jpages@users.nuiton.org 30 May '12
30 May '12
Author: jpages
Date: 2012-05-30 12:14:27 +0200 (Wed, 30 May 2012)
New Revision: 686
Url: http://nuiton.org/repositories/revision/jrst/686
Log:
Cr?\195?\169ation d'une classe de test sur les mesages d'erreur.
Affichage des erreurs dans le xdoc ou html g?\195?\169n?\195?\169r?\195?\169 pour faciliter la correction de la documentation.
fixed #2117 Les messages sont maintenant pris en compte dans les feuilles xsl, ce qui permet d'afficher les messages (niveau d'erreur, ligne, description) dans les fichiers xdoc ou html.
Added:
branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/ErrorsTest.java
branches/jrst-docutils-jython/jrst/src/test/resources/bugs/testDisplayErrors.rst
Modified:
branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xhtml.xsl
Modified: branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xhtml.xsl
===================================================================
--- branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xhtml.xsl 2012-05-29 15:37:18 UTC (rev 685)
+++ branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xhtml.xsl 2012-05-30 10:14:27 UTC (rev 686)
@@ -517,5 +517,14 @@
[<xsl:value-of select="text()"/>]
</a>
</xsl:template>
-
+
+ <xsl:template match="system_message">
+ <div class="system-message" style="border: medium outset; padding: 1em;">
+ <p class="system-message-title" style="color: red; font-weight: bold;">
+ System Message: <xsl:value-of select="@type"/>/<xsl:value-of select="@level"/> (line <xsl:value-of select="@line"/>)
+ </p>
+ <xsl:value-of select="paragraph"/>
+ </div>
+ </xsl:template>
+
</xsl:stylesheet>
Added: branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/ErrorsTest.java
===================================================================
--- branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/ErrorsTest.java (rev 0)
+++ branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/ErrorsTest.java 2012-05-30 10:14:27 UTC (rev 686)
@@ -0,0 +1,38 @@
+package org.nuiton.jrst.bugs;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Test;
+import org.nuiton.jrst.JRST;
+import org.nuiton.jrst.JRSTAbstractTest;
+
+import java.io.File;
+
+/**
+ * Test about the display of warning or errors in the generated site
+ *
+ * @author jpages
+ */
+public class ErrorsTest extends JRSTAbstractTest {
+
+ /**
+ * Tests if rst warnings or errors are displayed in the generated html
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testDisplayErrors() throws Exception {
+ File in = getBugTestFile("testDisplayErrors.rst");
+ File out = getOutputTestFile("jrst-testDisplayErrors.html");
+
+ JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME);
+ String content = FileUtils.readFileToString(out, JRST.UTF_8);
+
+ assertTrue(content.contains("Explicit markup ends without a blank line; unexpected unindent."));
+ assertTrue(content.contains("Literal block ends without a blank line; unexpected unindent."));
+ assertTrue(content.contains("Inline literal start-string without end-string."));
+ assertTrue(content.contains("Duplicate target name, cannot be used as a unique reference: " +
+ "\"dossier contenant tous les fichiers nécessaires à ce plan\"."));
+ }
+}
Added: branches/jrst-docutils-jython/jrst/src/test/resources/bugs/testDisplayErrors.rst
===================================================================
--- branches/jrst-docutils-jython/jrst/src/test/resources/bugs/testDisplayErrors.rst (rev 0)
+++ branches/jrst-docutils-jython/jrst/src/test/resources/bugs/testDisplayErrors.rst 2012-05-30 10:14:27 UTC (rev 686)
@@ -0,0 +1,74 @@
+.. -
+.. * #%L
+.. * JRst :: Api
+.. *
+.. * $Id: testDisplayErrors.rst 608 2011-08-18 09:25:35Z jpages $
+.. * $HeadURL: http://svn.nuiton.org/svn/jrst/branches/jrst-docutils-jython/jrst/src/test/… $
+.. * %%
+.. * Copyright (C) 2004 - 2011 CodeLutin
+.. * %%
+.. * This program is free software: you can redistribute it and/or modify
+.. * it under the terms of the GNU Lesser General Public License as
+.. * published by the Free Software Foundation, either version 3 of the
+.. * License, or (at your option) any later version.
+.. *
+.. * This program is distributed in the hope that it will be useful,
+.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. * GNU General Lesser Public License for more details.
+.. *
+.. * You should have received a copy of the GNU General Lesser Public
+.. * License along with this program. If not, see
+.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. * #L%
+.. -
+===================
+Test display errors
+===================
+
+Testons différents types d'erreur :
+
+Saut de ligne manquant avant le "ou":
+=====================================
+
+JRST propose de transformer le XML de docutils avec des fichiers XSL externe.
+Pour cela, il faut utiliser la commande::
+
+ JRST -x fichierXSL, fichierXSL2 fichierRST
+ou::
+
+ JRST --xslFile fichierXSL, fichierXSL2 fichierRST
+
+
+Espace manquant avant "personne" :
+==================================
+
+======= =============== ===============================================
+Pattern Exemple Signification
+======= =============== ===============================================
+* * Motif "joker" désignant n'importe quel élément
+``//`` ``//``personne Indique tous les descendants d'un noeud
+. . Caractérise le noeud courant
+``..`` ``..`` Désigne le noeud parent
+======= =============== ===============================================
+
+
+Erreur causées par plusieurs liens "Dossier" :
+==============================================
+
+Plan qui modifie les regles de gestion / modifying management rules
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Sigrid V 3.3.0.8 , Plan d'analyse pour la pecherie anchois : modifie les regles
+de gestion a chaque simulation `Dossier contenant tous les fichiers nécessaires à ce plan`_
+
+.. _Dossier contenant tous les fichiers nécessaires à ce plan: ../downloads/PlanModifRules.zip
+
+Plan qui modifie regle de gestion et parametres / modify rules and parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Sigrid V 3.3.0.8 , Plan d'analyse pour la pecherie anchois : modifie les regles
+de gestion, et des parametres (equations et nb de jours d'inactivite) a chaque
+simulation `Dossier contenant tous les fichiers nécessaires à ce plan`_
+
+.. _Dossier contenant tous les fichiers nécessaires à ce plan: ../downloads/PlanRulesParam.zip
1
0
r685 - in branches/jrst-docutils-jython: doxia-module-jrst/src/main/java/org/nuiton/jrst jrst-doc/src/site/en/rst/devel
by jpages@users.nuiton.org 29 May '12
by jpages@users.nuiton.org 29 May '12
29 May '12
Author: jpages
Date: 2012-05-29 17:37:18 +0200 (Tue, 29 May 2012)
New Revision: 685
Url: http://nuiton.org/repositories/revision/jrst/685
Log:
Correction des images dans la doc anglaise et mise en commentaire de la suppression des fichiers temporaires dans JrstParser.java
Modified:
branches/jrst-docutils-jython/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstParser.java
branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/developerDoc.rst
Modified: branches/jrst-docutils-jython/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstParser.java
===================================================================
--- branches/jrst-docutils-jython/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstParser.java 2012-05-29 10:18:59 UTC (rev 684)
+++ branches/jrst-docutils-jython/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstParser.java 2012-05-29 15:37:18 UTC (rev 685)
@@ -55,12 +55,11 @@
try {
// Write the source in a file to use it with JRST
File sourceFile = File.createTempFile("source",".rst");
- sourceFile.deleteOnExit();
+ // sourceFile.deleteOnExit();
FileWriter fileWriter = new FileWriter(sourceFile);
IOUtil.copy(source, fileWriter);
// Generation of the xml file
- // Transformation to XML
Document doc = JRST.generateDocutils(sourceFile);
// Application of xsl stylesheets
Modified: branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/developerDoc.rst
===================================================================
--- branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/developerDoc.rst 2012-05-29 10:18:59 UTC (rev 684)
+++ branches/jrst-docutils-jython/jrst-doc/src/site/en/rst/devel/developerDoc.rst 2012-05-29 15:37:18 UTC (rev 685)
@@ -32,14 +32,16 @@
Class diagram
=============
-|classDiagramme|
+.. image:: ../../schemas/diagrammeGeneration.png
+ :align: center
**JRST** Class contents main() method, it's looking after options, files reading and writing. Iinitially, it calls Jython_ class **PythonInterpreter** which allows to execute DocUtils' Python script to generate an intermediate file. Then it only remains to apply the wish XSL (if needed) by using **JRSTGenerator** Class.
Generation
==========
-|diagrammeGeneration|
+.. image:: ../../schemas/classDiagramme.png
+ :align: center
Links :
@@ -74,7 +76,8 @@
This sequence diagramme describes the parser's mechanism throughout the generation :
-|sequenceDiagramme|
+.. image:: ../../schemas/diagrammeSequence.png
+ :align: center
**JRSTGenerator** Class with the XSL file rst2xhtml.xsl, returns following html file::
@@ -141,6 +144,3 @@
.. _Cascading Style Sheets: http://en.wikipedia.org/wiki/Cascading_Style_Sheets
.. _DocUtils: http://docutils.sourceforge.net/docs/ref/doctree.html
.. _Jython: http://jython.org/index.html
-.. |diagrammeGeneration| image:: images/diagrammeGeneration.png
-.. |classDiagramme| image:: images/diagrammeClass.png
-.. |sequenceDiagramme| image:: images/diagrammeSequence.png
1
0
r684 - branches/jrst-docutils-jython/jrst/src/main/resources/xsl
by jpages@users.nuiton.org 29 May '12
by jpages@users.nuiton.org 29 May '12
29 May '12
Author: jpages
Date: 2012-05-29 12:18:59 +0200 (Tue, 29 May 2012)
New Revision: 684
Url: http://nuiton.org/repositories/revision/jrst/684
Log:
Correction d'un autre probl?\195?\168me au sujet des ancres
Modified:
branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xhtml.xsl
Modified: branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xhtml.xsl
===================================================================
--- branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xhtml.xsl 2012-05-29 10:01:19 UTC (rev 683)
+++ branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xhtml.xsl 2012-05-29 10:18:59 UTC (rev 684)
@@ -143,7 +143,7 @@
</xsl:template>
<xsl:template match="section">
- <a name="{@ids}"></a>
+ <a name="{@ids}" id="{@ids}"></a>
<xsl:apply-templates/>
</xsl:template>
1
0
r683 - in branches/jrst-docutils-jython: jrst/src/main/resources/xsl src/site
by jpages@users.nuiton.org 29 May '12
by jpages@users.nuiton.org 29 May '12
29 May '12
Author: jpages
Date: 2012-05-29 12:01:19 +0200 (Tue, 29 May 2012)
New Revision: 683
Url: http://nuiton.org/repositories/revision/jrst/683
Log:
Correction des ancres dans la g?\195?\169n?\195?\169ration du html
Modified:
branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xhtml.xsl
branches/jrst-docutils-jython/src/site/site_en.xml
branches/jrst-docutils-jython/src/site/site_fr.xml
Modified: branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xhtml.xsl
===================================================================
--- branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xhtml.xsl 2012-05-29 09:02:20 UTC (rev 682)
+++ branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xhtml.xsl 2012-05-29 10:01:19 UTC (rev 683)
@@ -143,7 +143,7 @@
</xsl:template>
<xsl:template match="section">
- <a name="{@id}"></a>
+ <a name="{@ids}"></a>
<xsl:apply-templates/>
</xsl:template>
@@ -161,10 +161,10 @@
<xsl:template match="reference">
<xsl:if test="@refid">
- <a href="{@refuri}#{@refid}" id="{@id}"><xsl:apply-templates/></a>
+ <a href="{@refuri}#{@refid}" id="{@ids}"><xsl:apply-templates/></a>
</xsl:if>
<xsl:if test="not(@refid)">
- <a href="{@refuri}" id="{@id}"><xsl:apply-templates/></a>
+ <a href="{@refuri}" id="{@ids}"><xsl:apply-templates/></a>
</xsl:if>
</xsl:template>
Modified: branches/jrst-docutils-jython/src/site/site_en.xml
===================================================================
--- branches/jrst-docutils-jython/src/site/site_en.xml 2012-05-29 09:02:20 UTC (rev 682)
+++ branches/jrst-docutils-jython/src/site/site_en.xml 2012-05-29 10:01:19 UTC (rev 683)
@@ -70,9 +70,6 @@
<menu name="Language">
<item name="Français" href="../index.html"/>
<item name="English" href="index.html"/>
- <item name="Nuiton.org" href="http://nuiton.org"/>
- <item name="Code Lutin" href="http://www.codelutin.com"/>
- <item name="Libre entreprise" href="http://www.libre-entreprise.org"/>
</menu>
<menu name="Community">
Modified: branches/jrst-docutils-jython/src/site/site_fr.xml
===================================================================
--- branches/jrst-docutils-jython/src/site/site_fr.xml 2012-05-29 09:02:20 UTC (rev 682)
+++ branches/jrst-docutils-jython/src/site/site_fr.xml 2012-05-29 10:01:19 UTC (rev 683)
@@ -72,9 +72,6 @@
<menu name="Langue">
<item name="Français" href="index.html"/>
<item name="English" href="./en/index.html"/>
- <item name="Nuiton.org" href="http://nuiton.org"/>
- <item name="Code Lutin" href="http://www.codelutin.com"/>
- <item name="Libre entreprise" href="http://www.libre-entreprise.org"/>
</menu>
<menu name="Communauté">
1
0