
org.openfuxml.addon.wiki.model.WikiDefaultModel Maven / Gradle / Ivy
The newest version!
package org.openfuxml.addon.wiki.model;
import info.bliki.htmlcleaner.TagNode;
import info.bliki.wiki.filter.MagicWord;
import info.bliki.wiki.model.Configuration;
import info.bliki.wiki.model.WikiModel;
import java.util.Locale;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class WikiDefaultModel extends WikiModel
{
final static Logger logger = LoggerFactory.getLogger(WikiDefaultModel.class);
public final static String TL = "{{[[Template:{{{1}}}|{{{1}}}]]}}\n" + "{{pp-template|small=yes}}\n"
+ "{{documentation}}\n" + " ";
public final static String PRON_ENG = "#REDIRECT [[Template:Pron-en]]";
public final static String PRON_EN = "pronounced [[WP:IPA for English|/{{{1}}}/]] \n"
+ "\n"
+ "==Example==\n"
+ "\n"
+ "This code:\n"
+ "\n"
+ ": A battleship, {{pron-en|ˈbætəlʃɪp}}, is ...
\n"
+ "\n"
+ "will display:\n"
+ "\n"
+ ": A battleship, {{pron-en|ˈbætəlʃɪp}}, is ...\n"
+ "\n"
+ "==Usage==\n"
+ "{{usage of IPA templates}}\n"
+ "\n"
+ "\n"
+ "\n"
+ "[[Category:IPA templates|{{PAGENAME}}]]\n"
+ "\n"
+ "\n"
+ "\n"
+ "[[ar:PronEng]]\n"
+ "[[tl:Template:PronEng]]\n" + "[[simple:Template:IPA-en]]\n" + " ";
public final static String HTML_START = "\n"
+ "\n" + "\n"
+ "\n" + " <span class="hljs-string">test</span> \n\n \n" + " ";
public final static String XHTML_START = "\n"
+ "\n";
public final static String XHTML_END = "\n" + "";
public final static String PIPE_SYMBOL = "|{{template doc}} ";
public final static String DOUBLE_PARAMETER = "{{{1}}}{{{1}}}";
public final static String REFLIST_TEXT = "\n"
+ "{{pp-template|small=yes}}{{template doc}} \n";
public final static String CAT = "[[:Category:{{{1}}}]]\n"
+ "{{Interwikitmp-grp ineligible|CAT|Commons|Wiktionary}}\n" + "Creates a link to the specified category.\n" + "\n"
+ "\'\'\'Example\'\'\':\n" + "\n" + "{{Cat|stubs}}\n" + "
\n" + "{{Cat|stubs}}\n" + "\n" + "==See also==\n"
+ "* {{Tl|Cl}}\n" + "* {{Tl|Ccl}}\n" + "* {{Tl|Lcs}}\n" + "\n" + "[[sl:predloga:kat]]\n" + " \n" + "";
public final static String CITE_WEB_TEXT = "[{{{url}}} {{{title}}}]";
public final static String NESTED_TEMPLATE_TEST = "test a {{nested}} template";
public final static String NESTED = "a nested template text";
public final static String IFEQ_TEST = "{{#ifeq: {{{1}}}|{{{2}}} | {{{1}}} equals {{{2}}} | {{{1}}} is not equal {{{2}}}}}";
public final static String ENDLESS_RECURSION_TEST = " {{recursion}} ";
public final static String TNAVBAR_TEXT = "{{#if:{{{nodiv|}}}| \n" + "\n" + "{{pp-template|small=yes}}\n"
+ "
\'\'\'{{purge}}\'\'\' the Wikipedia cache of this template.
\n" + "{{documentation}} \n"
+ "\n"
+ " ";
public final static String NAVBOX_TEXT = "{{#switch:{{{border|{{{1|}}}}}}|subgroup|child=
|none=|#default=style=\"{{{bodystyle|}}};{{{style|}}}\">}}#default=collapsible {{#if:{{{state|}}}|{{{state|}}}|autocollapse}}}}}} {{#switch:{{{border|{{{1|}}}}}}|subgroup|child|none=navbox-subgroup\" style=\"width:100%;{{{bodystyle|}}};{{{style|}}}|#default=\" style=\"width:100%;background:transparent;color:inherit}};{{{innerstyle|}}};\">{{#if:{{{title|}}}|{{#if:{{{titlegroup|}}}|}}{{#if:{{{above|}}}|{{#if:{{{title|}}}|}}}}{{#if:{{{list1|}}}|{{#if:{{{title|}}}{{{above|}}}|}}{{#if:{{{imageleft|}}}|}}{{#if:{{{group1|}}}|{{#if:{{{image|}}}|}}}}{{#if:{{{list2|}}}|{{#if:{{{title|}}}{{{above|}}}{{{list1|}}}|}}{{#if:{{{group2|}}}|}}{{#if:{{{list3|}}}|{{#if:{{{title|}}}{{{above|}}}{{{list1|}}}{{{list2|}}}|}}{{#if:{{{group3|}}}|}}{{#if:{{{list4|}}}|{{#if:{{{group4|}}}|}}{{#if:{{{list5|}}}|{{#if:{{{group5|}}}|}}{{#if:{{{list6|}}}|{{#if:{{{group6|}}}|}}{{#if:{{{list7|}}}|{{#if:{{{group7|}}}|}}{{#if:{{{list8|}}}|{{#if:{{{group8|}}}|}}{{#if:{{{list9|}}}|{{#if:{{{group9|}}}|}}{{#if:{{{list10|}}}|{{#if:{{{group10|}}}|}}{{#if:{{{list11|}}}|{{#if:{{{group11|}}}|}}{{#if:{{{list12|}}}|{{#if:{{{group12|}}}|}}{{#if:{{{list13|}}}|{{#if:{{{group13|}}}|}}{{#if:{{{list14|}}}|{{#if:{{{group14|}}}|}}{{#if:{{{list15|}}}|{{#if:{{{group15|}}}|}}{{#if:{{{list16|}}}|{{#if:{{{group16|}}}|}}{{#if:{{{list17|}}}|{{#if:{{{group17|}}}|}}{{#if:{{{list18|}}}|{{#if:{{{group18|}}}|}}{{#if:{{{list19|}}}|{{#if:{{{group19|}}}|}}{{#if:{{{list20|}}}|{{#if:{{{group20|}}}|}}{{#if:{{{below|}}}|{{#if:{{{title|}}}{{{above|}}}{{{list1|}}}{{{list2|}}}{{{list3|}}}|}}}}{{{titlegroup|}}} colspan={{#expr:2{{#if:{{{imageleft|}}}|+1}}{{#if:{{{image|}}}|+1}}{{#if:{{{titlegroup|}}}|-1}}}} class=\"navbox-title\">{{#if:{{#switch:{{{navbar|}}}|plain|off=1}}{{#if:{{{name|}}}||{{#switch:{{{border|{{{1|}}}}}}|subgroup|child|none=1}}}}|{{#ifeq:{{{navbar|}}}|off|{{#ifeq:{{{state|}}}|plain| }}|{{#ifeq:{{{state|}}}|plain|| }}}}|{{Tnavbar|{{{name}}}|fontstyle={{{basestyle|}}};{{{titlestyle|}}};border:none;|mini=1}}{{#ifeq:{{{state|}}}|plain| }}}}{{{title}}} colspan=\"{{#expr:2{{#if:{{{imageleft|}}}|+1}}{{#if:{{{image|}}}|+1}}}}\">{{{above}}} rowspan={{#expr:1{{#if:{{{list2|}}}|+2}}{{#if:{{{list3|}}}|+2}}{{#if:{{{list4|}}}|+2}}{{#if:{{{list5|}}}|+2}}{{#if:{{{list6|}}}|+2}}{{#if:{{{list7|}}}|+2}}{{#if:{{{list8|}}}|+2}}{{#if:{{{list9|}}}|+2}}{{#if:{{{list10|}}}|+2}}{{#if:{{{list11|}}}|+2}}{{#if:{{{list12|}}}|+2}}{{#if:{{{list13|}}}|+2}}{{#if:{{{list14|}}}|+2}}{{#if:{{{list15|}}}|+2}}{{#if:{{{list16|}}}|+2}}{{#if:{{{list17|}}}|+2}}{{#if:{{{list18|}}}|+2}}{{#if:{{{list19|}}}|+2}}{{#if:{{{list20|}}}|+2}}}}>{{{imageleft|}}} {{{group1}}} width:100%;padding:0px;{{{liststyle|}}};{{{oddstyle|}}};{{{list1style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|even|{{{evenodd|odd}}}}}\">}}{{{list1|}}}{{#if:{{{list1|}}}| rowspan={{#expr:1{{#if:{{{list2|}}}|+2}}{{#if:{{{list3|}}}|+2}}{{#if:{{{list4|}}}|+2}}{{#if:{{{list5|}}}|+2}}{{#if:{{{list6|}}}|+2}}{{#if:{{{list7|}}}|+2}}{{#if:{{{list8|}}}|+2}}{{#if:{{{list9|}}}|+2}}{{#if:{{{list10|}}}|+2}}{{#if:{{{list11|}}}|+2}}{{#if:{{{list12|}}}|+2}}{{#if:{{{list13|}}}|+2}}{{#if:{{{list14|}}}|+2}}{{#if:{{{list15|}}}|+2}}{{#if:{{{list16|}}}|+2}}{{#if:{{{list17|}}}|+2}}{{#if:{{{list18|}}}|+2}}{{#if:{{{list19|}}}|+2}}{{#if:{{{list20|}}}|+2}}}}>{{{image|}}} {{{group2}}} width:100%;padding:0px;{{{liststyle|}}};{{{evenstyle|}}};{{{list2style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|odd|{{{evenodd|even}}}}}\">}}{{{list2|}}}{{#if:{{{list2|}}}| {{{group3}}} width:100%;padding:0px;{{{liststyle|}}};{{{oddstyle|}}};{{{list3style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|even|{{{evenodd|odd}}}}}\">}}{{{list3|}}}{{#if:{{{list3|}}}| {{{group4}}} width:100%;padding:0px;{{{liststyle|}}};{{{evenstyle|}}};{{{list4style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|odd|{{{evenodd|even}}}}}\">}}{{{list4|}}}{{#if:{{{list4|}}}| {{{group5}}} width:100%;padding:0px;{{{liststyle|}}};{{{oddstyle|}}};{{{list5style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|even|{{{evenodd|odd}}}}}\">}}{{{list5|}}}{{#if:{{{list5|}}}| {{{group6}}} width:100%;padding:0px;{{{liststyle|}}};{{{evenstyle|}}};{{{list6style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|odd|{{{evenodd|even}}}}}\">{{{list6|}}} {{{group7}}} width:100%;padding:0px;{{{liststyle|}}};{{{oddstyle|}}};{{{list7style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|even|{{{evenodd|odd}}}}}\">{{{list7|}}} {{{group8}}} width:100%;padding:0px;{{{liststyle|}}};{{{evenstyle|}}};{{{list8style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|odd|{{{evenodd|even}}}}}\">{{{list8|}}} {{{group9}}} width:100%;padding:0px;{{{liststyle|}}};{{{oddstyle|}}};{{{list9style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|even|{{{evenodd|odd}}}}}\">{{{list9|}}} {{{group10}}} width:100%;padding:0px;{{{liststyle|}}};{{{evenstyle|}}};{{{list10style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|odd|{{{evenodd|even}}}}}\">{{{list10|}}} {{{group11}}} width:100%;padding:0px;{{{liststyle|}}};{{{oddstyle|}}};{{{list11style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|even|{{{evenodd|odd}}}}}\">{{{list11|}}} {{{group12}}} width:100%;padding:0px;{{{liststyle|}}};{{{evenstyle|}}};{{{list12style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|odd|{{{evenodd|even}}}}}\">{{{list12|}}} {{{group13}}} width:100%;padding:0px;{{{liststyle|}}};{{{oddstyle|}}};{{{list13style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|even|{{{evenodd|odd}}}}}\">{{{list13|}}} {{{group14}}} width:100%;padding:0px;{{{liststyle|}}};{{{evenstyle|}}};{{{list14style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|odd|{{{evenodd|even}}}}}\">{{{list14|}}} {{{group15}}} width:100%;padding:0px;{{{liststyle|}}};{{{oddstyle|}}};{{{list15style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|even|{{{evenodd|odd}}}}}\">{{{list15|}}} {{{group16}}} width:100%;padding:0px;{{{liststyle|}}};{{{evenstyle|}}};{{{list16style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|odd|{{{evenodd|even}}}}}\">{{{list16|}}} {{{group17}}} width:100%;padding:0px;{{{liststyle|}}};{{{oddstyle|}}};{{{list17style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|even|{{{evenodd|odd}}}}}\">{{{list17|}}} {{{group18}}} width:100%;padding:0px;{{{liststyle|}}};{{{evenstyle|}}};{{{list18style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|odd|{{{evenodd|even}}}}}\">{{{list18|}}} {{{group19}}} width:100%;padding:0px;{{{liststyle|}}};{{{oddstyle|}}};{{{list19style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|even|{{{evenodd|odd}}}}}\">{{{list19|}}} {{{group20}}} width:100%;padding:0px;{{{liststyle|}}};{{{evenstyle|}}};{{{list20style|}}}\" class=\"navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|odd|{{{evenodd|even}}}}}\">{{{list20|}}} colspan=\"{{#expr:2{{#if:{{{imageleft|}}}|+1}}{{#if:{{{image|}}}|+1}}}}\">{{{below}}}
{{#switch:{{{border|{{{1|}}}}}}|subgroup|child=|none=|#default=
}}\n" + "\n" + "{{pp-template|small=yes}}\n" + "\n" + "{{documentation}}\n"
+ "\n" + " ";
public final static String INFOBOX_SOFTWARE_TEXT = "{| class=\"infobox\" cellspacing=\"5\" style=\"width: 21em; font-size: 90%; text-align: left;\"\n"
+ "! colspan=\"2\" style=\"text-align: center; font-size: 130%;\" | {{{title|{{{name|{{PAGENAME}}}}}}}}\n"
+ "|-\n"
+ "{{#if:{{{logo|}}}|\n"
+ "{{!}} colspan=\"2\" style=\"text-align: center;\" {{!}} {{{logo|}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{collapsible|}}}|\n"
+ "{{!}} colspan=\"2\" {{!}}\n"
+ "{{hidden|Screenshot|{{{screenshot}}}{{#if:{{{caption|}}}|
{{{caption|}}}}}|bg1=#ccccff|ta2=center}}\n"
+ "{{!}}-\n"
+ "|\n"
+ "{{#if:{{{screenshot|}}}|\n"
+ "{{!}} colspan=\"2\" style=\"text-align: center;\" {{!}} {{{screenshot|}}}{{#if:{{{caption|}}}|
{{{caption|}}}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "}}\n"
+ "{{#if:{{{author|}}}|\n"
+ "! [[Software design|Design by]]\n"
+ "{{!}} {{{author|}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{developer|}}}|\n"
+ "! [[Software developer|Developed by]]\n"
+ "{{!}} {{{developer|}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{released|}}}|\n"
+ "! Initial release\n"
+ "{{!}} {{{released|}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{frequently updated|{{{frequently_updated|}}}}}}|\n"
+ "{{#ifexist:Template:Latest stable release/{{{name|{{PAGENAME}}}}}|\n"
+ "! [[Software release|Stable release]]\n"
+ "{{!}} {{Latest stable release/{{{name|{{PAGENAME}}}}}}} [[{{SERVER}}{{localurl:Template:Latest_stable_release/{{{name|{{PAGENAME}}}}}|action=edit&preload=Template:LSR/syntax}} +/−]]\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#ifexist:Template:Latest preview release/{{{name|{{PAGENAME}}}}}|\n"
+ "! [[Software release|Preview release]]\n"
+ "{{!}} {{Latest preview release/{{{name|{{PAGENAME}}}}}}} [[{{SERVER}}{{localurl:Template:Latest_preview_release/{{{name|{{PAGENAME}}}}}|action=edit&preload=Template:LPR/syntax}} +/−]]\n"
+ "{{!}}-\n"
+ "}}\n"
+ "|\n"
+ "{{#if:{{{latest release version|{{{latest_release_version|}}}}}}|\n"
+ "! [[Software release life cycle|Latest release]]\n"
+ "{{!}} {{{latest release version|{{{latest_release_version|}}}}}} {{#if:{{{latest release date|{{{latest_release_date|}}}}}}| / {{{latest release date|{{{latest_release_date|}}}}}}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{latest preview version|{{{latest_preview_version|}}}}}}|\n"
+ "! [[Software release life cycle|Preview release]]\n"
+ "{{!}} {{{latest preview version|{{{latest_preview_version|}}}}}} {{#if:{{{latest preview date|{{{latest_preview_date|}}}}}}| / {{{latest preview date|{{{latest_preview_date|}}}}}}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "}}\n"
+ "{{#if:{{{programming language|{{{programming_language|}}}}}}|\n"
+ "! [[Programming language|Written in]]\n"
+ "{{!}} {{{programming language|{{{programming_language|}}}}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{operating system|{{{operating_system|}}}}}}|\n"
+ "! [[Operating system|OS]]\n"
+ "{{!}} {{{operating system|{{{operating_system}}}}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{platform|}}}|\n"
+ "! [[Platform (computing)|Platform]]\n"
+ "{{!}} {{{platform|}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{size|}}}|\n"
+ "! [[File size|Size]]\n"
+ "{{!}} {{{size|}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{language|}}}|\n"
+ "! [[Language|Available in]]\n"
+ "{{!}} {{{language|}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{status|}}}|\n"
+ "! Development status\n"
+ "{{!}} {{{status|}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{genre|}}}|\n"
+ "! [[List of software categories|Genre]]\n"
+ "{{!}} {{{genre|}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{license|}}}|\n"
+ "! [[Software license|License]]\n"
+ "{{!}} {{{license|}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{licence|}}}|\n"
+ "! [[Software license|Licence]]\n"
+ "{{!}} {{{licence|}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{website|}}}|\n"
+ "! [[Website]]\n"
+ "{{!}} {{{website|}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{standard|}}}|\n"
+ "! [[Standard]](s)\n"
+ "{{!}} {{{standard|}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "{{#if:{{{AsOf|}}}|\n"
+ "! As of\n"
+ "{{!}} {{{AsOf|}}}\n"
+ "{{!}}-\n"
+ "}}\n"
+ "|} \n"
+ "{{pp-template|small=yes}}\n"
+ "{{documentation}}\n"
+ "\n" + " ";
final static String FURTHER = ":''{{{altphrase|Further information}}}: {{#if:{{{1|}}} |{{{1}}} |'''Error: [[Template:Further|Template must be given at least one article name]]''' \n"
+ "}}{{#if:{{{2|}}}|{{#if:{{{3|}}}|, | and }} {{{2}}}\n" + "}}{{#if:{{{3|}}}|{{#if:{{{4|}}}|, |, and }} {{{3}}}\n"
+ "}}{{#if:{{{4|}}}|{{#if:{{{5|}}}|, |, and }} {{{4}}}\n" + "}}{{#if:{{{5|}}}|, and {{{5}}}\n"
+ "}}{{#if:{{{6|}}}| — '''
Error: [[Template:Futher|Too many links specified (maximum is 5)]]'''\n"
+ "}}'' \n" + "{{template doc}} ";
boolean fSemanticWebActive;
static {
TagNode.addAllowedAttribute("style");
}
public WikiDefaultModel(String imageBaseURL, String linkBaseURL)
{
this(Locale.ENGLISH, imageBaseURL, linkBaseURL);
}
/**
* Add German namespaces to the wiki model
*
* @param imageBaseURL
* @param linkBaseURL
*/
public WikiDefaultModel(Locale locale, String imageBaseURL, String linkBaseURL) {
super(Configuration.DEFAULT_CONFIGURATION, locale, imageBaseURL, linkBaseURL);
fSemanticWebActive = false;
}
/**
* Add templates: "Test", "Templ1", "Templ2",
* "Include Page"
*
*/
@Override
public String getRawWikiContent(String namespace, String articleName, Map map) {
String result = super.getRawWikiContent(namespace, articleName, map);
if (result != null) {
return result;
}
String name = encodeTitleToUrl(articleName, true);
if (isTemplateNamespace(namespace))
{
if (MagicWord.isMagicWord(articleName))
{
logger.warn("API of BLIKI has changed, this needs to be cheked!");
//TODO OFX-14
//return MagicWord.processMagicWord(articleName, this);
}
if (name.equals("Reflist")) {
return REFLIST_TEXT;
} else if (name.equals("!")) {
return PIPE_SYMBOL;
} else if (name.equals("2x")) {
return DOUBLE_PARAMETER;
} else if (name.equals("Cat")) {
return CAT;
} else if (name.equals("!")) {
return "|{{template doc}} ";
} else if (name.equals("Infobox_Software")) {
return INFOBOX_SOFTWARE_TEXT;
} else if (name.equals("Cite_web")) {
return CITE_WEB_TEXT;
} else if (name.equals("Navbox")) {
return NAVBOX_TEXT;
} else if (name.equals("Tnavbar")) {
return TNAVBAR_TEXT;
} else if (name.equals("Nested_tempplate_test")) {
return NESTED_TEMPLATE_TEST;
} else if (name.equals("Nested")) {
return NESTED;
} else if (name.equals("Recursion")) {
return ENDLESS_RECURSION_TEST;
} else if (name.equals("Test")) {
return "a) First: {{{1}}} Second: {{{2}}}";
} else if (name.equals("Templ1")) {
return "b) First: {{{a}}} Second: {{{2}}}";
} else if (name.equals("Templ2")) {
return "c) First: {{{1}}} Second: {{{2}}}";
} else if (name.equals("Ifeq")) {
return IFEQ_TEST;
} else if (name.equals("Further")) {
return FURTHER;
} else if (name.equals("Tl")) {
return TL;
} else if (name.equals("PronEng")) {
return PRON_ENG;
} else if (name.equals("Pron-en")) {
return PRON_EN;
}
} else {
if (name.equals("Include_Page")) {
return "an include page";
}
}
return null;
}
/**
* Set the German image namespace
*/
@Override
public String getImageNamespace()
{
return "Bild";
}
@Override
public boolean isImageNamespace(String name)
{
return super.isImageNamespace(name) || name.equals(getImageNamespace());
}
@Override
public boolean isSemanticWebActive() {
return fSemanticWebActive;
}
@Override
public void setSemanticWebActive(boolean semanticWeb) {
this.fSemanticWebActive = semanticWeb;
}
public boolean showSyntax(String tagName) {
// if (tagName.equals("groovy")) {
// return false;
// }
return true;
}
@Override
public String render(String rawWikiText) {
String xhtmlArtifact = super.render(rawWikiText);
// byte[] bytes;
// try {
// String xhtml = HTML_START + xhtmlArtifact + XHTML_END;
//
// bytes = xhtml.getBytes("UTF-8");
//
// InputStream in = new ByteArrayInputStream(bytes);
// Parser parser = new Parser();
// HTMLSchema schema = new HTMLSchema();
// parser.setProperty(Parser.schemaProperty, schema);
// Writer w = new StringWriter();
// XMLWriter x = new XMLWriter(w);
// x.setOutputProperty(XMLWriter.METHOD, "xml");
// x.setOutputProperty(XMLWriter.OMIT_XML_DECLARATION, "yes");
// // x.setPrefix(schema.getURI(), "");
//
// parser.setFeature(Parser.namespacesFeature, false);
// parser.setFeature(Parser.defaultAttributesFeature, true);
// parser.setContentHandler(x);
// InputSource is = new InputSource(in);
// is.setEncoding("UTF-8");
// parser.parse(is);
// XhtmlValidator validator = new XhtmlValidator();
// xhtml = w.toString();
// bytes = (XHTML_START + xhtml).getBytes("UTF-8");
// in = new ByteArrayInputStream(bytes);
// validator.isValid(in);
// String[] errors = validator.getErrors();
// if (errors.length > 0) {
// System.out.println(">>>>>");
// for (int i = 0; i < errors.length; i++) {
// System.out.println(errors[i]);
// }
// // junit.framework.Assert.assertEquals("", errors[0]);
// System.out.println(xhtml);
// System.out.println("<<<<<");
// }
// return xhtmlArtifact;
// } catch (IOException e) {
// e.printStackTrace();
// } catch (SAXException e) {
// e.printStackTrace();
// // } catch (UnsupportedEncodingException e) {
// // e.printStackTrace();
// }
return xhtmlArtifact;
}
/**
* Test for Discussion:
* Hide Table of Contents (toc)?
*/
// public ITableOfContent createTableOfContent(boolean isTOCIdentifier) {
// if (fToCSet == null) {
// fToCSet = new HashSet();
// fTableOfContent = new ArrayList