Author: kcardineaud Date: 2011-05-27 13:59:14 +0200 (Fri, 27 May 2011) New Revision: 594 Url: http://nuiton.org/repositories/revision/jrst/594 Log: #1551 Litteral bloc into list not taken into account Added: trunk/jrst/src/test/resources/testLiteral.rst Modified: trunk/jrst/src/main/java/org/nuiton/jrst/JRSTLexer.java trunk/jrst/src/test/java/org/nuiton/jrst/JRSTReaderTest.java Modified: trunk/jrst/src/main/java/org/nuiton/jrst/JRSTLexer.java =================================================================== --- trunk/jrst/src/main/java/org/nuiton/jrst/JRSTLexer.java 2011-05-26 09:39:53 UTC (rev 593) +++ trunk/jrst/src/main/java/org/nuiton/jrst/JRSTLexer.java 2011-05-27 11:59:14 UTC (rev 594) @@ -1967,6 +1967,7 @@ Element result = null; // in.skipBlankLines(); + String line = in.readLine(); if (line != null) { Pattern pattern = Pattern @@ -2003,9 +2004,36 @@ prefix).addAttribute(SUFFIX, suffix) .addAttribute(ENUMTYPE, enumtype); + if (line.endsWith(": ::")) { + line = line.substring(0, line.length() - " ::".length()); + in.unread("::", true); + + } else if (line.endsWith("::")) { + line = line.substring(0, line.length() - ":".length()); // keep + // one + // : + in.unread("::", true); + } + + if (!in.eof()) { String[] content = readBlock(level + 1); - line += " " + joinBlock(content); + String tempLine = " " + joinBlock(content); + + if (tempLine.endsWith(": ::")) { + tempLine = tempLine.substring(0, tempLine.length() - " ::".length()); + in.unread("::", true); + + } else if (tempLine.endsWith("::")) { + tempLine = tempLine.substring(0, tempLine.length() - ":".length()); // keep + // one + // : + in.unread("::", true); + } + + line+=tempLine; + + } String text = line.substring(begin).trim(); Modified: trunk/jrst/src/test/java/org/nuiton/jrst/JRSTReaderTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/JRSTReaderTest.java 2011-05-26 09:39:53 UTC (rev 593) +++ trunk/jrst/src/test/java/org/nuiton/jrst/JRSTReaderTest.java 2011-05-27 11:59:14 UTC (rev 594) @@ -159,5 +159,26 @@ Assert.assertTrue(actualXml.contains(xmlexpected)); } + @Test + public void testLiteral() throws Exception { + URL url = JRSTReaderTest.class.getResource("/testLiteral.rst"); + Reader in = new InputStreamReader(url.openStream()); + I18n.init(new ClassPathI18nInitializer(), Locale.UK); + + JRSTReader jrst = new JRSTReader(); + Document doc = jrst.read(in); + + + String xmlexpected = + "<literal_block>refcomp.admin.email=l'email des administrateurs. Example : admin@refcomp.com"; + + String actualXml = doc.asXML(); + log.warn("Result :\n" + actualXml); + log.warn("Expected :\n" + xmlexpected); + + Assert.assertTrue(actualXml.contains(xmlexpected)); + } + + } Added: trunk/jrst/src/test/resources/testLiteral.rst =================================================================== --- trunk/jrst/src/test/resources/testLiteral.rst (rev 0) +++ trunk/jrst/src/test/resources/testLiteral.rst 2011-05-27 11:59:14 UTC (rev 594) @@ -0,0 +1,6 @@ +1. Déployer le war de l'application dans le serveur d'application. Pour Tomcat 6, + placer le war ou un lien symbolique vers celui-ci dans le répertoire webapps. + +2. Editer la configuration de base. Créez un fichier de configuration nommé:: + + refcomp.admin.email=l'email des administrateurs. Example : admin@refcomp.com \ No newline at end of file
participants (1)
-
kcardineaud@users.nuiton.org