|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IWikiModel
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)
See Semantic MediaWiki for more information. |
boolean |
addSemanticRelation(java.lang.String relation,
java.lang.String relationValue)
See Semantic MediaWiki for more information. |
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)
Deprecated. use appendExternalLink(String, String, String, boolean)
instead. |
void |
appendExternalLink(java.lang.String uriSchemeName,
java.lang.String link,
java.lang.String linkName,
boolean withoutSquareBrackets)
Append an external link (starting with http, https, ftp,...) as described in Help Links |
ITableOfContent |
appendHead(java.lang.String rawHead,
int headLevel,
boolean noToC,
int headCounter)
Deprecated. |
ITableOfContent |
appendHead(java.lang.String rawHead,
int headLevel,
boolean noToC,
int headCounter,
int startPosition,
int endPosition)
Add a single wiki head (i.e. ==...==, ===...===, ====...====,...) to the table of content |
void |
appendInternalImageLink(java.lang.String hrefImageLink,
java.lang.String srcImageLink,
ImageFormat imageFormat)
Append this internal wiki image link. |
void |
appendInternalLink(java.lang.String topic,
java.lang.String hashSection,
java.lang.String topicDescription,
java.lang.String cssClass,
boolean parseRecursive)
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 |
appendRawNamespaceLinks(java.lang.String rawNamespaceTopic,
java.lang.String viewableLinkDescription,
boolean containsNoPipe)
Check if the topic is a special namespace topic. |
void |
appendRawWikipediaLink(java.lang.String rawLinkText,
java.lang.String suffix)
Main entry method for parsing a raw wiki link (i.e. the text between the [[...]] square brackets). |
boolean |
appendRedirectLink(java.lang.String redirectLink)
Append the redirect link to the model |
void |
appendSignature(java.lang.Appendable writer,
int numberOfTildes)
Append the user signature to the writer (i.e. '~~~', '~~~~' or '~~~~'). |
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 |
AbstractParser |
createNewInstance(java.lang.String rawWikitext)
Create a new parser instance |
ITableOfContent |
createTableOfContent(boolean isTOCIdentifier)
Create the "table of content" placeholder |
int |
decrementRecursionLevel()
Decrement the current recursion level of the parser. |
java.lang.String |
encodeTitleDotUrl(java.lang.String wikiTitle,
boolean firstCharacterAsUpperCase)
Encode the wiki links title into a URL for HTML hyperlinks (i.e. |
java.lang.String |
encodeTitleToUrl(java.lang.String wikiTitle,
boolean firstCharacterAsUpperCase)
Encode the wiki links title into a URL for HTML hyperlinks (i.e. |
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.util.Date |
getCurrentTimeStamp()
Get the current time stamp. |
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 |
java.util.Locale |
getLocale()
Get the locale of this model. |
INamespace |
getNamespace()
Get the namespace of this model. |
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. |
java.lang.String |
getPageName()
Get the title of the current wiki article. |
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. |
ITableOfContent |
getTableOfContent()
Get the parsed "table of content" data after parsing the Wikipedia text. |
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 model |
IEventListener |
getWikiListener()
Get the current defined wiki listener |
int |
incrementParserRecursionCount()
|
int |
incrementRecursionLevel()
Increment the current recursion level of the parser. |
int |
incrementTemplateRecursionCount()
|
boolean |
isCamelCaseEnabled()
Checks if CamelCase words should also be used as wiki links. |
boolean |
isCategoryNamespace(java.lang.String namespace)
Check if the given namespace is a category namespace |
boolean |
isEditorMode()
The current model is used to render a wikipage in editor mode |
boolean |
isImageNamespace(java.lang.String namespace)
Check if the given namespace is an image namespace |
boolean |
isInterWiki(java.lang.String namespace)
Check if the given namespace is an interwiki link prefix. |
boolean |
isMathtranRenderer()
If the <math> tag should be rendered for the www.mathtran.org service, then return
true . |
boolean |
isNamespace(java.lang.String namespace)
Check if the given namespace is a namespace in this model |
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 |
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 |
isValidUriScheme(java.lang.String uriScheme)
Check if the top level URI (Uniform Resource Identifier) scheme name is valid in this model. |
boolean |
isValidUriSchemeSpecificPart(java.lang.String uriScheme,
java.lang.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 |
parseBBCodes()
Parse BBCode (Bulletin Board Code), 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 the internal wiki image link to this model. |
java.lang.String |
parseTemplates(java.lang.String rawWikiText)
Parse the templates in a raw wikipedia text into a resulting wikipedia text. |
java.lang.String |
parseTemplates(java.lang.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 |
java.lang.String |
render(ITextConverter converter,
java.lang.String rawWikiText)
Render the raw Wikipedia text into a string for a given converter |
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 |
setPageName(java.lang.String pageTitle)
Set the title of the currently rendered page data. |
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 |
void |
substituteTemplateCall(java.lang.String templateName,
java.util.Map<java.lang.String,java.lang.String> parameterMap,
java.lang.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. 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, getTemplateCallsCache, getTemplateMap, getTokenMap, getUriSchemeSet, setTemplateCallsCache |
Method Detail |
---|
void addCategory(java.lang.String categoryName, java.lang.String sortKey)
sortKey
see also Wikipedia:Categorization#Category_sorting
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".void addLink(java.lang.String topicName)
topicName
- The name of the topic that is linked to.boolean addSemanticAttribute(java.lang.String attribute, java.lang.String attributeValue)
attribute
- attributeValue
-
boolean addSemanticRelation(java.lang.String relation, java.lang.String relationValue)
relation
- relationValue
-
void addTemplate(java.lang.String template)
template
- The name of the template that is being included.java.lang.String[] addToReferences(java.lang.String reference, java.lang.String nameAttribute)
reference
- the rendered HTML code of the ref-Tag bodynameAttribute
- the value of the name
attribute or null
void append(BaseToken contentNode)
contentNode
- void appendExternalImageLink(java.lang.String imageSrc, java.lang.String imageAltText)
imageSrc
- hashSection
- imageAltText
- void appendExternalLink(java.lang.String link, java.lang.String linkName, boolean withoutSquareBrackets)
appendExternalLink(String, String, String, boolean)
instead.
link
- the external link with http://, 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 parsedvoid appendExternalLink(java.lang.String uriSchemeName, java.lang.String link, java.lang.String linkName, boolean withoutSquareBrackets)
uriSchemeName
- 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 http://, 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 parsedITableOfContent appendHead(java.lang.String rawHead, int headLevel, boolean noToC, int headCounter)
rawHead
- the unparsed header stringheadLevel
- level of header (i.e. h1, h2, h3, h4, 5h,..)noToc
- don't show the "table of content"headCounter
- the total number of headers parsed
ITableOfContent appendHead(java.lang.String rawHead, int headLevel, boolean noToC, int headCounter, int startPosition, int endPosition)
rawHead
- the unparsed header stringheadLevel
- level of header (i.e. h1, h2, h3, h4, 5h,..)noToc
- don't show the "table of content"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
ends
void appendInternalImageLink(java.lang.String hrefImageLink, java.lang.String srcImageLink, ImageFormat imageFormat)
HTMLConverter#imageNodeToText()
method.
hrefImageLink
- srcImageLink
- imageFormat
- void appendInternalLink(java.lang.String topic, java.lang.String hashSection, java.lang.String topicDescription, java.lang.String cssClass, boolean parseRecursive)
topic
- hashSection
- topicDescription
- cssClass
- the links CSS class styleparseRecursive
- TODOvoid appendInterWikiLink(java.lang.String namespace, java.lang.String title, java.lang.String linkText)
namespace
- title
- linkText
- void appendISBNLink(java.lang.String isbnPureText)
ISBN
) as
described in Wikipedia:ISBN
AbstractWikiModel
class creates a link to Amazon.com.
isbnPureText
- the pure ISBN string which contains the ISBN prefix and optional
dashes in the ISBN numbervoid appendMailtoLink(java.lang.String link, java.lang.String linkName, boolean withoutSquareBrackets)
link
- 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 parsedboolean appendRawNamespaceLinks(java.lang.String rawNamespaceTopic, java.lang.String viewableLinkDescription, boolean containsNoPipe)
AbstractWikiModel
defaults implementation this namespace topic
is parsed and checks for various namespaces, like Categories
and Interwiki
links.
rawNamespaceTopic
- the text between the [[...]] square brackets of a wiki link before
the pipe symbolviewableLinkDescription
- containsNoPipe
- set to true
if the rawLinkText contained no pipe
symbol.
true
if the topic is a special namespace topicvoid appendRawWikipediaLink(java.lang.String rawLinkText, java.lang.String suffix)
AbstractWikiModel
defaults
implementation this link is parsed and the various other
append...
methods of the model are called for the different
cases.
rawLinkText
- 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.boolean appendRedirectLink(java.lang.String redirectLink)
redirectLink
- the raw string between the wikilink tags [[ ]]
true
if the the wikitext shouldn't be parsedvoid appendSignature(java.lang.Appendable writer, int numberOfTildes) throws java.io.IOException
writer
- numberOfTildes
- an int
value between 3 and 5
java.io.IOException
void appendStack(TagStack stack)
stack
- void buildEditLinkUrl(int section)
section
- AbstractParser createNewInstance(java.lang.String rawWikitext)
rawWikitext
-
ITableOfContent createTableOfContent(boolean isTOCIdentifier)
isTOCIdentifier
- true
if the __TOC__ keyword was parsed
int decrementRecursionLevel()
java.lang.String encodeTitleDotUrl(java.lang.String wikiTitle, boolean firstCharacterAsUpperCase)
firstCharacterAsUpperCase
parameters must be set to true
. For an example encoding
routine see:
Encoder.encodeTitleDotUrl(String, boolean)
firstCharacterAsUpperCase
- if true
convert the first of the title to uppercaseEncoder.encodeTitleToUrl(String, boolean)
java.lang.String encodeTitleToUrl(java.lang.String wikiTitle, boolean firstCharacterAsUpperCase)
firstCharacterAsUpperCase
parameters must be set to true
. For an example encoding
routine see
Encoder.encodeTitleToUrl(String, boolean)
firstCharacterAsUpperCase
- if true
convert the first of the title to uppercaseEncoder.encodeTitleToUrl(String, boolean)
java.lang.String get2ndCategoryNamespace()
java.lang.String get2ndImageNamespace()
java.lang.String get2ndTemplateNamespace()
java.lang.String getCategoryNamespace()
java.util.Date getCurrentTimeStamp()
new Date(System.currentTimeMillis());
.
java.lang.String getImageNamespace()
java.util.Set<java.lang.String> getLinks()
Set
of link names 8i.e. [[...]] links)java.util.Locale getLocale()
INamespace getNamespace()
int getNextNumber()
int
number.TagToken getNode(int offset)
getNode(fWikiModel.stackSize() - 2)
returns the node before
the node at top of the stack.
offset
-
java.lang.String getPageName()
java.lang.String getRawWikiContent(java.lang.String namespace, java.lang.String templateName, java.util.Map<java.lang.String,java.lang.String> templateParameters)
namespace
- the namespace of this articletemplateName
- the name of the templatetemplateParameters
- if the namespace is the Template namespace, the current
template parameters are stored as String
s in this map
null
if no content was foundint getRecursionLevel()
java.lang.String getRedirectLink()
[[ ]]
or
null
if no redirect existsjava.util.List<Reference> getReferences()
null
if no reference existsReference
java.util.ResourceBundle getResourceBundle()
java.util.List<SemanticAttribute> getSemanticAttributes()
null
if no
SemanticAttribute existsjava.util.List<SemanticRelation> getSemanticRelations()
null
if no
SemanticRelation existsITableOfContent getTableOfContent()
ITemplateFunction getTemplateFunction(java.lang.String name)
{{ #if: ... }}
)
implementation.
name
- the name of the function without the "#" and
":" delimiters
null
if no function is
available for the given namejava.lang.String getTemplateNamespace()
IEventListener getWikiListener()
null
if no listener is definedint incrementParserRecursionCount()
int incrementRecursionLevel()
int incrementTemplateRecursionCount()
boolean isCamelCaseEnabled()
true
if CamelCase words should also be used as wiki
linksboolean isCategoryNamespace(java.lang.String namespace)
namespace
-
true
if the namespace is a category namespace.boolean isEditorMode()
true
if your model is used in an editor modeboolean isImageNamespace(java.lang.String namespace)
namespace
-
true
if the namespace is a image namespace.boolean isInterWiki(java.lang.String namespace)
namespace
-
true
if the namespace is a interwiki namespace (i.e.
prefix).boolean isMathtranRenderer()
<math>
tag should be rendered for the www.mathtran.org service, then return
true
.
true
the <math>
tag should be
rendered fro mathtran.org.boolean isNamespace(java.lang.String namespace)
namespace
-
true
if the namespace is a namespace in this modelboolean isPreviewMode()
true
if your model is used in a preview modeboolean isSemanticWebActive()
namespace
-
true
if parsing of semantic mediawiki (SMW) links is
enabledboolean isTemplateNamespace(java.lang.String namespace)
namespace
-
true
if the namespace is a template namespace.boolean isTemplateTopic()
true
if the currently parsed wiki text is a templateboolean isValidUriScheme(java.lang.String uriScheme)
uriScheme
- the top level URI (Uniform Resource Identifier) scheme name
(without the following colon character ":")
true
if the specified URI scheme is valid.isValidUriSchemeSpecificPart(String, String)
boolean isValidUriSchemeSpecificPart(java.lang.String uriScheme, java.lang.String uriSchemeSpecificPart)
uriScheme
- 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.isValidUriScheme(String)
boolean parseBBCodes()
true
if the bbCodes should be parsedvoid parseEvents(IEventListener listener, java.lang.String rawWikiText)
listener
- an event listenerrawWikiText
- the raw wiki textvoid parseInternalImageLink(java.lang.String imageNamespace, java.lang.String rawImageLink)
imageNamespace
- the image namespacerawImageLink
- the raw image link text without the surrounding
[[...]]
java.lang.String parseTemplates(java.lang.String rawWikiText)
rawWikiText
-
java.lang.String parseTemplates(java.lang.String rawWikiText, boolean parseOnlySignature)
rawWikiText
- parseOnlySignature
- if true
parse only the signature wiki texts, no
templates and wiki comment parsing
TagToken peekNode()
TagToken popNode()
boolean pushNode(TagToken node)
true
if the push on the internal stack was successfuljava.lang.String render(ITextConverter converter, java.lang.String rawWikiText)
converter
- 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 text
null
if an IOException occurs or
converter==null
java.lang.String render(java.lang.String rawWikiText)
rawWikiText
-
null
if an IOException occursjava.lang.String renderPDF(java.lang.String rawWikiText)
rawWikiText
-
null
if an IOException occursboolean replaceColon()
void setPageName(java.lang.String pageTitle)
pageTitle
- void setSemanticWebActive(boolean semanticWeb)
void setUp()
boolean showSyntax(java.lang.String tagName)
int stackSize()
void substituteTemplateCall(java.lang.String templateName, java.util.Map<java.lang.String,java.lang.String> parameterMap, java.lang.Appendable writer) throws java.io.IOException
templateName
- the name of the templateparameterMap
- the templates parameter java.util.SortedMap
writer
- the buffer to append the substituted template content
java.io.IOException
TagStack swapStack(TagStack stack)
void tearDown()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |