Class WikiLink
java.lang.Object
com.lucaskjaerozhang.wikitext_parser.ast.base.WikiTextNode
com.lucaskjaerozhang.wikitext_parser.ast.base.WikiTextParentNode
com.lucaskjaerozhang.wikitext_parser.ast.link.WikiLink
- All Implemented Interfaces:
WikiTextElement
- Direct Known Subclasses:
CategoryLink
A link to a wiki page within this or other wikis.
Wikitext: [[article|display]] xml: wikilink
For more information about links you can look at WikiLinkTarget.
Why can't this just be a normal link? Because you don't have to specify the wiki if you're linking within the same wiki, and we don't have that information.
-
Constructor Summary
ConstructorsConstructorDescriptionWikiLink
(WikiLinkTarget linkTarget, List<WikiTextNode> linkText) Generates a wikilink. -
Method Summary
Modifier and TypeMethodDescription<T> Optional<T>
accept
(WikiTextASTVisitor<T> visitor) Hook for an AST visitor.Base case for getting element attributes.static String
Gets a wikilink that has the display text automatically generated.Methods inherited from class com.lucaskjaerozhang.wikitext_parser.ast.base.WikiTextParentNode
getCategories, getFieldValuesFromChildren, rebuildWithContext
-
Constructor Details
-
WikiLink
Generates a wikilink.- Parameters:
linkTarget
- The article the link points to.linkText
- The text to display.
-
-
Method Details
-
getAttributes
Description copied from class:WikiTextNode
Base case for getting element attributes. Most nodes have no attributes- Overrides:
getAttributes
in classWikiTextNode
- Returns:
- Attributes
-
accept
Description copied from class:WikiTextNode
Hook for an AST visitor.- Specified by:
accept
in classWikiTextNode
- Type Parameters:
T
- Whatever the visitor produces.- Parameters:
visitor
- The visitor doing the visitor.- Returns:
- Whatever the visitor produced.
-
getAutomaticallyReformattedDisplayName
Gets a wikilink that has the display text automatically generated.- Parameters:
target
- The link target.- Returns:
- A wikilink with an autoformatted display text.
-