mwtp.title
- class mwtp.title.Title(name: str, *, namespace: int, parser: Parser)[source]
Represents a MediaWiki title.
This class is not meant to be used directly. Use
Parser.parse
instead.- __init__(name: str, *, namespace: int, parser: Parser) None [source]
Construct a Title object.
- Parameters:
name – The page name part of the title.
namespace – The namespace of the title.
parser – The parser which constructed the title.
Methods
- __add__(other: str) Title [source]
Add a string to this title’s full name and pass that to the parser.
A
Title
cannot be added to one another since there is no way to determine the namespace of the new title.
Properties
- property associated: Self | None
The title associated to this title, or
None
if there is no such title.
- property associated_namespace: int | None
The ID of the talk or subject namespace to which the title’s namespace is associated with.
- property associated_namespace_data: NamespaceData | None
An object containing all known information about the title’s associated namespace or
None
if there is no such namespace. This is retrieved from the parser.
- property associated_namespace_name: str | None
The localized name of the title’s associated namespace.
- property base: Self
A Title object representing the parent title of this title.
- property canonical_namespace_name: str | None
The canonical name of the title’s namespace.
- property extension: str | None
The extension part of a file name, if any.
- property fragments: tuple[str, ...]
If the namespace has
.subpages == True
, return a list of strings generated from splitting the title by/
. Else, return the name wrapped in a list.
- property full_name: str
The full title (i.e.
Namespace:Pagename
orPagename
).
- property in_content_namespace: bool
Whether the namespace of the title is a content namespace.
- property is_subpage: bool
Whether the title has a parent title.
- property name: str
The title without the namespace.
- property namespace: int
The title’s namespace ID.
- property namespace_data: NamespaceData
An object containing all known information about the title’s namespace. This is retrieved from the parser.
- property namespace_name: str
The localized name of the title’s namespace.
- property root: Self
A Title object representing the root title of this title.
- property subject: Self
The subject title correspond to this title. Can be itself if it is a subject title.
- property tail: str
The rightmost fragment of the title.
- property talk: Self | None
The talk title correspond to this title, or
None
if there is no such title.