r550 - in trunk/jrst/src: main/java/org/nuiton/jrst test/java/org/nuiton/jrst/bugs test/resources/bugs
Author: echatellier Date: 2011-03-07 17:42:04 +0100 (Mon, 07 Mar 2011) New Revision: 550 Url: http://nuiton.org/repositories/revision/jrst/550 Log: #1290 : Can't use | character un table cell Added: trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TableTest.java trunk/jrst/src/test/resources/bugs/testTable1290.rst Modified: trunk/jrst/src/main/java/org/nuiton/jrst/JRSTLexer.java Modified: trunk/jrst/src/main/java/org/nuiton/jrst/JRSTLexer.java =================================================================== --- trunk/jrst/src/main/java/org/nuiton/jrst/JRSTLexer.java 2011-03-07 16:23:50 UTC (rev 549) +++ trunk/jrst/src/main/java/org/nuiton/jrst/JRSTLexer.java 2011-03-07 16:42:04 UTC (rev 550) @@ -1412,6 +1412,9 @@ if ("".equals(content)) { content = tmpcontent; } + else { + content += tmpcontent; + } if (start == -1) { start = tmpstart; } @@ -1421,7 +1424,6 @@ cell.addAttribute(CELL_END, "false"); } else { cell = (Element) row.node(cellNumber); - } cell.addAttribute(CELL_INDEX_START, String .valueOf(start)); @@ -1433,7 +1435,11 @@ content = ""; } else { // start = tmpstart; + if (start == -1) { + start = tmpstart; + } content += tmpcontent + "|"; + cellNumber--; } } done = true; Added: trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TableTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TableTest.java (rev 0) +++ trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TableTest.java 2011-03-07 16:42:04 UTC (rev 550) @@ -0,0 +1,65 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * 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% + */ + +package org.nuiton.jrst.bugs; + +import java.io.File; + +import junit.framework.Assert; + +import org.apache.commons.io.FileUtils; +import org.junit.Test; +import org.nuiton.jrst.JRST; + +/** + * Test concernant les tables en général. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class TableTest { + + /** + * Test que la présence d'un caractères | ne fait pas planter + * la generation des tables. + * + * @throws Exception + */ + @Test + public void testTableSpecialChar() throws Exception { + File in = new File("src/test/resources/bugs/testTable1290.rst"); + File out = File.createTempFile("jrst-tables", ".html"); + out.deleteOnExit(); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + + String content = FileUtils.readFileToString(out); + System.out.println(content); + Assert.assertTrue(content.indexOf("Annee|Trait|Espece") > 0); + Assert.assertTrue(content.indexOf("Fatal") > 0); + } +} Property changes on: trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TableTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jrst/src/test/resources/bugs/testTable1290.rst =================================================================== --- trunk/jrst/src/test/resources/bugs/testTable1290.rst (rev 0) +++ trunk/jrst/src/test/resources/bugs/testTable1290.rst 2011-03-07 16:42:04 UTC (rev 550) @@ -0,0 +1,10 @@ +Test Tables +=========== + ++-----------------------------------------------------------------------------+----------+ +| Vérifications | Niveau | ++=============================================================================+==========+ +| Vérification que pour chaque espèce présent dans un trait d'une année | Fatal | +| dans le fichier tailles (noté Annee|Trait|Espece) il y a une donnée | | +| dans le fichier captures (le contraire n'est pas vraie) | | ++-----------------------------------------------------------------------------+----------+
participants (1)
-
echatellier@users.nuiton.org