public class MagicWord extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MagicWord.MagicWordE
Type of storing user contributions in the DB.
|
| Modifier and Type | Field and Description |
|---|---|
protected static HashMap<String,MagicWord.MagicWordE> |
MAGIC_WORDS
Magic words in lower case.
|
| Constructor and Description |
|---|
MagicWord() |
| Modifier and Type | Method and Description |
|---|---|
protected static String |
getBasePageName(String parameter,
IWikiModel model)
Gets the base page name of a given non-null parameter or the
current model's pagename and namespace.
|
protected static String |
getFullpagename(String parameter,
IWikiModel model)
Gets the full page's name of a given non-null parameter or the
current model's pagename and namespace.
|
static MagicWord.MagicWordE |
getMagicWord(String name)
Determine if a template name corresponds to a magic word requiring
special handling.
|
protected static String |
getNamespace(String parameter,
IWikiModel model)
Helper to get the namespace of either a given non-null parameter
or the current model's namespace.
|
protected static INamespace.INamespaceValue |
getNamespaceHelper(String parameter,
IWikiModel model)
Helper to get the namespace of either a given non-null parameter
or the current model's namespace.
|
protected static String |
getPagenameHelper(String parameter,
IWikiModel model)
Helper to get the pagename (excluding the namespace) of either a given
non-null parameter or the current model's pagename.
|
protected static String[] |
getPagenameHelper2(String parameter,
IWikiModel model)
Helper to get the pagename and the namespace of either a given non-
null parameter or the current model's pagename and namespace.
|
protected static String |
getSubjectpage(String parameter,
IWikiModel model)
Gets the talkpage's name of a given non-null parameter or the
current model's pagename and namespace.
|
protected static String |
getSubjectSpace(String parameter,
IWikiModel model)
Gets the subject/articlespace of a given non-null parameter
or the current model's namespace.
|
protected static String |
getSubPageName(String parameter,
IWikiModel model)
Gets the sub page name of a given non-null parameter or the
current model's pagename and namespace.
|
protected static String |
getTalkpage(String parameter,
IWikiModel model)
Gets the talkpage's name of a given non-null parameter or the
current model's pagename and namespace.
|
protected static String |
getTalkspace(String parameter,
IWikiModel model)
Gets the talkspace of a given non-null parameter
or the current model's namespace.
|
static boolean |
isMagicWord(String name)
Determine if a template name corresponds to a magic word requiring special
handling.
|
static String |
processMagicWord(MagicWord.MagicWordE magicWord,
String parameter,
IWikiModel model)
Process a magic word, returning the value corresponding to the magic word
value.
|
protected static final HashMap<String,MagicWord.MagicWordE> MAGIC_WORDS
{{CURRENTYEAR}} {{currentyear}} {{Currentyear}}
return the current year,
{{CURRENTYeAR}} {{cURRENTYEAR}} don't.
The following variations of {{SERVERNAME}} however all return the server name:
{{SERVERNAME}} {{SERVeRNAMe}} {{sERVERNAME}} {{servername}} {{Servername}}
Therefore, tolerate any case here and use lower-case in this hashmap.public static boolean isMagicWord(String name)
name - the potential magic wordpublic static MagicWord.MagicWordE getMagicWord(String name)
name - the potential magic wordMagicWord.MagicWordE, otherwise nullpublic static String processMagicWord(MagicWord.MagicWordE magicWord, String parameter, IWikiModel model)
magicWord - the magic word to processparameter - the parameter of the magic word (may be null if no parameter supplied)model - the wiki model to use while renderingprotected static String getSubPageName(String parameter, IWikiModel model)
parameter - the parameter of the magic wordmodel - the model being usedprotected static String getBasePageName(String parameter, IWikiModel model)
parameter - the parameter of the magic wordmodel - the model being usedprotected static String getFullpagename(String parameter, IWikiModel model)
parameter - the parameter of the magic word (may be null)model - the model being usedprotected static String getSubjectpage(String parameter, IWikiModel model)
parameter - the parameter of the magic word (may be null)model - the model being usedprotected static String getTalkpage(String parameter, IWikiModel model)
parameter - the parameter of the magic word (may be null)model - the model being usedprotected static String getTalkspace(String parameter, IWikiModel model)
parameter - the parameter of the magic word (may be null)model - the model being usedprotected static String getSubjectSpace(String parameter, IWikiModel model)
parameter - the parameter of the magic word (may be null)model - the model being usedprotected static String getNamespace(String parameter, IWikiModel model)
parameter - the parameter of the magic word (may be null)model - the model being usedprotected static INamespace.INamespaceValue getNamespaceHelper(String parameter, IWikiModel model)
parameter - the parameter of the magic word (may be null)model - the model being usedprotected static String getPagenameHelper(String parameter, IWikiModel model)
parameter - the parameter of the magic word (may be null)model - the model being usedprotected static String[] getPagenameHelper2(String parameter, IWikiModel model)
parameter - the parameter of the magic word (may be null)model - the model being usedCopyright © 2017 Java Wikipedia API (Bliki engine). All rights reserved.