Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 110097 Details for
Bug 244017
Hyperlinking support for Trac should handle disabled (escaped) links.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
a patch that fixes the regex and adds a JUnit
trac-escape-wikilink.patch (text/plain), 5.03 KB, created by
David Green
on 2008-08-15 11:27:05 EDT
(
hide
)
Description:
a patch that fixes the regex and adds a JUnit
Filename:
MIME Type:
Creator:
David Green
Created:
2008-08-15 11:27:05 EDT
Size:
5.03 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.trac.ui >Index: src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtil.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtil.java,v >retrieving revision 1.16 >diff -u -r1.16 TracHyperlinkUtil.java >--- src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtil.java 13 Jun 2008 10:33:42 -0000 1.16 >+++ src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtil.java 15 Aug 2008 15:25:48 -0000 >@@ -28,6 +28,7 @@ > * Utility class for detecting Trac hyperlinks. > * > * @author Steffen Pingel >+ * @author David Green fix for bug 244017 > */ > public class TracHyperlinkUtil { > >@@ -55,7 +56,7 @@ > > static Pattern wikiPattern1 = Pattern.compile("wiki:(\\w+)"); > >- static Pattern wikiPattern2 = Pattern.compile("[A-Z][a-z0-9]+[A-Z]\\w*"); >+ static Pattern wikiPattern2 = Pattern.compile("(?<=[^\\!])[A-Z][a-z0-9]+[A-Z]\\w*"); > > static Pattern milestonePattern = Pattern.compile("milestone:([\\w\\.]+)"); > >@@ -146,8 +147,8 @@ > if (isInRegion(lineOffset, m)) { > String rev = m.group(1); > String stopRev = m.group(2); >- String url = repository.getRepositoryUrl() + ITracClient.REVISION_LOG_URL + "?rev=" + rev + "&stop_rev=" >- + stopRev; >+ String url = repository.getRepositoryUrl() + ITracClient.REVISION_LOG_URL + "?rev=" + rev >+ + "&stop_rev=" + stopRev; > links.add(new WebHyperlink(determineRegion(regionOffset, m), url)); > } > } >@@ -157,8 +158,8 @@ > if (isInRegion(lineOffset, m)) { > String rev = m.group(1); > String stopRev = m.group(2); >- String url = repository.getRepositoryUrl() + ITracClient.REVISION_LOG_URL + "?rev=" + rev + "&stop_rev=" >- + stopRev; >+ String url = repository.getRepositoryUrl() + ITracClient.REVISION_LOG_URL + "?rev=" + rev >+ + "&stop_rev=" + stopRev; > links.add(new WebHyperlink(determineRegion(regionOffset, m), url)); > } > } >@@ -244,8 +245,8 @@ > while (m.find()) { > if (isInRegion(lineOffset, m)) { > String page = m.group(1); >- links.add(new WebHyperlink(determineRegion(regionOffset, m), repository.getRepositoryUrl() + ITracClient.WIKI_URL >- + page)); >+ links.add(new WebHyperlink(determineRegion(regionOffset, m), repository.getRepositoryUrl() >+ + ITracClient.WIKI_URL + page)); > } > } > >@@ -253,8 +254,8 @@ > while (m.find()) { > if (isInRegion(lineOffset, m)) { > String page = m.group(0); >- links.add(new WebHyperlink(determineRegion(regionOffset, m), repository.getRepositoryUrl() + ITracClient.WIKI_URL >- + page)); >+ links.add(new WebHyperlink(determineRegion(regionOffset, m), repository.getRepositoryUrl() >+ + ITracClient.WIKI_URL + page)); > } > } > >#P org.eclipse.mylyn.trac.tests >Index: src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtilTest.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtilTest.java >diff -N src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtilTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtilTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,49 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.trac.ui; >+ >+import java.util.regex.Matcher; >+ >+import junit.framework.TestCase; >+ >+/** >+ * >+ * @author David Green >+ */ >+public class TracHyperlinkUtilTest extends TestCase { >+ public void testWikiPattern2SinglePositiveMatch() { >+ Matcher matcher = TracHyperlinkUtil.wikiPattern2.matcher("a HyperLink there"); >+ assertTrue(matcher.find()); >+ assertEquals(matcher.group(0), "HyperLink"); >+ assertFalse(matcher.find()); >+ } >+ >+ public void testWikiPattern2MultiplePositiveMatch() { >+ Matcher matcher = TracHyperlinkUtil.wikiPattern2.matcher("a HyperLink there and ThereIsAnother"); >+ assertTrue(matcher.find()); >+ assertEquals(matcher.group(0), "HyperLink"); >+ assertTrue(matcher.find()); >+ assertEquals(matcher.group(0), "ThereIsAnother"); >+ assertFalse(matcher.find()); >+ } >+ >+ public void testWikiPattern2SingleNegativeMatch() { >+ Matcher matcher = TracHyperlinkUtil.wikiPattern2.matcher("no !HyperLink there"); >+ assertFalse(matcher.find()); >+ } >+ >+ public void testWikiPattern2MixedPositiveNegativeMatch() { >+ Matcher matcher = TracHyperlinkUtil.wikiPattern2.matcher("a HyperLink there and ThereIsAnother but !NotHere"); >+ assertTrue(matcher.find()); >+ assertEquals(matcher.group(0), "HyperLink"); >+ assertTrue(matcher.find()); >+ assertEquals(matcher.group(0), "ThereIsAnother"); >+ assertFalse(matcher.find()); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 244017
:
109954
| 110097 |
110098
|
110120
|
110121