Class LinkParsingOperations

java.lang.Object
org.apache.wiki.parser.LinkParsingOperations

public class LinkParsingOperations extends Object
Link parsing operations.
Since:
2.10.3
  • Constructor Summary

    Constructors
    Constructor
    Description
    LinkParsingOperations(org.apache.wiki.api.core.Context wikiContext)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns true, if this Link represents an InterWiki link (of the form wiki:page).
    boolean
    Returns true, if the link in question is an access rule.
    static boolean
    Tells if the link is a data: URL holding a PNG, GIF, JPEG or WebP image, such as the ones the WYSIWYG editor creates when an image is pasted.
    boolean
    Figures out if a link is an off-site link.
    boolean
    isImageLink(String link, boolean isImageInlining, List<org.apache.oro.text.regex.Pattern> inlineImagePatterns)
    Matches the given link to the list of image name patterns to determine whether it should be treated as an inline image or not.
    boolean
    Returns true, if this Link represents an InterWiki link (of the form wiki:page).
    boolean
    Returns true if the link is a metadata link.
    boolean
    Returns true if the link is really command to insert a plugin.
    boolean
    Returns true if the link is really command to insert a variable.
    boolean
    Returns true, if the link name exists; otherwise it returns false.
    Returns link name, if it exists; otherwise it returns null.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • isDataImage

      public static boolean isDataImage(String link)
      Tells if the link is a data: URL holding a PNG, GIF, JPEG or WebP image, such as the ones the WYSIWYG editor creates when an image is pasted. Those can be shown inline, as the browser only decodes them as an image.
      Parameters:
      link - the link to check
      Returns:
      true if the link is a base64 data: URL of a raster image
      Since:
      3.0.1
    • isAccessRule

      public boolean isAccessRule(String link)
      Returns true, if the link in question is an access rule.
      Parameters:
      link - The link text
      Returns:
      true, if this represents an access rule.
    • isPluginLink

      public boolean isPluginLink(String link)
      Returns true if the link is really command to insert a plugin.

      Currently we just check if the link starts with "{INSERT", or just plain "{" but not "{$".

      Parameters:
      link - Link text, i.e. the contents of text between [].
      Returns:
      True, if this link seems to be a command to insert a plugin here.
    • isMetadata

      public boolean isMetadata(String link)
      Returns true if the link is a metadata link.
      Parameters:
      link - The link text
      Returns:
      true, if this represents a metadata link.
    • isVariableLink

      public boolean isVariableLink(String link)
      Returns true if the link is really command to insert a variable.

      Currently we just check if the link starts with "{$".

      Parameters:
      link - The link text
      Returns:
      true, if this represents a variable link.
    • isInterWikiLink

      public boolean isInterWikiLink(String page)
      Returns true, if this Link represents an InterWiki link (of the form wiki:page).
      Returns:
      true, if this Link represents an InterWiki link, false otherwise.
    • interWikiLinkAt

      public int interWikiLinkAt(String page)
      Returns true, if this Link represents an InterWiki link (of the form wiki:page).
      Returns:
      true, if this Link represents an InterWiki link, false otherwise.
    • isExternalLink

      public boolean isExternalLink(String page)
      Figures out if a link is an off-site link. This recognizes the most common protocols by checking how it starts.
      Parameters:
      page - The link to check.
      Returns:
      true, if this is a link outside of this wiki.
    • isImageLink

      public boolean isImageLink(String link, boolean isImageInlining, List<org.apache.oro.text.regex.Pattern> inlineImagePatterns)
      Matches the given link to the list of image name patterns to determine whether it should be treated as an inline image or not.
    • linkExists

      public boolean linkExists(String page)
      Returns true, if the link name exists; otherwise it returns false.
      Parameters:
      page - link name
      Returns:
      true, if the link name exists; otherwise it returns false.
    • linkIfExists

      public String linkIfExists(String page)
      Returns link name, if it exists; otherwise it returns null.
      Parameters:
      page - link name
      Returns:
      link name, if it exists; otherwise it returns null.