Skip to content

robot.libdocpkg.builder

LibraryDocumentation

1
2
3
4
5
6
LibraryDocumentation(
    library_or_resource,
    name=None,
    version=None,
    doc_format=None,
)

Generate keyword documentation for the given library, resource or suite file.

:param library_or_resource: Name or path of the library, or path of a resource or a suite file. :param name: Set name with the given value. :param version: Set version to the given value. :param doc_format: Set documentation format to the given value. :return: :class:~.model.LibraryDoc instance.

This factory method is the recommended API to generate keyword documentation programmatically. It should be imported via the :mod:robot.libdoc module.

Example::

1
2
3
4
5
6
from robot.libdoc import LibraryDocumentation

lib = LibraryDocumentation('OperatingSystem')
print(lib.name, lib.version)
for kw in lib.keywords:
    print(kw.name)
Source code in src/robot/libdocpkg/builder.py
def LibraryDocumentation(library_or_resource, name=None, version=None, doc_format=None):
    """Generate keyword documentation for the given library, resource or suite file.

    :param library_or_resource:
        Name or path of the library, or path of a resource or a suite file.
    :param name:
        Set name with the given value.
    :param version:
        Set version to the given value.
    :param doc_format:
        Set documentation format to the given value.
    :return:
        :class:`~.model.LibraryDoc` instance.

    This factory method is the recommended API to generate keyword documentation
    programmatically. It should be imported via the :mod:`robot.libdoc` module.

    Example::

        from robot.libdoc import LibraryDocumentation

        lib = LibraryDocumentation('OperatingSystem')
        print(lib.name, lib.version)
        for kw in lib.keywords:
            print(kw.name)
    """
    libdoc = DocumentationBuilder().build(library_or_resource)
    if name:
        libdoc.name = name
    if version:
        libdoc.version = version
    if doc_format:
        libdoc.doc_format = doc_format
    return libdoc

DocumentationBuilder

Keyword documentation builder.

This is not part of Libdoc's public API. Use :func:LibraryDocumentation instead.