use of org.eclipse.mylyn.wikitext.mediawiki.Template in project mylyn.docs by eclipse.
the class TemplateProcessorTest method testBasicTemplateIncludeonly.
public void testBasicTemplateIncludeonly() {
Template template = new Template();
template.setName("test");
template.setTemplateMarkup("foo bar baz\n<includeonly>_expanded_</includeonly>");
markupLanguage.getTemplates().add(template);
TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
String markup = templateProcessor.processTemplates("one {{test}} two");
assertEquals("one _expanded_ two", markup);
}
use of org.eclipse.mylyn.wikitext.mediawiki.Template in project mylyn.docs by eclipse.
the class TemplateProcessorTest method testBasicTemplateExcluded.
public void testBasicTemplateExcluded() {
Template template = new Template();
template.setName("test");
template.setTemplateMarkup("_expanded_");
markupLanguage.getTemplates().add(template);
markupLanguage.setTemplateExcludes("boo, baz, test");
TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
String markup = templateProcessor.processTemplates("one {{test}} two");
assertEquals("one two", markup);
}
use of org.eclipse.mylyn.wikitext.mediawiki.Template in project mylyn.docs by eclipse.
the class TemplateProcessorTest method testCaseSensitivity.
public void testCaseSensitivity() {
// bug 323224
final Set<String> templateNames = new HashSet<String>();
markupLanguage.getTemplateProviders().add(new TemplateResolver() {
@Override
public Template resolveTemplate(String templateName) {
templateNames.add(templateName);
Template template = new Template();
template.setName(templateName);
template.setTemplateMarkup("test");
return template;
}
});
String[] names = new String[] { "One", "one", "OneTwo", "onetwo", "oneTwo" };
for (String name : names) {
templateNames.clear();
TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
templateProcessor.processTemplates("content {{" + name + "}} more");
assertContains(templateNames, name);
assertEquals(1, templateNames.size());
}
}
use of org.eclipse.mylyn.wikitext.mediawiki.Template in project mylyn.docs by eclipse.
the class TemplateProcessorTest method testBasicTemplatePositionalParameter.
public void testBasicTemplatePositionalParameter() {
Template template = new Template();
template.setName("test");
template.setTemplateMarkup("_expanded{{{1}}}and{{{2}}}and{{{1}}}_");
markupLanguage.getTemplates().add(template);
TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
String markup = templateProcessor.processTemplates("one {{test|one|two}} two");
assertEquals("one _expandedoneandtwoandone_ two", markup);
}
use of org.eclipse.mylyn.wikitext.mediawiki.Template in project mylyn.docs by eclipse.
the class TemplateProcessorTest method testBasicTemplateNamedParameterMissingValue.
public void testBasicTemplateNamedParameterMissingValue() {
Template template = new Template();
template.setName("test");
template.setTemplateMarkup("_expanded{{{message}}}_");
markupLanguage.getTemplates().add(template);
TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
String markup = templateProcessor.processTemplates("one {{test}} two");
assertEquals("one _expanded_ two", markup);
}
Aggregations