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/r... $ +.. * %% +.. * 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