use of org.eclipse.mylyn.wikitext.mediawiki.Template in project mylyn.docs by eclipse.
the class TemplateProcessorTest method testBasicTemplatesNoParametersRecLoopDetection.
public void testBasicTemplatesNoParametersRecLoopDetection() {
// Bug 379783
Template template1 = new Template();
template1.setName("rec_a");
template1.setTemplateMarkup("+ rec_a {{rec_b}} rec_a +");
markupLanguage.getTemplates().add(template1);
Template template2 = new Template();
template2.setName("rec_b");
template2.setTemplateMarkup("+ rec_b {{rec_c}} rec_b +");
markupLanguage.getTemplates().add(template2);
Template template3 = new Template();
template3.setName("rec_c");
template3.setTemplateMarkup("+ rec_c {{rec_a}} rec_c +");
markupLanguage.getTemplates().add(template3);
TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
String markup = templateProcessor.processTemplates("{{rec_a}}");
assertEquals("+ rec_a + rec_b + rec_c <span class=\"error\">Template loop detected:rec_a</span> rec_c + rec_b + rec_a +", markup);
}
use of org.eclipse.mylyn.wikitext.mediawiki.Template in project mylyn.docs by eclipse.
the class TemplateProcessorTest method testBasicTemplatesNoParametersRec.
public void testBasicTemplatesNoParametersRec() {
// Bug 379783
Template templateFoo = new Template();
templateFoo.setName("foo");
templateFoo.setTemplateMarkup("_{{bar}}expanded_");
markupLanguage.getTemplates().add(templateFoo);
Template templateBar = new Template();
templateBar.setName("bar");
templateBar.setTemplateMarkup("+exp+");
markupLanguage.getTemplates().add(templateBar);
TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
String markup = templateProcessor.processTemplates("one {{foo}} two");
assertEquals("one _+exp+expanded_ two", markup);
}
use of org.eclipse.mylyn.wikitext.mediawiki.Template in project mylyn.docs by eclipse.
the class WikiTemplateResolverTest method testResolveTemplateDefault.
public void testResolveTemplateDefault() {
Template template = resolver.resolveTemplate("bug");
assertNotNull(template);
assertEquals("bug", template.getName());
assertEquals(BUG_TEMPLATE_CONTENT, template.getTemplateMarkup().trim());
}
Aggregations