Parsoid
A bidirectional parser between wikitext and HTML5
|
Represents the target of a wiki link. More...
Public Member Functions | |
getNamespace () | |
Get the namespace index. | |
inNamespace (int $ns) | |
Convenience function to check if the target is in a given namespace. | |
getFragment () | |
Get the link fragment in text form (i.e. | |
hasFragment () | |
Whether the link target has a fragment. | |
getDBkey () | |
Get the main part of the link target, in canonical database form. | |
getText () | |
Get the main part of the link target, in text form. | |
createFragmentTarget (string $fragment) | |
Create a new LinkTarget with a different fragment on the same page. | |
isExternal () | |
Whether this LinkTarget has an interwiki component. | |
getInterwiki () | |
The interwiki component of this LinkTarget. | |
isSameLinkAs (LinkTarget $other) | |
Check whether the given LinkTarget refers to the same target as this LinkTarget. | |
__toString () | |
Return an informative human-readable representation of the link target, for use in logging and debugging. | |
Represents the target of a wiki link.
Wikimedia\Parsoid\Core\LinkTarget::__toString | ( | ) |
Return an informative human-readable representation of the link target, for use in logging and debugging.
Wikimedia\Parsoid\Core\LinkTarget::createFragmentTarget | ( | string | $fragment | ) |
Create a new LinkTarget with a different fragment on the same page.
It is expected that the same type of object will be returned, but the only requirement is that it is a LinkTarget.
string | $fragment | The fragment override, or "" to remove it. |
Implemented in Wikimedia\Parsoid\Utils\Title, and Wikimedia\Parsoid\Utils\TitleValue.
Wikimedia\Parsoid\Core\LinkTarget::getDBkey | ( | ) |
Get the main part of the link target, in canonical database form.
The main part is the link target without namespace prefix or hash fragment. The database form means that spaces become underscores, this is also used for URLs.
Implemented in Wikimedia\Parsoid\Utils\Title, and Wikimedia\Parsoid\Utils\TitleValue.
Wikimedia\Parsoid\Core\LinkTarget::getFragment | ( | ) |
Get the link fragment in text form (i.e.
the bit after the hash #
).
Implemented in Wikimedia\Parsoid\Utils\Title, and Wikimedia\Parsoid\Utils\TitleValue.
Wikimedia\Parsoid\Core\LinkTarget::getInterwiki | ( | ) |
The interwiki component of this LinkTarget.
Implemented in Wikimedia\Parsoid\Utils\Title, and Wikimedia\Parsoid\Utils\TitleValue.
Wikimedia\Parsoid\Core\LinkTarget::getNamespace | ( | ) |
Get the namespace index.
Implemented in Wikimedia\Parsoid\Utils\Title, and Wikimedia\Parsoid\Utils\TitleValue.
Wikimedia\Parsoid\Core\LinkTarget::getText | ( | ) |
Get the main part of the link target, in text form.
The main part is the link target without namespace prefix or hash fragment. The text form is used for display purposes.
This is computed from the DB key by replacing any underscores with spaces.
Wikimedia\Parsoid\Core\LinkTarget::hasFragment | ( | ) |
Whether the link target has a fragment.
Wikimedia\Parsoid\Core\LinkTarget::inNamespace | ( | int | $ns | ) |
Convenience function to check if the target is in a given namespace.
int | $ns |
Wikimedia\Parsoid\Core\LinkTarget::isExternal | ( | ) |
Whether this LinkTarget has an interwiki component.
Wikimedia\Parsoid\Core\LinkTarget::isSameLinkAs | ( | LinkTarget | $other | ) |
Check whether the given LinkTarget refers to the same target as this LinkTarget.
Two link targets are considered the same if they have the same interwiki prefix, are in the same namespace, have the same main part, and the same fragment.
LinkTarget | $other |