All Implemented Interfaces:
WikiTextElement
Direct Known Subclasses:
CategoryLink

public class WikiLink extends WikiTextParentNode
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 Details

    • WikiLink

      public WikiLink(WikiLinkTarget linkTarget, List<WikiTextNode> linkText)
      Generates a wikilink.
      Parameters:
      linkTarget - The article the link points to.
      linkText - The text to display.
  • Method Details

    • getAttributes

      public List<NodeAttribute> getAttributes()
      Description copied from class: WikiTextNode
      Base case for getting element attributes. Most nodes have no attributes
      Overrides:
      getAttributes in class WikiTextNode
      Returns:
      Attributes
    • accept

      public <T> Optional<T> accept(WikiTextASTVisitor<T> visitor)
      Description copied from class: WikiTextNode
      Hook for an AST visitor.
      Specified by:
      accept in class WikiTextNode
      Type Parameters:
      T - Whatever the visitor produces.
      Parameters:
      visitor - The visitor doing the visitor.
      Returns:
      Whatever the visitor produced.
    • getAutomaticallyReformattedDisplayName

      public static String getAutomaticallyReformattedDisplayName(WikiLinkTarget target)
      Gets a wikilink that has the display text automatically generated.
      Parameters:
      target - The link target.
      Returns:
      A wikilink with an autoformatted display text.