Search in sources :

Example 6 with TemplateProcessor

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

the class TemplateProcessorTest method testBasicTemplateNoNamespace.

public void testBasicTemplateNoNamespace() {
    // Bug 468237
    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 7 with TemplateProcessor

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

the class TemplateProcessorTest method testBasicTemplateNoInclude.

public void testBasicTemplateNoInclude() {
    Template template = new Template();
    template.setName("test");
    template.setTemplateMarkup("<noinclude>foo bar baz\n</noinclude>_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 8 with TemplateProcessor

use of org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor 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 9 with TemplateProcessor

use of org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor 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 10 with TemplateProcessor

use of org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor 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)

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