Search in sources :

Example 16 with Template

use of org.eclipse.mylyn.wikitext.mediawiki.Template in project mylyn.docs by eclipse.

the class WikiTemplateResolverTest method testResolveTemplateOtherNamespace.

public void testResolveTemplateOtherNamespace() {
    Template template = resolver.resolveTemplate("Other:Test");
    assertNotNull(template);
    assertEquals("Other:Test", template.getName());
    assertEquals(OTHER_TEMPLATE_CONTENT, template.getTemplateMarkup().trim());
}
Also used : Template(org.eclipse.mylyn.wikitext.mediawiki.Template)

Example 17 with Template

use of org.eclipse.mylyn.wikitext.mediawiki.Template in project mylyn.docs by eclipse.

the class WikiTemplateResolverTest method testResolveTemplateNoNamespace.

public void testResolveTemplateNoNamespace() {
    Template template = resolver.resolveTemplate(":Test");
    assertNotNull(template);
    assertEquals(TEST_TEMPLATE_CONTENT, template.getTemplateMarkup().trim());
}
Also used : Template(org.eclipse.mylyn.wikitext.mediawiki.Template)

Example 18 with Template

use of org.eclipse.mylyn.wikitext.mediawiki.Template in project mylyn.docs by eclipse.

the class TemplateProcessorTest method testBasicTemplateQualifiedName.

public void testBasicTemplateQualifiedName() {
    Template template = new Template();
    template.setName("Test:test");
    template.setTemplateMarkup("_expanded_");
    markupLanguage.getTemplates().add(template);
    TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
    String markup = templateProcessor.processTemplates("one {{Test:test}} two");
    assertEquals("one _expanded_ two", markup);
}
Also used : TemplateProcessor(org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor) Template(org.eclipse.mylyn.wikitext.mediawiki.Template)

Example 19 with Template

use of org.eclipse.mylyn.wikitext.mediawiki.Template in project mylyn.docs by eclipse.

the class TemplateProcessorTest method testBasicTemplateNoParameters.

public void testBasicTemplateNoParameters() {
    Template template = new Template();
    template.setName("test");
    template.setTemplateMarkup("_expanded_");
    markupLanguage.getTemplates().add(template);
    TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
    String markup = templateProcessor.processTemplates("one {{test}} two");
    assertEquals("one _expanded_ two", markup);
}
Also used : TemplateProcessor(org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor) Template(org.eclipse.mylyn.wikitext.mediawiki.Template)

Example 20 with Template

use of org.eclipse.mylyn.wikitext.mediawiki.Template in project mylyn.docs by eclipse.

the class TemplateProcessorTest method testBasicTemplateOtherNamespace.

public void testBasicTemplateOtherNamespace() {
    // Bug 468237
    Template template = new Template();
    template.setName("Other:Test");
    template.setTemplateMarkup("_expanded_");
    markupLanguage.getTemplates().add(template);
    TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
    String markup = templateProcessor.processTemplates("one {{Other:Test}} two");
    assertEquals("one _expanded_ two", markup);
}
Also used : TemplateProcessor(org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor) Template(org.eclipse.mylyn.wikitext.mediawiki.Template)

Aggregations

Template (org.eclipse.mylyn.wikitext.mediawiki.Template)33 TemplateProcessor (org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor)27 HashSet (java.util.HashSet)2 TemplateResolver (org.eclipse.mylyn.wikitext.mediawiki.TemplateResolver)2 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1