public abstract class AbstractWikiModel extends Object implements IWikiModel, IContext
IConfiguration.Casing| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Object> |
attributes
Map an attribute name to its value(s).
|
protected int |
fExternalLinksCounter |
protected Locale |
fLocale |
protected INamespace |
fNamespace |
protected String |
fNamespaceName |
protected boolean |
fNoToc |
protected String |
fPageTitle |
protected boolean |
fParameterParsingMode |
protected int |
fRecursionLevel |
protected String |
fRedirectLink |
protected Map<String,Integer> |
fReferenceNames |
protected ArrayList<Reference> |
fReferences |
protected int |
fSectionCounter |
protected TagStack |
fTagStack |
protected int |
fTemplateRecursionCount |
protected Map<String,Counter> |
fTemplates |
protected boolean |
fTemplateTopic |
protected HashSet<String> |
fToCSet
Contains all anchor strings to create unique anchors
|
protected org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
AbstractWikiModel() |
AbstractWikiModel(Configuration configuration) |
AbstractWikiModel(Configuration configuration,
Locale locale) |
AbstractWikiModel(Configuration configuration,
Locale locale,
INamespace namespace) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCategory(String categoryName,
String sortKey)
When an article contains a token indicating that the article belongs to a
specific category this method should be called to add that category to
the output metadata.
|
SourceCodeFormatter |
addCodeFormatter(String key,
SourceCodeFormatter value)
Add a new
source code formatter
to the configuration
|
void |
addInclude(String pageName)
When a document contains a token indicating that the document includes an
other Wiki page, i.e.
|
String |
addInterwikiLink(String key,
String value)
Add another Interwiki link to the configuration.
|
void |
addLink(String topicName)
When a document contains a token indicating that the document links to
another Wiki topic this method should be called to add that topic link to
the output metadata.
|
boolean |
addSemanticAttribute(String attribute,
String attributeValue)
See Semantic
MediaWiki for more information.
|
boolean |
addSemanticRelation(String relation,
String relationValue)
See Semantic
MediaWiki for more information.
|
void |
addTemplate(String template)
When a document contains a token indicating that the document includes a
Wiki template this method should be called to add that template to the
output metadata.
|
ITemplateFunction |
addTemplateFunction(String key,
ITemplateFunction value)
Add a new interwiki
link to the configuration
|
TagToken |
addTokenTag(String key,
TagToken value)
Add a new
HTML styled tag to the configuration
|
String[] |
addToReferences(String reference,
String nameAttribute)
Add a reference (i.e.
|
protected void |
addToTableOfContent(List<Object> toc,
SectionHeader strPair,
int headLevel)
Add a section header with the given
headLevel to the
"table of content" |
void |
append(BaseToken contentNode)
Append the content as a child on the top node of the internal stack
|
void |
appendExternalImageLink(String imageSrc,
String imageAltText)
Append an external wiki image link (starting with http, https,...
|
void |
appendExternalLink(String uriSchemeName,
String link,
String linkName,
boolean withoutSquareBrackets)
Append an external link (starting with http, https, ftp,...) as described
in Help
Links
|
ITableOfContent |
appendHead(String rawHead,
int headLevel,
boolean noToC,
int headCounter,
int startPosition,
int endPosition)
Append a new head to the table of content
|
void |
appendInternalImageLink(String hrefImageLink,
String srcImageLink,
ImageFormat imageFormat)
Append this internal wiki image link.
|
void |
appendInternalLink(String topic,
String hashSection,
String topicDescription,
String cssClass,
boolean parseRecursive)
Append an internal wikilink as described in Help Links
|
void |
appendInterWikiLink(String namespace,
String title,
String linkText)
Append an InterWiki link
|
void |
appendISBNLink(String isbnPureText)
Append an external ISBN link (starting with
ISBN ) as
described in Wikipedia:ISBN
Note: The default implementation in the AbstractWikiModel class creates a link to Amazon.com. |
void |
appendMailtoLink(String link,
String linkName,
boolean withoutSquareBrackets)
Append an external link (starting with mailto:...) as described in Help:Wikitext#Links
|
boolean |
appendRawNamespaceLinks(String rawNamespaceTopic,
String viewableLinkDescription,
boolean containsNoPipe)
Check if the topic is a special namespace topic.
|
boolean |
appendRawWikipediaLink(String rawLinkText,
String suffix)
Main entry method for parsing a raw wiki link (i.e.
|
boolean |
appendRedirectLink(String redirectLink)
Append the redirect link to the model
|
void |
appendSignature(Appendable writer,
int numberOfTildes)
Append the user signature to the writer (i.e.
|
void |
appendStack(TagStack stack)
Append the given tag stack to the current tag stack of the model.
|
void |
buildEditLinkUrl(int section)
Build the link to edit a section of the wikipedia article
|
IConfiguration.Casing |
casing() |
AbstractWikipediaParser |
createNewInstance(String rawWikitext)
Create a new parser instance
|
ScribuntoEngine |
createScribuntoEngine() |
ITableOfContent |
createTableOfContent(boolean isTOCIdentifier)
Create the "table of content" placeholder
|
int |
decrementRecursionLevel()
Decrement the current recursion level of the parser.
|
int |
decrementTemplateRecursionLevel()
Decrement the current template recursion level of the temlate parser.
|
String |
encodeTitleDotUrl(String wikiTitle,
boolean firstCharacterAsUpperCase)
Encode the wiki links title into a URL for HTML hyperlinks (i.e.
|
String |
encodeTitleToUrl(String wikiTitle,
boolean firstCharacterAsUpperCase)
Encode the wiki links title into a URL for HTML hyperlinks (i.e.
|
Object |
getAttribute(String attribute)
Resolve an attribute reference.
|
AttributeRenderer |
getAttributeRenderer(Class<?> attributeClassType)
What renderer is registered for this attributeClassType for this
template.
|
Map<String,SourceCodeFormatter> |
getCodeFormatterMap()
Get the source code formatter map of built-in source code formatters
|
Date |
getCurrentTimeStamp()
Get the current time stamp.
|
Frame |
getFrame() |
String |
getImageBaseURL()
Return a URL string which contains a "${image}" variable, which
will be replaced by the image name, to create links to images.
|
InterWikiMap |
getInterwikiMap()
Get the
interwiki links
map for converting interwiki links into external URLs.
|
Locale |
getLocale()
Get the locale of this model.
|
MagicWord.MagicWordE |
getMagicWord(String name)
Gets the magic word object for the given string.
|
String |
getNamespaceName()
Get the namespace name of this model for the current locale.
|
int |
getNextNumber()
Get the next unique number
|
TagToken |
getNode(int offset)
Get the node at the given offset on the internal stack For example
getNode(fWikiModel.stackSize() - 2) returns the node before
the node at top of the stack. |
String |
getPageName()
Get the title of the current wiki article.
|
String |
getRawWikiContent(ParsedPageName parsedPagename,
Map<String,String> templateParameters)
Get the raw wiki text for the given namespace and article name
|
int |
getRecursionLevel()
Get the current recursion level of the parser.
|
String |
getRedirectLink()
Get the redirect link.
|
List<Reference> |
getReferences()
Get the internal list of references (i.e.
|
ResourceBundle |
getResourceBundle()
Get the resource bundle associated with this model for I18N support
|
List<SemanticAttribute> |
getSemanticAttributes()
Get the list of SemanticAttributes
|
List<SemanticRelation> |
getSemanticRelations()
Get the list of SemanticRelations.
|
SimpleDateFormat |
getSimpleDateFormat()
Get a simple date formatter.
|
ITableOfContent |
getTableOfContent()
Get the parsed "table of content" data after parsing the
Wikipedia text.
|
Map<String,String> |
getTemplateCallsCache()
Get the currently configured cache implementation for template calls.
|
ITemplateFunction |
getTemplateFunction(String name)
Get a template parser function (i.e.
|
Map<String,ITemplateFunction> |
getTemplateMap()
Get the template
parser functions map of built-in template functions
|
Map<String,TagToken> |
getTokenMap()
Get the HTML
styled tag map for built-in tags
|
Set<String> |
getUriSchemeSet()
Get the set of all allowed URI scheme shortcuts like http, https, ftp,...
|
String |
getWikiBaseEditURL()
Return a URL string which contains, a "${title}" variable which
will be replaced by the topic title, to create links edit pages of wiki
topics.
|
String |
getWikiBaseURL()
Return a URL string which contains, a "${title}" variable which
will be replaced by the topic title, to create links to other wiki
topics.
|
IEventListener |
getWikiListener()
Get the current defined wiki listener
|
int |
incrementRecursionLevel()
Increment the current recursion level of the parser.
|
int |
incrementTemplateRecursionLevel()
Increment the current recursion level of the template parser.
|
protected void |
initialize() |
boolean |
isCamelCaseEnabled()
Checks if CamelCase
words should also be used as wiki links.
|
boolean |
isEditorMode()
The current model is used to render a wikipage in editor mode
|
boolean |
isInterWiki(String namespace)
Check if the given namespace is an interwiki link prefix.
|
boolean |
isMathtranRenderer()
|
boolean |
isNamespace(String namespace)
Check if the given namespace is a namespace in this model
|
boolean |
isNoToc()
Check if the rendering of the "table of contents" is disabled
globally.
|
boolean |
isParameterParsingMode()
The current model currently renders a template parameter value
|
boolean |
isPreviewMode()
The current model is used to render a wikipage in preview mode
|
boolean |
isSemanticWebActive()
Allow the parsing of semantic mediawiki (SMW) links.
|
boolean |
isTemplateTopic()
Determine if the currently parsed wiki text is a template.
|
boolean |
isValidUriScheme(String uriScheme)
Check if the top level URI (Uniform Resource Identifier) scheme name is
valid in this model.
|
boolean |
isValidUriSchemeSpecificPart(String uriScheme,
String uriSchemeSpecificPart)
Check if the scheme-specific part for a given top level URI (Uniform
Resource Identifier) scheme name is valid in this model.
|
boolean |
parseBehaviorSwitch(String identifier)
Parse a behavior switch (i.e.
|
void |
parseEvents(IEventListener listener,
String rawWikiText)
Parse the raw Wikipedia text and notify the listener
|
String |
parseTemplates(String rawWikiText)
Parse the templates in a raw wikipedia text into a resulting wikipedia
text.
|
String |
parseTemplates(String rawWikiText,
boolean parseOnlySignature)
Parse the templates in a raw wikipedia text into a resulting wikipedia
text.
|
TagToken |
peekNode()
Get the current TagNode on top of the internal stack
|
TagToken |
popNode()
Pop the current TagNode from top of the internal stack
|
boolean |
pushNode(TagToken node)
Push the given TagNode on top of the internal stack
|
protected void |
rawSetAttribute(Map<String,Object> attributes,
String name,
Object value)
Map a value to a named attribute.
|
void |
reduceTokenStack(TagToken node)
Reduce the current token stack until an allowed parent is at the top of
the stack
|
void |
registerRenderer(Class<?> attributeClassType,
AttributeRenderer renderer)
Register a renderer for all objects of a particular type.
|
String |
render(ITextConverter converter,
String rawWikiText)
Render the raw Wikipedia text into a string for a given converter
|
void |
render(ITextConverter converter,
String rawWikiText,
Appendable buf,
boolean templateTopic,
boolean parseTemplates)
Render the raw Wikipedia text into a string for a given converter
|
String |
render(ITextConverter converter,
String rawWikiText,
boolean templateTopic)
Render the raw Wikipedia text into a string for a given converter
|
String |
render(String rawWikiText)
Render the raw Wikipedia text into an HTML string and use the default
HTMLConverter
|
String |
render(String rawWikiText,
boolean templateTopic)
Render the raw Wikipedia text into an HTML string and use the default
HTMLConverter
|
String |
renderPDF(String rawWikiText)
Render the raw Wikipedia text into an HTML string and use the default
PDFConverter.
|
boolean |
replaceColon()
Replace a colon ':' with a slash '/' in wiki names (i.e.
|
void |
setAttribute(String name,
Object value)
Set an attribute for this template.
|
void |
setAttributeRenderers(Map<Class<?>,Object> renderers)
Specify a complete map of what object classes should map to which
renderer objects.
|
protected void |
setDefaultThumbWidth(ImageFormat imageFormat)
Set the default thumb format width.
|
void |
setFrame(Frame frame) |
void |
setNamespaceName(String namespaceLowercase)
Set the "lower-case" namespace name of the article rendered with this
model.
|
void |
setNoToc(boolean disableToc)
Set to
true if the rendering of the "table of
contents" should be disabled globally. |
void |
setPageName(String pageTitle)
Set the title of the currently rendered page data.
|
void |
setParameterParsingMode(boolean parameterParsingMode)
Activate the mode for rendering a template parameter value
|
void |
setSemanticWebActive(boolean semanticWeb)
Activate the parsing of semantic Mediawiki (SMW) links See Semantic
MediaWiki for more information.
|
void |
setTemplateCallsCache(Map<String,String> map)
Set a cache map implementation.
|
void |
setUp()
Prepare or initialize the wiki model before rendering the wikipedia text
|
boolean |
showSyntax(String tagName)
Show the syntax highlighting of the source code
|
String[] |
splitNsTitle(String fullTitle)
Splits the given full title into its namespace and page title components
and normalises both components using
Encoder#normaliseTitle(String, boolean, char) keeping
underscores. |
int |
stackSize()
The size of the internal stack
|
void |
substituteTemplateCall(String templateName,
Map<String,String> parameterMap,
Appendable writer)
Substitute the template name by the template content and parameters and
append the new content to the writer.
|
TagStack |
swapStack(TagStack stack) |
void |
tearDown()
Clean up (i.e.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCategories, getLinks, getNamespace, parseInternalImageLinkprotected org.slf4j.Logger logger
protected int fRecursionLevel
protected int fTemplateRecursionCount
protected TagStack fTagStack
protected Locale fLocale
protected final INamespace fNamespace
protected String fRedirectLink
protected String fPageTitle
protected String fNamespaceName
protected int fSectionCounter
protected boolean fTemplateTopic
protected boolean fParameterParsingMode
protected boolean fNoToc
protected int fExternalLinksCounter
protected Map<String,Object> attributes
public AbstractWikiModel()
public AbstractWikiModel(Configuration configuration)
public AbstractWikiModel(Configuration configuration, Locale locale)
public AbstractWikiModel(Configuration configuration, Locale locale, INamespace namespace)
public void addCategory(String categoryName, String sortKey)
IWikiModelsortKey see also Wikipedia:Categorization#Category_sortingaddCategory in interface IWikiModelcategoryName - The name of the category that the document belongs to.sortKey - The sort key for the category, or null if no sort
key has been specified. The sort key determines what order
categories are sorted on category index pages, so a category
for "John Doe" might be given a sort key of "Doe, John".public SourceCodeFormatter addCodeFormatter(String key, SourceCodeFormatter value)
IConfigurationaddCodeFormatter in interface IConfigurationpublic String addInterwikiLink(String key, String value)
IConfiguration$1 placeholder for the used wiki article
link.addInterwikiLink in interface IConfigurationkey - the prefix used in the interwiki link (i.e. [[prefix:...]] )value - the external link which should be generated from the interwiki
linkpublic void addLink(String topicName)
IWikiModeladdLink in interface IWikiModeltopicName - The name of the topic that is linked to.public boolean addSemanticAttribute(String attribute, String attributeValue)
IWikiModeladdSemanticAttribute in interface IWikiModelpublic boolean addSemanticRelation(String relation, String relationValue)
IWikiModeladdSemanticRelation in interface IWikiModelpublic void addTemplate(String template)
IWikiModeladdTemplate in interface IWikiModeltemplate - The name of the template that is being included (excluding the
template namespace).public void addInclude(String pageName)
IWikiModeladdInclude in interface IWikiModelpageName - The name of the page that is being included (including its
namespace).IWikiModel.addTemplate(String)public ITemplateFunction addTemplateFunction(String key, ITemplateFunction value)
IConfigurationaddTemplateFunction in interface IConfigurationpublic TagToken addTokenTag(String key, TagToken value)
IConfigurationaddTokenTag in interface IConfigurationpublic String[] addToReferences(String reference, String nameAttribute)
IWikiModeladdToReferences in interface IWikiModelreference - the rendered HTML code of the ref-Tag bodynameAttribute - the value of the name attribute or
nullprotected void addToTableOfContent(List<Object> toc, SectionHeader strPair, int headLevel)
headLevel to the
"table of content"toc - the "table of content list"strPair - a new section headerheadLevel - the level of the new section headerpublic void append(BaseToken contentNode)
IWikiModelappend in interface IWikiModelpublic void appendExternalImageLink(String imageSrc, String imageAltText)
IWikiModelappendExternalImageLink in interface IWikiModelpublic void appendExternalLink(String uriSchemeName, String link, String linkName, boolean withoutSquareBrackets)
appendExternalLink in interface IWikiModeluriSchemeName - the top level URI (Uniform Resource Identifier) scheme name
(without the following colon character ":"). Example "ftp",
"http", "https". See URI schemelink - the external link with
https://, https:// or ftp:// prefixlinkName - the link name which is separated from the URL by a spacewithoutSquareBrackets - if true a link with no square brackets around the
link was parsedpublic ITableOfContent appendHead(String rawHead, int headLevel, boolean noToC, int headCounter, int startPosition, int endPosition)
appendHead in interface IWikiModelrawHead - the unparsed header stringheadLevel - level of header (i.e. h1, h2, h3, h4, 5h,..)headCounter - the total number of headers parsedstartPosition - the start index in the text where the header line of the
section beginsendPosition - the start index in the text where the header line of the
section endspublic void appendInternalImageLink(String hrefImageLink, String srcImageLink, ImageFormat imageFormat)
IWikiModelHTMLConverter#imageNodeToText() method.appendInternalImageLink in interface IWikiModelprotected void setDefaultThumbWidth(ImageFormat imageFormat)
public void appendInternalLink(String topic, String hashSection, String topicDescription, String cssClass, boolean parseRecursive)
IWikiModelappendInternalLink in interface IWikiModelcssClass - the links CSS class styleparseRecursive - TODOpublic void appendInterWikiLink(String namespace, String title, String linkText)
IWikiModelappendInterWikiLink in interface IWikiModelpublic void appendISBNLink(String isbnPureText)
IWikiModelISBN ) as
described in Wikipedia:ISBN
AbstractWikiModel class creates a link to Amazon.com.appendISBNLink in interface IWikiModelisbnPureText - the pure ISBN string which contains the ISBN prefix and
optional dashes in the ISBN numberpublic void appendMailtoLink(String link, String linkName, boolean withoutSquareBrackets)
IWikiModelappendMailtoLink in interface IWikiModellink - the external link with mailto: prefixlinkName - the link name which is separated from the URL by a spacewithoutSquareBrackets - if true a mailto link with no square brackets
around the link was parsedpublic boolean appendRawNamespaceLinks(String rawNamespaceTopic, String viewableLinkDescription, boolean containsNoPipe)
IWikiModelAbstractWikiModel defaults implementation this namespace
topic is parsed and checks for various namespaces, like
Categories and Interwiki links.appendRawNamespaceLinks in interface IWikiModelrawNamespaceTopic - the text between the [[...]] square brackets of a wiki link
before the pipe symbolcontainsNoPipe - set to true if the rawLinkText contained no pipe
symbol.true if the topic is a special namespace topicpublic boolean appendRawWikipediaLink(String rawLinkText, String suffix)
IWikiModelAbstractWikiModel defaults
implementation this link is parsed and the various other
append... methods of the model are called for the different
cases.appendRawWikipediaLink in interface IWikiModelrawLinkText - the text between the [[...]] square brackets of a wiki linksuffix - a String of lowercase letters which directly follow the link
after the closing ]] brackets. Useful for topic plurals.true if the method used the suffix for rendering the
wiki link. If false the parser should append the
suffix as normal text after the wiki link (i.e. in the case of an
image of file wiki link).public boolean appendRedirectLink(String redirectLink)
IWikiModelappendRedirectLink in interface IWikiModelredirectLink - the raw string between the wikilink tags [[ ]]true if the the wikitext shouldn't be parsedpublic void appendSignature(Appendable writer, int numberOfTildes) throws IOException
IWikiModelappendSignature in interface IWikiModelnumberOfTildes - an int value between 3 and 5IOExceptionpublic void appendStack(TagStack stack)
IWikiModelappendStack in interface IWikiModelpublic void buildEditLinkUrl(int section)
IWikiModelbuildEditLinkUrl in interface IWikiModelpublic AbstractWikipediaParser createNewInstance(String rawWikitext)
IWikiModelcreateNewInstance in interface IWikiModelpublic ITableOfContent createTableOfContent(boolean isTOCIdentifier)
IWikiModelcreateTableOfContent in interface IWikiModelisTOCIdentifier - true if the __TOC__ keyword was parsedpublic int decrementRecursionLevel()
IWikiModeldecrementRecursionLevel in interface IWikiModelpublic int decrementTemplateRecursionLevel()
IWikiModeldecrementTemplateRecursionLevel in interface IWikiModelpublic String encodeTitleDotUrl(String wikiTitle, boolean firstCharacterAsUpperCase)
IWikiModelfirstCharacterAsUpperCase parameters must be set to
true. For an example encoding routine see:
Encoder.encodeTitleDotUrl(String, boolean)encodeTitleDotUrl in interface IWikiModelfirstCharacterAsUpperCase - if true convert the first of the title to uppercaseEncoder.encodeTitleToUrl(String, boolean)public String encodeTitleToUrl(String wikiTitle, boolean firstCharacterAsUpperCase)
IWikiModelfirstCharacterAsUpperCase parameters must be set to
true. For an example encoding routine see
Encoder.encodeTitleToUrl(String, boolean)encodeTitleToUrl in interface IWikiModelfirstCharacterAsUpperCase - if true convert the first of the title to uppercaseEncoder.encodeTitleToUrl(String, boolean)public Object getAttribute(String attribute)
getAttribute in interface IContextpublic AttributeRenderer getAttributeRenderer(Class<?> attributeClassType)
getAttributeRenderer in interface IContextpublic Map<String,SourceCodeFormatter> getCodeFormatterMap()
IConfigurationgetCodeFormatterMap in interface IConfigurationpublic Date getCurrentTimeStamp()
IWikiModelnew Date(System.currentTimeMillis());.getCurrentTimeStamp in interface IWikiModelpublic InterWikiMap getInterwikiMap()
IWikiModelgetInterwikiMap in interface IWikiModelpublic Locale getLocale()
IWikiModelgetLocale in interface IWikiModelpublic int getNextNumber()
IWikiModelgetNextNumber in interface IWikiModelint number.public TagToken getNode(int offset)
IWikiModelgetNode(fWikiModel.stackSize() - 2) returns the node before
the node at top of the stack.getNode in interface IWikiModelpublic String getPageName()
IWikiModelgetPageName in interface IWikiModelpublic MagicWord.MagicWordE getMagicWord(String name)
IWikiModelgetMagicWord in interface IWikiModelname - the (potential) magic wordMagicWord.MagicWordE in case
MagicWord is used) or
null if this is no valid magic wordpublic String getRawWikiContent(ParsedPageName parsedPagename, Map<String,String> templateParameters) throws WikiModelContentException
IWikiModelgetRawWikiContent in interface IWikiModelparsedPagename - the parsed template nametemplateParameters - if the namespace is the Template namespace, the current
template parameters are stored as Strings in this
mapnull if no content was foundWikiModelContentExceptionAbstractParser#parsePageName(IWikiModel, String, INamespaceValue,
boolean)public int getRecursionLevel()
IWikiModelgetRecursionLevel in interface IWikiModelpublic String getRedirectLink()
IWikiModelgetRedirectLink in interface IWikiModel[[ ]] or
null if no redirect existspublic List<Reference> getReferences()
IWikiModelgetReferences in interface IWikiModelnull if no reference
existsReferencepublic ResourceBundle getResourceBundle()
IWikiModelgetResourceBundle in interface IWikiModelpublic List<SemanticAttribute> getSemanticAttributes()
IWikiModelgetSemanticAttributes in interface IWikiModelnull if no
SemanticAttribute existspublic List<SemanticRelation> getSemanticRelations()
IWikiModelgetSemanticRelations in interface IWikiModelnull if no
SemanticRelation existspublic SimpleDateFormat getSimpleDateFormat()
IWikiModelgetSimpleDateFormat in interface IWikiModelpublic ITableOfContent getTableOfContent()
IWikiModelgetTableOfContent in interface IWikiModelpublic Map<String,String> getTemplateCallsCache()
IConfigurationgetTemplateCallsCache in interface IConfigurationnull if no cache implementation is set.IConfiguration.setTemplateCallsCache(Map)public ITemplateFunction getTemplateFunction(String name)
IWikiModel{{ #if: ... }} )
implementation.getTemplateFunction in interface IWikiModelname - the name of the function without the "#" and
":" delimitersnull if no function is
available for the given namepublic Map<String,ITemplateFunction> getTemplateMap()
IConfigurationgetTemplateMap in interface IConfigurationpublic Map<String,TagToken> getTokenMap()
IConfigurationgetTokenMap in interface IConfigurationpublic Set<String> getUriSchemeSet()
IConfigurationgetUriSchemeSet in interface IConfigurationpublic IConfiguration.Casing casing()
casing in interface IConfigurationIConfiguration.Casing.FirstLetter.public IEventListener getWikiListener()
IWikiModelgetWikiListener in interface IWikiModelnull if no listener is definedpublic int incrementRecursionLevel()
IWikiModelincrementRecursionLevel in interface IWikiModelpublic int incrementTemplateRecursionLevel()
IWikiModelincrementTemplateRecursionLevel in interface IWikiModelprotected void initialize()
public boolean isCamelCaseEnabled()
IWikiModelisCamelCaseEnabled in interface IWikiModeltrue if CamelCase words should also be used as wiki
linkspublic boolean isEditorMode()
IWikiModelisEditorMode in interface IWikiModeltrue if your model is used in an editor modepublic boolean isInterWiki(String namespace)
IWikiModelisInterWiki in interface IWikiModeltrue if the namespace is a interwiki namespace (i.e.
prefix).public boolean isMathtranRenderer()
IWikiModelisMathtranRenderer in interface IWikiModeltrue the <math> tag should be
rendered fro mathtran.org.public boolean isNamespace(String namespace)
IWikiModelisNamespace in interface IWikiModeltrue if the namespace is a namespace in this modelpublic boolean isNoToc()
IWikiModelisNoToc in interface IWikiModeltrue if the rendering of the "table of
contents" is disabled globally.public boolean isParameterParsingMode()
IWikiModelisParameterParsingMode in interface IWikiModeltrue if your model renders a template parameter
valuepublic boolean isPreviewMode()
IWikiModelisPreviewMode in interface IWikiModeltrue if your model is used in a preview modepublic boolean isSemanticWebActive()
IWikiModelisSemanticWebActive in interface IWikiModeltrue if parsing of semantic mediawiki (SMW) links is
enabledpublic boolean isTemplateTopic()
IWikiModelisTemplateTopic in interface IWikiModeltrue if the currently parsed wiki text is a
template.public boolean isValidUriScheme(String uriScheme)
IWikiModelisValidUriScheme in interface IWikiModeluriScheme - the top level URI (Uniform Resource Identifier) scheme name
(without the following colon character ":")true if the specified URI scheme is valid.IWikiModel.isValidUriSchemeSpecificPart(String, String)public boolean isValidUriSchemeSpecificPart(String uriScheme, String uriSchemeSpecificPart)
IWikiModelisValidUriSchemeSpecificPart in interface IWikiModeluriScheme - the top level URI (Uniform Resource Identifier) scheme name
(without the following colon character ":")uriSchemeSpecificPart - the URI (Uniform Resource Identifier) scheme part following
the top level scheme name and the colon character ":"true if the specified URI scheme is valid.IWikiModel.isValidUriScheme(String)public boolean parseBehaviorSwitch(String identifier)
IWikiModel__NOEDITSECTION__ ). See Help
:Magic_words#Behavior_switches.parseBehaviorSwitch in interface IWikiModelidentifier - the identifier without the leading and trailing underscores
("__")true if the switch was parsedpublic void parseEvents(IEventListener listener, String rawWikiText)
IWikiModelparseEvents in interface IWikiModellistener - an event listenerrawWikiText - the raw wiki textpublic String parseTemplates(String rawWikiText)
IWikiModelparseTemplates in interface IWikiModelpublic String parseTemplates(String rawWikiText, boolean parseOnlySignature)
IWikiModelparseTemplates in interface IWikiModelparseOnlySignature - if true parse only the signature wiki texts, no
templates and wiki comment parsingpublic TagToken peekNode()
IWikiModelpeekNode in interface IWikiModelpublic TagToken popNode()
IWikiModelpopNode in interface IWikiModelpublic boolean pushNode(TagToken node)
IWikiModelpushNode in interface IWikiModeltrue if the push on the internal stack was
successfulprotected void rawSetAttribute(Map<String,Object> attributes, String name, Object value)
public void registerRenderer(Class<?> attributeClassType, AttributeRenderer renderer)
registerRenderer in interface IContextpublic String render(ITextConverter converter, String rawWikiText) throws IOException
IWikiModelrender in interface IWikiModelconverter - a text converter. Note the converter may be
null, if you only would like to analyze the raw
wiki text and don't need to convert. This speeds up the
parsing process.rawWikiText - a raw wiki textIOExceptionpublic String render(ITextConverter converter, String rawWikiText, boolean templateTopic) throws IOException
IWikiModelrender in interface IWikiModelconverter - a text converter. Note the converter may be
null, if you only would like to analyze the raw
wiki text and don't need to convert. This speeds up the
parsing process.rawWikiText - a raw wiki texttemplateTopic - if true, render the wiki text as if a template
topic will be displayed directly, otherwise render the text as
if a common wiki topic will be displayed.null if an IOException occurs or
converter==nullIOExceptionpublic void render(ITextConverter converter, String rawWikiText, Appendable buf, boolean templateTopic, boolean parseTemplates) throws IOException
IWikiModelrender in interface IWikiModelconverter - a text converter. Note the converter may be
null, if you only would like to analyze the raw
wiki text and don't need to convert. This speeds up the
parsing process.rawWikiText - a raw wiki textbuf - write to this buffertemplateTopic - if true, render the wiki text as if a template
topic will be displayed directly, otherwise render the text as
if a common wiki topic will be displayed.parseTemplates - parses the template expansion step (parses include,
onlyinclude, includeonly etc)IOExceptionpublic String render(String rawWikiText) throws IOException
IWikiModelrender in interface IWikiModelIOExceptionpublic String render(String rawWikiText, boolean templateTopic) throws IOException
IWikiModelrender in interface IWikiModeltemplateTopic - if true, render the wiki text as if a template
topic will be displayed directly, otherwise render the text as
if a common wiki topic will be displayed.IOExceptionpublic String renderPDF(String rawWikiText) throws IOException
IWikiModelrenderPDF in interface IWikiModelnull if an IOException occursIOExceptionpublic boolean replaceColon()
IWikiModelreplaceColon in interface IWikiModelpublic void setAttribute(String name, Object value)
setAttribute in interface IContextpublic void setAttributeRenderers(Map<Class<?>,Object> renderers)
public void setPageName(String pageTitle)
IWikiModelsetPageName in interface IWikiModelpublic void setParameterParsingMode(boolean parameterParsingMode)
IWikiModelsetParameterParsingMode in interface IWikiModelpublic void setSemanticWebActive(boolean semanticWeb)
IWikiModelsetSemanticWebActive in interface IWikiModelpublic void setTemplateCallsCache(Map<String,String> map)
IConfigurationsetTemplateCallsCache in interface IConfigurationmap - the cache implementationpublic void setUp()
IWikiModelsetUp in interface IWikiModelpublic boolean showSyntax(String tagName)
IWikiModelshowSyntax in interface IWikiModelpublic int stackSize()
IWikiModelstackSize in interface IWikiModelpublic void substituteTemplateCall(String templateName, Map<String,String> parameterMap, Appendable writer) throws IOException
substituteTemplateCall in interface IWikiModeltemplateName - the name of the templateparameterMap - the templates parameter java.util.SortedMapwriter - the buffer to append the substituted template contentIOExceptionpublic TagStack swapStack(TagStack stack)
swapStack in interface IWikiModelpublic void tearDown()
IWikiModeltearDown in interface IWikiModelpublic void reduceTokenStack(TagToken node)
reduceTokenStack in interface IWikiModelpublic String getNamespaceName()
IWikiModelgetNamespaceName in interface IWikiModelpublic void setNamespaceName(String namespaceLowercase)
IWikiModelsetNamespaceName in interface IWikiModelnamespaceLowercase - the lowercase key for the namespace.Locale,
Namespace.getNamespace(String)public void setNoToc(boolean disableToc)
IWikiModeltrue if the rendering of the "table of
contents" should be disabled globally.setNoToc in interface IWikiModeldisableToc - set to true if the rendering of the "table
of contents" should be disabled globally.public String getImageBaseURL()
IWikiModelgetImageBaseURL in interface IWikiModelIWikiModel.getWikiBaseURL(),
IWikiModel.getWikiBaseEditURL()public String getWikiBaseURL()
IWikiModel
https://en.wikipedia.org/wiki/${title}
getWikiBaseURL in interface IWikiModelIWikiModel.getImageBaseURL(),
IWikiModel.getWikiBaseEditURL()public String getWikiBaseEditURL()
IWikiModel
https://en.wikipedia.org/w/index.php?title=${title}
getWikiBaseEditURL in interface IWikiModelIWikiModel.getWikiBaseURL(),
IWikiModel.getImageBaseURL()public String[] splitNsTitle(String fullTitle)
IWikiModelEncoder#normaliseTitle(String, boolean, char) keeping
underscores.splitNsTitle in interface IWikiModelfullTitle - the (full) title including a namespace (if present)public Frame getFrame()
getFrame in interface IWikiModelpublic void setFrame(Frame frame)
setFrame in interface IWikiModelpublic ScribuntoEngine createScribuntoEngine()
createScribuntoEngine in interface IWikiModelCopyright © 2017 Java Wikipedia API (Bliki engine). All rights reserved.