r631 - in trunk/jrst/src: main/java/org/nuiton/jrst test/java/org/nuiton/jrst/bugs
Author: jruchaud Date: 2011-12-09 15:52:16 +0100 (Fri, 09 Dec 2011) New Revision: 631 Url: http://nuiton.org/repositories/revision/jrst/631 Log: #1847 Changement de la regexp pour autoriser les urls relatives dans les embedded links Modified: trunk/jrst/src/main/java/org/nuiton/jrst/ReStructuredText.java trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TextTest.java Modified: trunk/jrst/src/main/java/org/nuiton/jrst/ReStructuredText.java =================================================================== --- trunk/jrst/src/main/java/org/nuiton/jrst/ReStructuredText.java 2011-11-29 17:40:40 UTC (rev 630) +++ trunk/jrst/src/main/java/org/nuiton/jrst/ReStructuredText.java 2011-12-09 14:52:16 UTC (rev 631) @@ -22,22 +22,6 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ -/* *##% JRst - * Copyright (C) 2004 - 2008 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>. ##%*/ package org.nuiton.jrst; @@ -205,7 +189,7 @@ public static final Pattern REGEX_REFERENCE = Pattern .compile("(https?://[-/%#[\\&&&[^(>)]]\\._\\w:]+\\w+)((\\W|&|$)+)"); public static final Pattern REGEX_INLINE_REFERENCE = Pattern - .compile("`(.+?) \\<\\;(https?://[-/%#&\\._\\w:[^ ]]+)(\\>\\;)`_"); + .compile("`(.+?) \\<\\;((https?://)?[-/%#&\\._\\w:[^ ]]+)(\\>\\;)`_"); public static final Pattern REGEX_EMAIL = Pattern .compile("(^|[^_\\w])([-\\._\\w]+@[-\\._\\w]+)([^-\\._\\w]|$)"); public static final Pattern REGEX_FOOTNOTE_REFERENCE = Pattern Modified: trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TextTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TextTest.java 2011-11-29 17:40:40 UTC (rev 630) +++ trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TextTest.java 2011-12-09 14:52:16 UTC (rev 631) @@ -141,4 +141,22 @@ assertTrue(content.indexOf("echapement de lien1_") > 0); assertTrue(content.indexOf("echapement de *.txt") > 0); } + + /** + * Test embedded links + */ + @Test + public void testEmbededURIs() throws Exception { + File in = getBugTestFile("testEmbeddedURIs.rst"); + File out = getOutputTestFile("jrst-testEmbeddedURIs.html"); + + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + + String content = FileUtils.readFileToString(out); + assertTrue(content.contains("href=\"http://www.python.org\"")); + assertTrue(content.contains("href=\"./python\"")); + assertTrue(content.contains("href=\"http://www.rfc-editor.org/rfc/rfc2396.txt\"")); + assertTrue(content.contains("href=\"http://www.rfc-editor.org/rfc/rfc2732.txt\"")); + } + }
participants (1)
-
jruchaud@users.nuiton.org