Class LinkParsingOperations

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

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

    Constructors
    Constructor Description
    LinkParsingOperations​(Context wikiContext)  
  • Method Summary

    Modifier and Type Method Description
    int interWikiLinkAt​(java.lang.String page)
    Returns true, if this Link represents an InterWiki link (of the form wiki:page).
    boolean isAccessRule​(java.lang.String link)
    Returns true, if the link in question is an access rule.
    boolean isExternalLink​(java.lang.String page)
    Figures out if a link is an off-site link.
    boolean isImageLink​(java.lang.String link, boolean isImageInlining, java.util.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 isInterWikiLink​(java.lang.String page)
    Returns true, if this Link represents an InterWiki link (of the form wiki:page).
    boolean isMetadata​(java.lang.String link)
    Returns true if the link is a metadata link.
    boolean isPluginLink​(java.lang.String link)
    Returns true if the link is really command to insert a plugin.
    boolean isVariableLink​(java.lang.String link)
    Returns true if the link is really command to insert a variable.
    boolean linkExists​(java.lang.String page)
    Returns true, if the link name exists; otherwise it returns false.
    java.lang.String linkIfExists​(java.lang.String page)
    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

    • isAccessRule

      public boolean isAccessRule​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.String link, boolean isImageInlining, java.util.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​(java.lang.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 java.lang.String linkIfExists​(java.lang.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.