info.bliki.wiki.model
Interface IWikiModel

All Superinterfaces:
IConfiguration
All Known Implementing Classes:
AbstractWikiModel, BBCodeModel, WikiModel

public interface IWikiModel
extends IConfiguration

Interface for rendering a wiki model


Method Summary
 void addCategory(java.lang.String categoryName, java.lang.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.
 void addLink(java.lang.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(java.lang.String attribute, java.lang.String attributeValue)
           
 boolean addSemanticRelation(java.lang.String relation, java.lang.String relationValue)
           
 void addTemplate(java.lang.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.
 java.lang.String[] addToReferences(java.lang.String reference, java.lang.String nameAttribute)
          Add a reference (i.e. footnote) to the internal list
 void append(BaseToken contentNode)
          Append the content as a child on the top node of the internal stack
 void appendExternalImageLink(java.lang.String imageSrc, java.lang.String imageAltText)
          Append an external wiki image link (starting with http, https,... and ending with gif, png, jpg, bmp)
 void appendExternalLink(java.lang.String link, java.lang.String linkName, boolean withoutSquareBrackets)
          Append an external link (starting with http, https, ftp,...) as described in Help Links
 void appendInternalImageLink(java.lang.String hrefImageLink, java.lang.String srcImageLink, ImageFormat imageFormat)
          Append this internal wiki image link
 void appendInternalLink(java.lang.String link, java.lang.String hashSection, java.lang.String linkText)
          Append an internal wikilink as described in Help Links
 void appendInterWikiLink(java.lang.String namespace, java.lang.String title, java.lang.String linkText)
          Append an InterWiki link
 void appendISBNLink(java.lang.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(java.lang.String link, java.lang.String linkName, boolean withoutSquareBrackets)
          Append an external link (starting with mailto:...) as described in Help:Wikitext#Links
 boolean appendRedirectLink(java.lang.String redirectLink)
          Append the redirect link to the model
 void appendStack(TagStack stack)
           
 void buildEditLinkUrl(int section)
          Build the link to edit a section of the wikipedia article
 int decrementRecursionLevel()
          Increment the current recursion level of the parser
 java.lang.String get2ndCategoryNamespace()
          Get the secondary namespace (i.e. the namespace for a non-englich locale) for categories in this wiki
 java.lang.String get2ndImageNamespace()
          Get the secondary namespace (i.e. the namespace for a non-englich locale) for images in this wiki
 java.lang.String get2ndTemplateNamespace()
          Get the secondary namespace (i.e. the namespace for a non-englich locale) for templates in this wiki
 java.lang.String getCategoryNamespace()
          Get the primary namespace for categories in this wiki
 java.lang.String getImageNamespace()
          Get the primary namespace for images in this wiki
 java.util.Set<java.lang.String> getLinks()
          Get the set of Wikipedia link names
 TagToken getNode(int offset)
          Get the node at the given offset on the internal stack
 java.lang.String getRawWikiContent(java.lang.String namespace, java.lang.String templateName, java.util.Map<java.lang.String,java.lang.String> templateParameters)
          Get the raw wiki text for the given namespace and article name
 int getRecursionLevel()
          Get the current recursion level of the parser
 java.lang.String getRedirectLink()
          Get the redirect link.
 java.util.List<Reference> getReferences()
          Get the internal list of references (i.e. footnotes)
 java.util.ResourceBundle getResourceBundle()
          Get the resource bundle associated with this model for I18N support
 java.util.List<SemanticAttribute> getSemanticAttributes()
          Get the list of SemanticAttributes
 java.util.List<SemanticRelation> getSemanticRelations()
          Get the list of SemanticRelations.
 TableOfContentTag getTableOfContentTag(boolean isTOCIdentifier)
          Get the "table of content" placeholder
 ITemplateFunction getTemplateFunction(java.lang.String name)
          Get a template parser function (i.e.
 java.lang.String getTemplateNamespace()
          Get the primary namespace for templates in this wiki
 IEventListener getWikiListener()
          Get the current defined wiki listener
 int incrementRecursionLevel()
          Increment the current recursion level of the parser
 boolean isCategoryNamespace(java.lang.String namespace)
          Check if the given namespace is a category namespace
 boolean isImageNamespace(java.lang.String namespace)
          Check if the given namespace is a image namespace
 boolean isInterWiki(java.lang.String namespace)
          Check if the given namespace for an interwiki link
 boolean isNamespace(java.lang.String namespace)
          Check if the given namespace is a namespace in this model
 boolean isSemanticWebActive()
          Allow the parsing of semantic mediawiki (SMW) links See Semantic MediaWiki for more information.
 boolean isTemplateNamespace(java.lang.String namespace)
          Check if the given namespace is a template namespace
 boolean isTemplateTopic()
          Determine if the currently parsed wiki text is a template.
 boolean parseBBCodes()
          Parse phpBB like syntax codes in this wiki
 void parseEvents(IEventListener listener, java.lang.String rawWikiText)
          Parse the raw Wikipedia text and notify the listener
 void parseInternalImageLink(java.lang.String imageNamespace, java.lang.String rawImageLink)
          Append this internal wiki image link
 java.lang.String parseTemplates(java.lang.String rawWikiText)
          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
 java.lang.String render(ITextConverter converter, java.lang.String rawWikiText)
          Render the raw Wikipedia text into an HTML string
 java.lang.String render(java.lang.String rawWikiText)
          Render the raw Wikipedia text into an HTML string and use the default HTMLConverter
 java.lang.String renderPDF(java.lang.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. links, categories, templates)
 void setSemanticWebActive(boolean semanticWeb)
          Activate the parsing of semantic Mediawiki (SMW) links See Semantic MediaWiki for more information.
 void setUp()
          Prepare or initialize the wiki model before rendering the wikipedia text
 boolean showSyntax(java.lang.String tagName)
          Show the syntax highlighting of the source code
 int stackSize()
          The size of the internal stack
 TagStack swapStack(TagStack stack)
           
 void tearDown()
          Clean up (i.e. free internal resources) in the wiki model after rendering the wikipedia text, if necessary
 
Methods inherited from interface info.bliki.wiki.model.IConfiguration
addCodeFormatter, addInterwikiLink, addTemplateFunction, addTokenTag, getCodeFormatterMap, getInterwikiMap, getTemplateMap, getTokenMap
 

Method Detail

addCategory

void addCategory(java.lang.String categoryName,
                 java.lang.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.

Parameters:
categoryName - 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".

addLink

void addLink(java.lang.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.

Parameters:
topicName - The name of the topic that is linked to.

addSemanticAttribute

boolean addSemanticAttribute(java.lang.String attribute,
                             java.lang.String attributeValue)

addSemanticRelation

boolean addSemanticRelation(java.lang.String relation,
                            java.lang.String relationValue)

addTemplate

void addTemplate(java.lang.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.

Parameters:
template - The name of the template that is being included.

addToReferences

java.lang.String[] addToReferences(java.lang.String reference,
                                   java.lang.String nameAttribute)
Add a reference (i.e. footnote) to the internal list

Parameters:
reference - the rendered HTML code of the ref-Tag body
nameAttribute - the value of the name attribute or null
Returns:
the current offset (i.e. size()-1) of the element in the list

append

void append(BaseToken contentNode)
Append the content as a child on the top node of the internal stack

Parameters:
contentNode -

appendExternalImageLink

void appendExternalImageLink(java.lang.String imageSrc,
                             java.lang.String imageAltText)
Append an external wiki image link (starting with http, https,... and ending with gif, png, jpg, bmp)

Parameters:
imageSrc -
hashSection -
imageAltText -

appendExternalLink

void appendExternalLink(java.lang.String link,
                        java.lang.String linkName,
                        boolean withoutSquareBrackets)
Append an external link (starting with http, https, ftp,...) as described in Help Links

Parameters:
link - the external link with http://, https:// or ftp:// prefix
linkName - the link name which is separated from the URL by a space
withoutSquareBrackets - if true a link with no square brackets around the link was parsed

appendInternalImageLink

void appendInternalImageLink(java.lang.String hrefImageLink,
                             java.lang.String srcImageLink,
                             ImageFormat imageFormat)
Append this internal wiki image link

Parameters:
hrefImageLink -
srcImageLink -
imageFormat -

appendInternalLink

void appendInternalLink(java.lang.String link,
                        java.lang.String hashSection,
                        java.lang.String linkText)
Append an internal wikilink as described in Help Links

Parameters:
link -
hashSection -
linkText -

appendInterWikiLink

void appendInterWikiLink(java.lang.String namespace,
                         java.lang.String title,
                         java.lang.String linkText)
Append an InterWiki link

Parameters:
namespace -
title -
linkText -

appendISBNLink

void appendISBNLink(java.lang.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.

Parameters:
isbnPureText - the pure ISBN string which contains the ISBN prefix and optional dashes in the ISBN number

appendMailtoLink

void appendMailtoLink(java.lang.String link,
                      java.lang.String linkName,
                      boolean withoutSquareBrackets)
Append an external link (starting with mailto:...) as described in Help:Wikitext#Links

Parameters:
link - the external link with mailto: prefix
linkName - the link name which is separated from the URL by a space
withoutSquareBrackets - if true a mailto link with no square brackets around the link was parsed

appendRedirectLink

boolean appendRedirectLink(java.lang.String redirectLink)
Append the redirect link to the model

Parameters:
redirectLink - the raw string between the wikilink tags [[ ]]
Returns:
true if the the wikitext shouldn't be parsed

appendStack

void appendStack(TagStack stack)

buildEditLinkUrl

void buildEditLinkUrl(int section)
Build the link to edit a section of the wikipedia article

Parameters:
section -

decrementRecursionLevel

int decrementRecursionLevel()
Increment the current recursion level of the parser

Returns:

get2ndCategoryNamespace

java.lang.String get2ndCategoryNamespace()
Get the secondary namespace (i.e. the namespace for a non-englich locale) for categories in this wiki

Returns:

get2ndImageNamespace

java.lang.String get2ndImageNamespace()
Get the secondary namespace (i.e. the namespace for a non-englich locale) for images in this wiki

Returns:

get2ndTemplateNamespace

java.lang.String get2ndTemplateNamespace()
Get the secondary namespace (i.e. the namespace for a non-englich locale) for templates in this wiki

Returns:

getCategoryNamespace

java.lang.String getCategoryNamespace()
Get the primary namespace for categories in this wiki

Returns:

getImageNamespace

java.lang.String getImageNamespace()
Get the primary namespace for images in this wiki

Returns:

getLinks

java.util.Set<java.lang.String> getLinks()
Get the set of Wikipedia link names

Returns:

getNode

TagToken getNode(int offset)
Get the node at the given offset on the internal stack

Parameters:
offset -
Returns:

getRawWikiContent

java.lang.String getRawWikiContent(java.lang.String namespace,
                                   java.lang.String templateName,
                                   java.util.Map<java.lang.String,java.lang.String> templateParameters)
Get the raw wiki text for the given namespace and article name

Parameters:
namespace - the namespace of this article
templateName - the name of the template
templateParameters - if the namespace is the Template namespace the current template parameters are stored as Strings in this map
Returns:
null if no content was found

getRecursionLevel

int getRecursionLevel()
Get the current recursion level of the parser

Returns:

getRedirectLink

java.lang.String getRedirectLink()
Get the redirect link.

Returns:
the raw string between the wikilink tags [[ ]] or null if no redirect exists

getReferences

java.util.List<Reference> getReferences()
Get the internal list of references (i.e. footnotes)

Returns:
the list of references or null if no reference exists
See Also:
Reference

getResourceBundle

java.util.ResourceBundle getResourceBundle()
Get the resource bundle associated with this model for I18N support

Returns:
the currently used resource bundle for this wiki model

getSemanticAttributes

java.util.List<SemanticAttribute> getSemanticAttributes()
Get the list of SemanticAttributes

Returns:
the list of SemanticAttributes or null if no SemanticAttribute exists

getSemanticRelations

java.util.List<SemanticRelation> getSemanticRelations()
Get the list of SemanticRelations. See Semantic MediaWiki for more information.

Returns:
the list of SemanticRelations or null if no SemanticRelation exists

getTableOfContentTag

TableOfContentTag getTableOfContentTag(boolean isTOCIdentifier)
Get the "table of content" placeholder

Parameters:
isTOCIdentifier -
Returns:

getTemplateFunction

ITemplateFunction getTemplateFunction(java.lang.String name)
Get a template parser function (i.e. {{ #if: ... }} ) implementation.

Parameters:
name - the name of the function without the "#" and ":" delimiters
Returns:
the parser function or null if no function is available for the given name

getTemplateNamespace

java.lang.String getTemplateNamespace()
Get the primary namespace for templates in this wiki

Returns:

getWikiListener

IEventListener getWikiListener()
Get the current defined wiki listener

Returns:
the wiki listener or null if no listener is defined

incrementRecursionLevel

int incrementRecursionLevel()
Increment the current recursion level of the parser

Returns:

isCategoryNamespace

boolean isCategoryNamespace(java.lang.String namespace)
Check if the given namespace is a category namespace

Parameters:
namespace -
Returns:

isImageNamespace

boolean isImageNamespace(java.lang.String namespace)
Check if the given namespace is a image namespace

Parameters:
namespace -
Returns:

isInterWiki

boolean isInterWiki(java.lang.String namespace)
Check if the given namespace for an interwiki link

Parameters:
namespace -
Returns:

isNamespace

boolean isNamespace(java.lang.String namespace)
Check if the given namespace is a namespace in this model

Parameters:
namespace -
Returns:

isSemanticWebActive

boolean isSemanticWebActive()
Allow the parsing of semantic mediawiki (SMW) links See Semantic MediaWiki for more information.

Parameters:
namespace -
Returns:

isTemplateNamespace

boolean isTemplateNamespace(java.lang.String namespace)
Check if the given namespace is a template namespace

Parameters:
namespace -
Returns:

isTemplateTopic

boolean isTemplateTopic()
Determine if the currently parsed wiki text is a template.

Returns:
true if the currently parsed wiki text is a template

parseBBCodes

boolean parseBBCodes()
Parse phpBB like syntax codes in this wiki

Returns:

parseEvents

void parseEvents(IEventListener listener,
                 java.lang.String rawWikiText)
Parse the raw Wikipedia text and notify the listener

Parameters:
rawWikiText -

parseInternalImageLink

void parseInternalImageLink(java.lang.String imageNamespace,
                            java.lang.String rawImageLink)
Append this internal wiki image link

Parameters:
imageNamespace - the image namespace
rawImageLink -

parseTemplates

java.lang.String parseTemplates(java.lang.String rawWikiText)
Parse the templates in a raw wikipedia text into a resulting wikipedia text.

Parameters:
rawWikiText -
Returns:

peekNode

TagToken peekNode()
Get the current TagNode on top of the internal stack

Returns:
the current node

popNode

TagToken popNode()
Pop the current TagNode from top of the internal stack


pushNode

boolean pushNode(TagToken node)
Push the given TagNode on top of the internal stack

Returns:
true if the push on the internal stack was successful

render

java.lang.String render(ITextConverter converter,
                        java.lang.String rawWikiText)
Render the raw Wikipedia text into an HTML string

Parameters:
rawWikiText -
Returns:
null if an IOException occurs

render

java.lang.String render(java.lang.String rawWikiText)
Render the raw Wikipedia text into an HTML string and use the default HTMLConverter

Parameters:
rawWikiText -
Returns:
null if an IOException occurs

renderPDF

java.lang.String renderPDF(java.lang.String rawWikiText)
Render the raw Wikipedia text into an HTML string and use the default PDFConverter. The resulting XHTML could be used as input for the Flying Saucer PDF renderer

Parameters:
rawWikiText -
Returns:
null if an IOException occurs

replaceColon

boolean replaceColon()
Replace a colon ':' with a slash '/' in wiki names (i.e. links, categories, templates)

Returns:

setSemanticWebActive

void setSemanticWebActive(boolean semanticWeb)
Activate the parsing of semantic Mediawiki (SMW) links See Semantic MediaWiki for more information.


setUp

void setUp()
Prepare or initialize the wiki model before rendering the wikipedia text


showSyntax

boolean showSyntax(java.lang.String tagName)
Show the syntax highlighting of the source code

Returns:

stackSize

int stackSize()
The size of the internal stack

Returns:

swapStack

TagStack swapStack(TagStack stack)

tearDown

void tearDown()
Clean up (i.e. free internal resources) in the wiki model after rendering the wikipedia text, if necessary