Devhelp.Link¶
Fields¶
None
Methods¶
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Devhelp.Link¶
- classmethod new(type, book_link, name, relative_url)¶
- Parameters:
type (
Devhelp.LinkType) – theDevhelp.LinkType. Must be different thanDevhelp.LinkType.BOOK.book_link (
Devhelp.Link) – theDevhelp.Linkof typeDevhelp.LinkType.BOOKfor the book that the link is contained in.name (
str) – the name of the link.relative_url (
str) – the URL relative to the book base path. Can contain an anchor.
- Returns:
a new
Devhelp.Link.- Return type:
- classmethod new_book(base_path, book_id, book_title, relative_url)¶
- Parameters:
- Returns:
a new
Devhelp.Linkof typeDevhelp.LinkType.BOOK.- Return type:
New in version 3.28.
- belongs_to_page(page_id)¶
- Parameters:
page_id (
str) – a page ID, i.e. the filename without its extension.- Returns:
whether self belongs to page_id.
- Return type:
This function permits to know if self belongs to a certain page.
page_id is usually the HTML filename without the
.htmlextension. More generally, page_id must be a relative URL (relative to the book base path), without the anchor nor the file extension.For example if self has the relative URL
"DhLink.html#dh-link-ref", then this function will returnTrueif the page_id is"DhLink".New in version 3.28.
- compare(b)¶
- Parameters:
b (
Devhelp.Link) – aDevhelp.Link.- Returns:
an integer less than zero if self should appear before b; zero if there are no preferences; an integer greater than zero if b should appear before self.
- Return type:
Compares the links self and b. This function is used to determine in which order the links should be displayed.
- get_flags()¶
- Returns:
the
Devhelp.LinkFlagsof self.- Return type:
- get_link_type()¶
- Returns:
the
Devhelp.LinkTypeof self.- Return type:
- get_name()¶
- Returns:
the name of the self. For a link of type
Devhelp.LinkType.BOOK, returns the book title.- Return type:
- get_uri()¶
- Returns:
the self URI, or
Noneif getting the URI failed. Free withGLib.free() when no longer needed.- Return type:
Gets the self URI, by concateneting the book base path with the self relative URL.
- match_relative_url(relative_url)¶
- Parameters:
relative_url (
str) – an URL relative to the book base path. Can contain an anchor.- Returns:
whether the relative URL of self matches with relative_url. There is a special case for the index.html page, it can also match the empty string.
- Return type:
New in version 3.28.
- ref()¶
- Returns:
the self.
- Return type:
Increases the reference count of self.
Not thread-safe.
- set_flags(flags)¶
- Parameters:
flags (
Devhelp.LinkFlags) – the new flags of the link.
Sets the flags of the link.
- unref()¶
Decreases the reference count of self.
Not thread-safe.