• Devhelp 3.0 »
  • Structures »
  • Devhelp.Link
  • Devhelp.Link
    • Fields
    • Methods
    • Details
      • Devhelp.Link
        • Devhelp.Link.new()
        • Devhelp.Link.new_book()
        • Devhelp.Link.belongs_to_page()
        • Devhelp.Link.compare()
        • Devhelp.Link.get_book_id()
        • Devhelp.Link.get_book_title()
        • Devhelp.Link.get_flags()
        • Devhelp.Link.get_link_type()
        • Devhelp.Link.get_name()
        • Devhelp.Link.get_uri()
        • Devhelp.Link.match_relative_url()
        • Devhelp.Link.ref()
        • Devhelp.Link.set_flags()
        • Devhelp.Link.unref()
  • Devhelp 3.0 »
  • Structures »
  • Devhelp.Link
  • Devhelp.Link
    • Fields
    • Methods
    • Details
      • Devhelp.Link
        • Devhelp.Link.new()
        • Devhelp.Link.new_book()
        • Devhelp.Link.belongs_to_page()
        • Devhelp.Link.compare()
        • Devhelp.Link.get_book_id()
        • Devhelp.Link.get_book_title()
        • Devhelp.Link.get_flags()
        • Devhelp.Link.get_link_type()
        • Devhelp.Link.get_name()
        • Devhelp.Link.get_uri()
        • Devhelp.Link.match_relative_url()
        • Devhelp.Link.ref()
        • Devhelp.Link.set_flags()
        • Devhelp.Link.unref()

Devhelp.Link¶

Fields¶

None

Methods¶

class

new (type, book_link, name, relative_url)

class

new_book (base_path, book_id, book_title, relative_url)

belongs_to_page (page_id)

compare (b)

get_book_id ()

get_book_title ()

get_flags ()

get_link_type ()

get_name ()

get_uri ()

match_relative_url (relative_url)

ref ()

set_flags (flags)

unref ()

Details¶

class Devhelp.Link¶
classmethod new(type, book_link, name, relative_url)¶
Parameters:
  • type (Devhelp.LinkType) – the Devhelp.LinkType. Must be different than Devhelp.LinkType.BOOK.

  • book_link (Devhelp.Link) – the Devhelp.Link of type Devhelp.LinkType.BOOK for 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:

Devhelp.Link

classmethod new_book(base_path, book_id, book_title, relative_url)¶
Parameters:
  • base_path (str) – the base path for the book.

  • book_id (str) – the book ID.

  • book_title (str) – the name of the link.

  • relative_url (str) – the URL relative to the book base_path. Can contain an anchor. Usually the index.html page.

Returns:

a new Devhelp.Link of type Devhelp.LinkType.BOOK.

Return type:

Devhelp.Link

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:

bool

This function permits to know if self belongs to a certain page.

page_id is usually the HTML filename without the .html extension. 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 return True if the page_id is "DhLink".

New in version 3.28.

compare(b)¶
Parameters:

b (Devhelp.Link) – a Devhelp.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:

int

Compares the links self and b. This function is used to determine in which order the links should be displayed.

get_book_id()¶
Returns:

the ID of the book that the self is contained in.

Return type:

str

get_book_title()¶
Returns:

the title of the book that the self is contained in.

Return type:

str

get_flags()¶
Returns:

the Devhelp.LinkFlags of self.

Return type:

Devhelp.LinkFlags

get_link_type()¶
Returns:

the Devhelp.LinkType of self.

Return type:

Devhelp.LinkType

get_name()¶
Returns:

the name of the self. For a link of type Devhelp.LinkType.BOOK, returns the book title.

Return type:

str

get_uri()¶
Returns:

the self URI, or None if getting the URI failed. Free with GLib.free() when no longer needed.

Return type:

str or None

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:

bool

New in version 3.28.

ref()¶
Returns:

the self.

Return type:

Devhelp.Link

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.