summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremie Bresson2012-09-27 11:09:34 (EDT)
committer David Green2012-10-11 15:41:54 (EDT)
commit4528dc34d99f3ae1e2d5115a07dda4e791e2c298 (patch)
treead18e73531fbfc81cd3751c69f9a00f469334e2f
parent6a1422a20c46daa5138887cac5bca224593a5548 (diff)
downloadorg.eclipse.mylyn.docs-4528dc34d99f3ae1e2d5115a07dda4e791e2c298.zip
org.eclipse.mylyn.docs-4528dc34d99f3ae1e2d5115a07dda4e791e2c298.tar.gz
org.eclipse.mylyn.docs-4528dc34d99f3ae1e2d5115a07dda4e791e2c298.tar.bz2
Bug 367525: MediaWiki to Eclipse Help does not honour templateExcludesrefs/changes/04/7804/3
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=367525 Change-Id: I97f8832a16f2af51a0458714220093bfc2171bdb
-rw-r--r--org.eclipse.mylyn.wikitext.mediawiki.core/src/org/eclipse/mylyn/internal/wikitext/mediawiki/core/TemplateProcessor.java2
-rw-r--r--org.eclipse.mylyn.wikitext.tests/src/org/eclipse/mylyn/wikitext/mediawiki/core/MediaWikiLanguageTest.java24
2 files changed, 25 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.wikitext.mediawiki.core/src/org/eclipse/mylyn/internal/wikitext/mediawiki/core/TemplateProcessor.java b/org.eclipse.mylyn.wikitext.mediawiki.core/src/org/eclipse/mylyn/internal/wikitext/mediawiki/core/TemplateProcessor.java
index 0f97f3e..2d8b42c 100644
--- a/org.eclipse.mylyn.wikitext.mediawiki.core/src/org/eclipse/mylyn/internal/wikitext/mediawiki/core/TemplateProcessor.java
+++ b/org.eclipse.mylyn.wikitext.mediawiki.core/src/org/eclipse/mylyn/internal/wikitext/mediawiki/core/TemplateProcessor.java
@@ -28,7 +28,7 @@ import org.eclipse.mylyn.wikitext.mediawiki.core.TemplateResolver;
public class TemplateProcessor {
- private static final Pattern templatePattern = Pattern.compile("(?:^|(?<!\\{))(\\{\\{(#?[a-zA-Z0-9_ :]+)\\s*(\\|[^\\}]*)?\\}\\})"); //$NON-NLS-1$
+ private static final Pattern templatePattern = Pattern.compile("(?:^|(?<!\\{))(\\{\\{(#?[a-zA-Z0-9_ :\\.\\-]+)\\s*(\\|[^\\}]*)?\\}\\})"); //$NON-NLS-1$
private static final Pattern templateParameterPattern = Pattern.compile("\\{\\{\\{([a-zA-Z0-9]+)(?:\\|([^\\}]*))?\\}\\}\\}"); //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.wikitext.tests/src/org/eclipse/mylyn/wikitext/mediawiki/core/MediaWikiLanguageTest.java b/org.eclipse.mylyn.wikitext.tests/src/org/eclipse/mylyn/wikitext/mediawiki/core/MediaWikiLanguageTest.java
index e52f2f6..f18faa2 100644
--- a/org.eclipse.mylyn.wikitext.tests/src/org/eclipse/mylyn/wikitext/mediawiki/core/MediaWikiLanguageTest.java
+++ b/org.eclipse.mylyn.wikitext.tests/src/org/eclipse/mylyn/wikitext/mediawiki/core/MediaWikiLanguageTest.java
@@ -988,6 +988,30 @@ public class MediaWikiLanguageTest extends TestCase {
assertTrue(html.contains("<p>a and and 3 and </p>"));
}
+ public void testTemplateExcludesComplexNames() {
+ //Bug 367525
+ markupLanguage.setTemplateExcludes("#eclipseproject:technology.linux-distros");
+ markupLanguage.setTemplates(Arrays.asList(new Template("#eclipseproject:technology.linux-distros",
+ "! Not excluded - !")));
+ String html = parser.parseToHtml("foo {{#eclipseproject:technology.linux-distros}} bar");
+
+ TestUtil.println("HTML: \n" + html);
+
+ assertTrue(html.contains("<p>foo bar</p>"));
+ }
+
+ public void testTemplateExcludesRegEx() {
+ //Bug 367525
+ markupLanguage.setTemplateExcludes("*eclipseproject*, Linux_Tools");
+ markupLanguage.setTemplates(Arrays.asList(new Template("Linux_Tools", "!Not excluded - Linux_Tools!"),
+ new Template("#eclipseproject:technology.linux-distros", "!Not excluded - eclipseproject!")));
+ String html = parser.parseToHtml("foo {{#eclipseproject:technology.linux-distros}} bar {{Linux_Tools}} baz");
+
+ TestUtil.println("HTML: \n" + html);
+
+ assertTrue(html.contains("<p>foo bar baz</p>"));
+ }
+
public void testTableOfContents() throws IOException {
String html = parser.parseToHtml("= Table Of Contents =\n\n__TOC__\n\n= Top Header =\n\nsome text\n\n== Subhead ==\n\n== Subhead2 ==\n\n= Top Header 2 =\n\n== Subhead 3 ==\n\n=== Subhead 4 ===");