Search in sources :

Example 1 with TemplateProcessor

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

the class TemplateProcessorTest method testBasicTemplateNamedParameter_EmptyDefaultValue.

public void testBasicTemplateNamedParameter_EmptyDefaultValue() {
    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);
}
Also used : TemplateProcessor(org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor) Template(org.eclipse.mylyn.wikitext.mediawiki.Template)

Example 2 with TemplateProcessor

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

the class TemplateProcessorTest method testBasicTemplatePositionalParameter_DefaultValue.

public void testBasicTemplatePositionalParameter_DefaultValue() {
    Template template = new Template();
    template.setName("test");
    template.setTemplateMarkup("_expanded{{{1|first}}}and{{{2|second}}}_");
    markupLanguage.getTemplates().add(template);
    TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
    String markup = templateProcessor.processTemplates("one {{test}} two");
    assertEquals("one _expandedfirstandsecond_ two", markup);
}
Also used : TemplateProcessor(org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor) Template(org.eclipse.mylyn.wikitext.mediawiki.Template)

Example 3 with TemplateProcessor

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

the class TemplateProcessorTest method testBasicTemplateExcludedWithWildcards.

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

Example 4 with TemplateProcessor

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

the class TemplateProcessorTest method testBasicTemplateWithBrackets.

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

Example 5 with TemplateProcessor

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

the class TemplateProcessorTest method testBasicTemplateDidgitInTheName.

public void testBasicTemplateDidgitInTheName() {
    // Bug 380052
    Template template = new Template();
    template.setName("1stTest");
    template.setTemplateMarkup("first test");
    markupLanguage.getTemplates().add(template);
    TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
    String markup = templateProcessor.processTemplates("This is a {{1stTest}}.");
    assertEquals("This is a first test.", 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