Search in sources :

Example 16 with TemplateProcessor

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

the class TemplateProcessorTest method testBasicTemplateNamedParameterMultiple.

public void testBasicTemplateNamedParameterMultiple() {
    Template template = new Template();
    template.setName("test");
    template.setTemplateMarkup("_expanded{{{message}}}and{{{message2}}}_");
    markupLanguage.getTemplates().add(template);
    TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
    String markup = templateProcessor.processTemplates("one {{test|message=foo bar|message2=baz}} two");
    assertEquals("one _expandedfoo barandbaz_ two", markup);
}
Also used : TemplateProcessor(org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor) Template(org.eclipse.mylyn.wikitext.mediawiki.Template)

Example 17 with TemplateProcessor

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

the class TemplateProcessorTest method testBasicTemplateDidgitInTheName2.

public void testBasicTemplateDidgitInTheName2() {
    // Bug 380052
    Template template = new Template();
    template.setName("Item2");
    template.setTemplateMarkup("second item");
    markupLanguage.getTemplates().add(template);
    TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
    String markup = templateProcessor.processTemplates("This is the {{Item2}}.");
    assertEquals("This is the second item.", markup);
}
Also used : TemplateProcessor(org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor) Template(org.eclipse.mylyn.wikitext.mediawiki.Template)

Example 18 with TemplateProcessor

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

the class TemplateProcessorTest method testTemplateRepeated.

public void testTemplateRepeated() {
    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 {{test}}");
    assertEquals("one _expanded_ two _expanded_", markup);
}
Also used : TemplateProcessor(org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor) Template(org.eclipse.mylyn.wikitext.mediawiki.Template)

Example 19 with TemplateProcessor

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

the class TemplateProcessorTest method testBasicTemplateExcluded2.

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

Example 20 with TemplateProcessor

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

the class TemplateProcessorTest method testBasicTemplateNamedParameter.

public void testBasicTemplateNamedParameter() {
    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|message=foo bar}} two");
    assertEquals("one _expandedfoo bar_ two", markup);
}
Also used : TemplateProcessor(org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor) Template(org.eclipse.mylyn.wikitext.mediawiki.Template)

Aggregations

TemplateProcessor (org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor)28 Template (org.eclipse.mylyn.wikitext.mediawiki.Template)27 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 MediaWikiLanguage (org.eclipse.mylyn.wikitext.mediawiki.MediaWikiLanguage)1 TemplateResolver (org.eclipse.mylyn.wikitext.mediawiki.TemplateResolver)1