Package org.apache.wiki.parser

# 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`
`interWikiLinkAt(String page)`
Returns true, if this Link represents an InterWiki link (of the form wiki:page).
`boolean`
`isAccessRule(String link)`
Returns true, if the link in question is an access rule.
`boolean`
`isExternalLink(String page)`
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`
`isInterWikiLink(String page)`
Returns true, if this Link represents an InterWiki link (of the form wiki:page).
`boolean`
`isMetadata(String link)`
Returns true if the link is a metadata link.
`boolean`
`isPluginLink(String link)`
Returns true if the link is really command to insert a plugin.
`boolean`
`isVariableLink(String link)`
Returns true if the link is really command to insert a variable.
`boolean`
`linkExists(String page)`
Returns `true`, if the link name exists; otherwise it returns `false`.
`String`
`linkIfExists(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

### LinkParsingOperations

public LinkParsingOperations(org.apache.wiki.api.core.Context wikiContext)

## Method Details

### 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`.