Search in sources :

Example 11 with Template

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

the class TemplateProcessorTest method testBasicTemplateNamedParameter_DefaultValue.

public void testBasicTemplateNamedParameter_DefaultValue() {
    Template template = new Template();
    template.setName("test");
    template.setTemplateMarkup("_expanded{{{message|default value}}}_");
    markupLanguage.getTemplates().add(template);
    TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
    String markup = templateProcessor.processTemplates("one {{test}} two");
    assertEquals("one _expandeddefault value_ two", markup);
}
Also used : TemplateProcessor(org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor) Template(org.eclipse.mylyn.wikitext.mediawiki.Template)

Example 12 with Template

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

the class TemplateProcessorTest method testBasicTemplateNoParametersRecLoopDetection.

public void testBasicTemplateNoParametersRecLoopDetection() {
    // Bug 379783
    Template templateMer = new Template();
    templateMer.setName("mer");
    templateMer.setTemplateMarkup("�test{{mer}}test�");
    markupLanguage.getTemplates().add(templateMer);
    TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
    String markup = templateProcessor.processTemplates("{{mer}}");
    assertEquals("�test<span class=\"error\">Template loop detected:mer</span>test�", markup);
}
Also used : TemplateProcessor(org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor) Template(org.eclipse.mylyn.wikitext.mediawiki.Template)

Example 13 with Template

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

the class TemplateProcessorTest method testBasicTemplatePositionalParameterWithSpaces.

public void testBasicTemplatePositionalParameterWithSpaces() {
    Template template = new Template();
    template.setName("Note");
    template.setTemplateMarkup("<p class='note'>{{{1}}}</p>");
    markupLanguage.getTemplates().add(template);
    TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
    String markup = templateProcessor.processTemplates("one {{Note|comment with spaces.}} two");
    assertEquals("one <p class='note'>comment with spaces.</p> two", markup);
}
Also used : TemplateProcessor(org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor) Template(org.eclipse.mylyn.wikitext.mediawiki.Template)

Example 14 with Template

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

the class TemplateProcessorTest method testBasicTemplateWithSlashes.

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

Example 15 with Template

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

the class TemplateProcessorTest method testBasicTemplateDidgitInTheName3.

public void testBasicTemplateDidgitInTheName3() {
    // Bug 380052
    Template template = new Template();
    template.setName("foo999bar");
    template.setTemplateMarkup("foo-bar");
    markupLanguage.getTemplates().add(template);
    TemplateProcessor templateProcessor = new TemplateProcessor(markupLanguage);
    String markup = templateProcessor.processTemplates("foo{{foo999bar}}bar");
    assertEquals("foofoo-barbar", 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