public class WikiModel extends AbstractWikiModel
IConfiguration.Casing| Modifier and Type | Field and Description |
|---|---|
protected Map<String,String> |
categories
A map for categories and their associated sort keys
|
protected Set<String> |
includes |
protected Set<String> |
links |
protected List<SemanticAttribute> |
semanticAttributes |
protected List<SemanticRelation> |
semanticRelations |
protected Set<String> |
templates |
attributes, fExternalLinksCounter, fLocale, fNamespace, fNamespaceName, fNoToc, fPageTitle, fParameterParsingMode, fRecursionLevel, fRedirectLink, fReferenceNames, fReferences, fSectionCounter, fTagStack, fTemplateRecursionCount, fTemplates, fTemplateTopic, fToCSet, logger| Constructor and Description |
|---|
WikiModel(Configuration configuration,
Locale locale,
INamespace namespace,
String imageBaseURL,
String linkBaseURL) |
WikiModel(Configuration configuration,
Locale locale,
String imageBaseURL,
String linkBaseURL) |
WikiModel(Configuration configuration,
String imageBaseURL,
String linkBaseURL) |
WikiModel(String imageBaseURL,
String linkBaseURL) |
| 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.
|
void |
addInclude(String pageName)
When a document contains a token indicating that the document includes an
other Wiki page, i.e.
|
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.
|
void |
appendInternalLink(String topic,
String hashSection,
String topicDescription,
String cssClass,
boolean parseRecursive)
Append an internal wikilink as described in Help Links
|
protected void |
appendInternalLink(String topic,
String hashSection,
String topicDescription,
String cssClass,
boolean parseRecursive,
boolean topicExists) |
protected String |
createImageName(ImageFormat imageFormat) |
Map<String,String> |
getCategories()
Get the set of Wikipedia category names used in this text
|
String |
getImageBaseURL()
Return a URL string which contains a "${image}" variable, which
will be replaced by the image name, to create links to images.
|
Set<String> |
getIncludes()
Gets the names of all included pages outside the template namespace.
|
Set<String> |
getLinks()
Get the set of Wikipedia link names
|
INamespace |
getNamespace()
Get the namespace of this model.
|
List<SemanticAttribute> |
getSemanticAttributes()
Get the list of SemanticAttributes
|
List<SemanticRelation> |
getSemanticRelations()
Get the list of SemanticRelations.
|
Set<String> |
getTemplates()
Gets the names of all included pages in the template namespace.
|
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.
|
void |
parseInternalImageLink(String imageNamespace,
String rawImageLink)
Append the internal wiki image link to this model.
|
boolean |
replaceColon()
Replace a colon ':' with a slash '/' in wiki names (i.e.
|
void |
setUp()
Prepare or initialize the wiki model before rendering the wikipedia text
|
static String |
toHtml(String rawWikiText)
Convert a given text in wiki notation into HTML text.
|
static void |
toHtml(String rawWikiText,
Appendable resultBuffer)
Convert a given text in wiki notation into HTML text.
|
static void |
toHtml(String rawWikiText,
Appendable resultBuffer,
String imageBaseURL,
String linkBaseURL)
Convert a given text in wiki notation into HTML text.
|
static void |
toText(IWikiModel model,
ITextConverter converter,
String rawWikiText,
Appendable resultBuffer,
boolean templateTopic,
boolean parseTemplates)
Convert a given text in wiki notation into another format.
|
addCodeFormatter, addInterwikiLink, addTemplateFunction, addTokenTag, addToReferences, addToTableOfContent, append, appendExternalImageLink, appendExternalLink, appendHead, appendInternalImageLink, appendInterWikiLink, appendISBNLink, appendMailtoLink, appendRawNamespaceLinks, appendRawWikipediaLink, appendRedirectLink, appendSignature, appendStack, buildEditLinkUrl, casing, createNewInstance, createScribuntoEngine, createTableOfContent, decrementRecursionLevel, decrementTemplateRecursionLevel, encodeTitleDotUrl, encodeTitleToUrl, getAttribute, getAttributeRenderer, getCodeFormatterMap, getCurrentTimeStamp, getFrame, getInterwikiMap, getLocale, getMagicWord, getNamespaceName, getNextNumber, getNode, getPageName, getRawWikiContent, getRecursionLevel, getRedirectLink, getReferences, getResourceBundle, getSimpleDateFormat, getTableOfContent, getTemplateCallsCache, getTemplateFunction, getTemplateMap, getTokenMap, getUriSchemeSet, getWikiBaseEditURL, getWikiListener, incrementRecursionLevel, incrementTemplateRecursionLevel, initialize, isCamelCaseEnabled, isEditorMode, isInterWiki, isMathtranRenderer, isNamespace, isNoToc, isParameterParsingMode, isPreviewMode, isSemanticWebActive, isTemplateTopic, isValidUriScheme, isValidUriSchemeSpecificPart, parseBehaviorSwitch, parseEvents, parseTemplates, parseTemplates, peekNode, popNode, pushNode, rawSetAttribute, reduceTokenStack, registerRenderer, render, render, render, render, render, renderPDF, setAttribute, setAttributeRenderers, setDefaultThumbWidth, setFrame, setNamespaceName, setNoToc, setPageName, setParameterParsingMode, setSemanticWebActive, setTemplateCallsCache, showSyntax, splitNsTitle, stackSize, substituteTemplateCall, swapStack, tearDownprotected Map<String,String> categories
protected List<SemanticRelation> semanticRelations
protected List<SemanticAttribute> semanticAttributes
public WikiModel(String imageBaseURL, String linkBaseURL)
imageBaseURL - a url string which must contains a "${image}"
variable which will be replaced by the image name, to create
links to images.linkBaseURL - a url string which must contains a "${title}"
variable which will be replaced by the topic title, to create
links to other wiki topics.public WikiModel(Configuration configuration, String imageBaseURL, String linkBaseURL)
public WikiModel(Configuration configuration, Locale locale, String imageBaseURL, String linkBaseURL)
public WikiModel(Configuration configuration, Locale locale, INamespace namespace, String imageBaseURL, String linkBaseURL)
public void addCategory(String categoryName, String sortKey)
IWikiModelsortKey see also Wikipedia:Categorization#Category_sortingaddCategory in interface IWikiModeladdCategory in class AbstractWikiModelcategoryName - 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 void addLink(String topicName)
IWikiModeladdLink in interface IWikiModeladdLink in class AbstractWikiModeltopicName - The name of the topic that is linked to.public boolean addSemanticAttribute(String attribute, String attributeValue)
IWikiModeladdSemanticAttribute in interface IWikiModeladdSemanticAttribute in class AbstractWikiModelpublic boolean addSemanticRelation(String relation, String relationValue)
IWikiModeladdSemanticRelation in interface IWikiModeladdSemanticRelation in class AbstractWikiModelpublic void addTemplate(String template)
IWikiModeladdTemplate in interface IWikiModeladdTemplate in class AbstractWikiModeltemplate - The name of the template that is being included (excluding the
template namespace).public void addInclude(String pageName)
IWikiModeladdInclude in interface IWikiModeladdInclude in class AbstractWikiModelpageName - The name of the page that is being included (including its
namespace).IWikiModel.addTemplate(String)public void appendInternalLink(String topic, String hashSection, String topicDescription, String cssClass, boolean parseRecursive)
IWikiModelappendInternalLink in interface IWikiModelappendInternalLink in class AbstractWikiModelcssClass - the links CSS class styleparseRecursive - TODOprotected void appendInternalLink(String topic, String hashSection, String topicDescription, String cssClass, boolean parseRecursive, boolean topicExists)
public Map<String,String> getCategories()
IWikiModelpublic Set<String> getLinks()
IWikiModelSet of link names 8i.e. [[...]] links)public List<SemanticAttribute> getSemanticAttributes()
IWikiModelgetSemanticAttributes in interface IWikiModelgetSemanticAttributes in class AbstractWikiModelnull if no
SemanticAttribute existspublic List<SemanticRelation> getSemanticRelations()
IWikiModelgetSemanticRelations in interface IWikiModelgetSemanticRelations in class AbstractWikiModelnull if no
SemanticRelation existspublic Set<String> getTemplates()
public Set<String> getIncludes()
public void parseInternalImageLink(String imageNamespace, String rawImageLink)
rawImageLink into different segments. The first segment is
used as the <image-name> and typically ends with
extensions like .png, .gif, .jpg
or .jpeg.
<size>px-<image-name>,
otherwise it's only the <image-name>.
imageNamespace - the image namespacerawImageLink - the raw image link text without the surrounding
[[...]]protected String createImageName(ImageFormat imageFormat)
public boolean replaceColon()
IWikiModelreplaceColon in interface IWikiModelreplaceColon in class AbstractWikiModelpublic void setUp()
IWikiModelsetUp in interface IWikiModelsetUp in class AbstractWikiModelpublic INamespace getNamespace()
IWikiModelpublic static void toText(IWikiModel model, ITextConverter converter, String rawWikiText, Appendable resultBuffer, boolean templateTopic, boolean parseTemplates) throws IOException
model - a wiki modelconverter - 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 textresultBuffer - the buffer to which to append the resulting HTML code.templateTopic - 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 static void toHtml(String rawWikiText, Appendable resultBuffer, String imageBaseURL, String linkBaseURL) throws IOException
rawWikiText - a raw wiki textresultBuffer - the buffer to which to append the resulting HTML code.imageBaseURL - a url string which must contains a "${image}"
variable which will be replaced by the image name, to create
links to images.linkBaseURL - a url string which must contains a "${title}"
variable which will be replaced by the topic title, to create
links to other wiki topics.IOExceptionpublic static void toHtml(String rawWikiText, Appendable resultBuffer) throws IOException
rawWikiText - a raw wiki textresultBuffer - the buffer to which to append the resulting HTML code.IOExceptionpublic static String toHtml(String rawWikiText)
rawWikiText - a raw wiki textnull, if an
IOException occured.public String getImageBaseURL()
IWikiModelgetImageBaseURL in interface IWikiModelgetImageBaseURL in class AbstractWikiModelIWikiModel.getWikiBaseURL(),
IWikiModel.getWikiBaseEditURL()public String getWikiBaseURL()
IWikiModel
https://en.wikipedia.org/wiki/${title}
getWikiBaseURL in interface IWikiModelgetWikiBaseURL in class AbstractWikiModelIWikiModel.getImageBaseURL(),
IWikiModel.getWikiBaseEditURL()Copyright © 2017 Java Wikipedia API (Bliki engine). All rights reserved.