___              _ _ ____
   /   |  __________(_|_) __ \____  _  ____  __
  / /| | / ___/ ___/ / / / / / __ \| |/_/ / / /
 / ___ |(__  ) /__/ / / /_/ / /_/ />  </ /_/ /
/_/  |_/____/\___/_/_/_____/\____/_/|_|\__, /
                                      /____/

Usage

Instructions for how to install and use AsciiDoxy to create your own AsciiDoc API reference documentation.

Requirements

To run AsciiDoxy you need at least:

To extract documentation from source code you need:

AsciiDoxy has been tested with:

  • python: 3.6, 3.7, 3.8

  • AsciiDoctor: 2.0.10

  • Doxygen: 1.8.16, 1.8.18, 1.8.20

Installation

The preferred way to install AsciiDoxy is to use pip:

pip3 install asciidoxy

Alternatively you can directly install the development version by cloning the source and running:

make install

Invocation

The minimal invocation takes only an input AsciiDoc file. In the AsciiDoc file you can execute any python code in Mako format. It creates a single page HTML document.

asciidoxy input_file.adoc

AsciiDoxy becomes more powerful if you specify a Package Specification file pointing to external resources and API reference documentation. It allows you to generate API reference in AsciiDoc files.

asciidoxy --spec-file package_spec.toml input_file.adoc

To see all command line options, run:

asciidoxy --help
    ___              _ _ ____             0.6.2
   /   |  __________(_|_) __ \____  _  ____  __
  / /| | / ___/ ___/ / / / / / __ \| |/_/ / / /
 / ___ |(__  ) /__/ / / /_/ / /_/ />  </ /_/ /
/_/  |_/____/\___/_/_/_____/\____/_/|_|\__, /
                                      /____/

usage: asciidoxy [-h] [-b BACKEND] [-B BUILD_DIR] [-D DESTINATION_DIR]
                 [-s SPEC_FILE] [-v VERSION_FILE] [-W] [--debug]
                 [--log LOG_LEVEL] [--force-language LANGUAGE] [--multipage]
                 INPUT_FILE

Generate API documentation using AsciiDoctor

positional arguments:
  INPUT_FILE            Input AsciiDoc file.

optional arguments:
  -h, --help            show this help message and exit
  -b BACKEND, --backend BACKEND
                        Set output backend format used by AsciiDoctor.
  -B BUILD_DIR, --build-dir BUILD_DIR
                        Build directory.
  -D DESTINATION_DIR, --destination-dir DESTINATION_DIR
                        Destination for generate documentation.
  -s SPEC_FILE, --spec-file SPEC_FILE
                        Package specification file.
  -v VERSION_FILE, --version-file VERSION_FILE
                        Version specification file.
  -W, --warnings-are-errors
                        Stop processing input files when a warning is
                        encountered.
  --debug               Store debug information.
  --log LOG_LEVEL       Set the log level.
  --force-language LANGUAGE
                        Force language used when parsing doxygen XML files.
                        Ignores the language specified in the XML files.
  --multipage           Generate multi-page document.

Preparing API reference

AsciiDoxy uses XML output from Doxygen to generate API reference documentation. To include the API reference documentation in AsciiDoc files you need to:

  1. Run Doxygen to extract the documentation from the source and store it in XML format.

  2. Specify where AsciiDoxy should look for the extracted documentation using a package specification file.

Running Doxygen

For extracting documentation from source code, AsciiDoxy relies on Doxygen. You are expected to run Doxygen on your source code, and then provide the path to the generated XML files to AsciiDoxy. It is recommended to set at least the following non-default settings in your Doxyfile when generating the XML.

C++

GENERATE_XML           = YES

Java

GENERATE_XML           = YES
JAVADOC_AUTOBRIEF      = YES
OPTIMIZE_OUTPUT_JAVA   = YES

Doxygen removes all annotations. To trick Doxygen into passing annotations to AsciiDoxy, you need to transform them into a name that does not contain @. AsciiDoxy supports changing type prefixes like __AT__Annotation__ back into @Annotation. For example to pass through all annotations with information about nullability, add the following to the Doxygen file:

FILTER_PATTERNS        = *.java="sed -E 's/@(Nullable|NonNull|CheckForNull|PossiblyNull)([[:space:]]+[[:alnum:]_])/__AT__\1__\2/g'"

Objective C

GENERATE_XML           = YES
EXTENSION_MAPPING      = h=objective-c
MACRO_EXPANSION        = YES
EXPAND_ONLY_PREDEF     = YES
PREDEFINED             = NS_ASSUME_NONNULL_BEGIN= NS_UNAVAILABLE=

Python

To fully support python docstrings formats like the Google Python Style Guide it is recommended to use doxypypy as a filter for Doxygen.

GENERATE_XML           = YES
FILTER_PATTERNS        = *.py="./py_filter.sh"

The contents of py_filter.sh should be:

#!/bin/bash
doxypypy -a -c $1 | sed 's/#        /# /'

The sed command is a workaround for a bug in doxypypy.

Alternatively you can disable MarkDown support and run doxypypy directly:

GENERATE_XML           = YES
FILTER_PATTERNS        = *.py="doxypypy -a -c"
MARKDOWN_SUPPORT       = NO

Support for type hints in Doxygen is still limited: https://github.com/doxygen/doxygen/issues/7320.

Package specification files

AsciiDoxy needs to know where to find the XML files containing the API reference documentation. It supports loading these files from a local directory or from a remote HTTP server. Package specification files describe where to collect the XML files.

A single location containing the XML files is called a package. The idea is that each package corresponds to an isolated component that can be included as a separate package. Documentation for separate packages can refer to each other when used in combination.

Packages can contain additional resources like images, example source code, and AsciiDoc files. These resources can be referred to from the input AsciiDoc files.

Package specification files use TOML format. They can contain the following sections:

packages

Specification of packages to include.

sources

Templates for similar packages.

Packages

The packages section is the only mandatory section. It contains a separate subsection for each package to include. The name of the subsection is the name of the package:

[packages]

[packages.package1]
# Specification of `package1`

[packages.package2]
# Specification of `package2`

A package has a specific type and based on the type different key/value pairs are required. For all types of packages the following key/value pairs are required:

type

The type of the package.

xml_subdir

Subdirectory in the root of the package in which all Doxygen XML files are stored.

include_subdir

Subdirectory in the root of the package in which all other include files are stored.

Packages of type local refer to a local directory. They require the following additional key/value pairs:

package_dir

Absolute or relative path to the directory containing the package.

Example:

[packages.local_package]
type = "local"
xml_subdir = "xml"
include_subdir = "adoc"
package_dir = "/path/to/my/package/"

Packages of type http are downloaded from a remote location. They can consist of multiple files, all of which need to be (compressed) tarballs. Each file can contain XML files, include files, or both.

The following additional key/value pairs are required:

url_template

Template for constructing the URL to download the package file from.

file_names

List of file names making up the package.

The following additional key/value pairs are optional:

version

Version number of the package.

The url_template can contain the following placeholders, that are replaced when creating the URL to download each package file:

{name}

Replaced with the name of the package.

{version}

Replaced with the version of the package.

{file_name}

Replaced with the file name.

Example:

[packages]

[packages.package1]
type = "http"
url_template = "https://example.com/{name}/{version}/{file_name}"
xml_subdir = "xml"
include_subdir = "adoc"
version = "12.3.4"

If no version is specified for the package, the version is retrieved from a version file. The version file is a comma separated values file containing pairs of package names and corresponding versions. It can contain any number of fields, but it is required to have a header containing the names Component name and Version for the columns containing these.

Example:

Component name, Version
package1,3.0.0
package2,4.5.1

Sources

The sources section allows specifying templates for packages. Each template can specify a common "source" of packages. With a source, settings that are duplicated for many packages can be specified only once.

A source section can contain every key/value pair that is allowed for a package. Packages can specify the source they are based on by using the source key/value pair.

When a source is used, the key/value pairs of the source and the pacakge are merged. Values for keys that are present in both the package and the source will be taken from the package. So the package values override source values.

Example:

[sources]

[sources.remote_server]
type = "http"
url_template = "https://example.com/{name}/{version}/{file_name}"
xml_subdir = "xml"
include_subdir = "adoc"

[packages]

[packages.package1]
source = "remote_server"
version = "12.3.4"

Writing documentation

AsciiDoxy works on documentation written in AsciiDoc. AsciiDoctor is used for the tranformation to the output format. All AsciiDoc Syntax supported by AsciiDoctor can be used. For a detailed reference see the AsciiDoctor Manual

To customize the documentation before it is processed by AsciiDoctor, AsciiDoxy allows using Mako syntax in the AsciiDoc files. Mako syntax looks like ${…​} where …​ can contain any valid python code. This python code is executed when the file is processed by AsciiDoxy.

A special object api is added to the Mako context when the document is processed. The object can be used in places where Mako executes python code, usualy the ${…​} blocks. It provides methods to insert API reference documentation and link to its elements.

Inserting API reference

The original purpose of AsciiDoxy is to insert API reference documentation in AsciiDoc files. Use the api.insert method to insert API reference documentation at the current location.

${api.insert(<name>,
             [kind=<kind>,]
             [lang=<language>,]
             [leveloffset]),
             [...]}
${api.insert_<kind>(<name>,                   (1)
                    [lang=<language>,]
                    [leveloffset=<offset>]),
                    [...]}
1 Alternative way to specify the kind of element to insert.

The insert method takes the following arguments:

name

Name of the element to insert. This can be the fully qualified name, or if a [_namespace] is set, a relative name.

lang

Optional. Name of the programming language.

kind

Optional. Kind of element to insert.

leveloffset

Optional. Offset for the headers in the reference from the top level of the current file. Defaults to +1.

Trying to insert an unknown element will result in an error.

When not specifying the language and kind, AsciiDoxy will try to find the element by name, and deduce the kind and language. If there are multiple matching elements, an error is raised.

You can add additional options. These options are added as attributes to the inserted include directive for the API reference fragment. For available attributes see the AsciiDoctor manual.

Examples

${api.insert("MyNamespace::MyClass")}                                    (1)
${api.insert("com.tomtom.Class", leveloffset="+2")}                      (2)
${api.insert("com.tomtom.Class", kind="class")}                          (3)
${api.insert("MyNamespace::FreeFunction", lang="c++")}                   (4)
${api.insert_class("MyNamespace::MyClass")}                              (5)
${api.insert_function("MyNamespace::FreeFunction", lang="c++")}          (6)
1 Insert API reference for the element named MyNamespace::MyClass.
2 Insert API reference for the element named com.tomtom.Class using an alternative level offset for the headers in the API reference.
3 Insert API reference for the class named com.tomtom.Class. Elements of other types are ignored.
4 Insert API reference for the C++ element named MyNamespace::FreeFunction. Other languages are ignored.
5 Insert API reference for the class named MyNamespace::MyClass. Alternative syntax.
6 Insert API reference for the C++ function named MyNamespace::FreeFunction. Alternative syntax.

Filtering what is inserted

By default api.insert inserts all contents of the API element. You can control which members, inner classes, enum values, and exceptions get inserted for each call to api.insert.

${api.insert(...,
             [members=<filter_spec>,]
             [inner_classes=<filter_spec>,]
             [enum_values=<filter_spec>,]
             [exceptions=<filter_spec>])}

A filter specification is either a single string, a list of strings, or a dictionary.

A single string is the same as a list of strings with just one item.

A list of strings defines a set of regular expressions to be applied to the name. They are applied in the order they are specified. If the element is still included after all filters have been applied, it is inserted.

Each string can have the following value: NONE:: Exclude all elements. ALL:: Include all elements. <regular expression> or +<regular expression:: Include elements that match the regular expression. -<regular expression>:: Exclude elements that match the regular expression.

If the first string is an include regular expression, an implicit NONE is prepended, if the first string is an exclude regular expression, an implicit ALL is prepended.

Some filters support filtering on other properties than the name. By default they only filter on the name. To filter the other properties use a dictionary, where the key is the name of the property, and the value is a string or list of strings with the filter.

Global filters

A global filter can be set that applies to every api.insert after it is set using api.filter.

${api.filter([members=<filter_spec>,]
             [inner_classes=<filter_spec>,]
             [enum_values=<filter_spec>,]
             [exceptions=<filter_spec>])}

The global filter applies to every call to api.insert in the same file, after it is set. It also applies to any file included after it is set.

Filters can be overridden in included files. At the end of the file, the original filter is restored.

Combining filter specifications

When an api.insert call contains additional filter specifications, these specifications are added to the end of the global filter specifications:

${api.filter(members=["add", "update"])}
${api.insert("name", members=["remove"])}

# Is equal to
${api.insert("name", members=["add", "update", "remove"])}

Filters added in api.insert are always added to the end. If there is no corresponding global filter specification, it is treated as a new filter, and NONE or ALL is prepended if needed.

The global filter can be overridden for some calls to api.insert. Then only the explicit filter specifications on that call are used:

${api.insert(...,
             ignore_global_filter=True,
             [members=<filter_spec>,]
             [inner_classes=<filter_spec>,]
             [enum_values=<filter_spec>,]
             [exceptions=<filter_spec>])}

Linking to API reference

Use api.link to insert a link to an API reference element.

${api.link(<name>,
           [kind=<kind>,]
           [lang=<language>,]
           [text=<alt_text>,]
           [full_name=<True/False>,]
           [allow_overloads=<True/False>])}
${api.link_<kind>(<name>,                     (1)
                  [lang=<language>,]
                  [text=<alt_text>,]
                  [full_name=<True/False>,]
                  [allow_overloads=<True/False>])}
1 Alternative way to specify the kind of element to link to.

By default the short name of the element is used as the text of the link.

name

Fully qualified name of the element to insert.

lang

Name of the programming language.

kind

Kind of element to insert.

text

Alternative text to use for the link.

full_name

Use the fully qualified name of the referenced element.

allow_overloads

True to link to the first match in an overload set.

A warning is shown if the element is unknown, or is not inserted in the same document using the insert method. There is a command-line option to throw an error instead.

When not specifying the language and kind, AsciiDoxy will try to find the element by name, and deduce the kind and language. If there are multiple matching elements, an error is raised.

Function or method overloads

In languages that support overloading functions, methods or other callables, the name alone is not sufficient to select the correct element to link to or to insert. By default AsciiDoxy will create a link to the first member of the overload. In case you need to link to a specific overload the exact list of types of the parameters can be provided to select the right element.

The list of parameter types should be specified in parentheses after the function name:

${api.link("MyFunction(int, std::string)")}

Empty parentheses indicate the function should accept no parameters:

${api.link("MyFunction()")}

If no parentheses are given, the parameters are ignored. If there are multiple overloads, AsciiDoxy will not be able to pick one:

${api.link("MyFunction")}

Examples

${api.link("MyNamespace::MyClass")}                            (1)
${api.link("MyNamespace::MyClass", lang="c++")}                (2)
${api.link("com.tomtom.Class.Method", full_name=True)}         (3)
${api.link("MyNamespace::FreeFunction", text="FreeFunction")}  (4)
${api.link_class("MyNamespace::MyClass")}                      (5)
${api.link_class("MyNamespace::MyClass", lang="c++")}          (6)
1 Link to any element called MyNamespace::MyClass.
2 Link to any C++ element called MyNamespace::MyClass. Other languages are ignored.
3 Link to com.tomtom.Class.Method and use the fully qualified name for the link text.
4 Link to MyNamespace::FreeFunction and use "FreeFunction" for the link text.
5 Link to class MyNamespace::MyClass. Ignore other kinds of elements.
6 Link to C++ class MyNamespace::MyClass. Ignore other kinds of elements and languages.

Including other AsciiDoc files

AsciiDoc has the include directive to embed other AsciiDoc files in the current file. AsciiDoxy extends this directive with its api.include method for 2 reasons:

  1. Perform preprocessing on the included AsciiDoc files. When using the normal include directive, AsciiDoxy will not preprocess the included file.

  2. Extend the include functionality, for example with multi-page support.

${api.include(<file_name>,
              [leveloffset=<offset>,]
              [link_text=<text>,]
              [link_prefix=<prefix>,]
              [multipage_link=<bool>],
              [...])}
file_name

Relative or absolute path to the file to include.

leveloffset

Offset for the headers in the included file from the top level of the current file. Defaults to +1.

In single-page mode, the default, the file to include is preprocessed by AsciiDoxy. Then a normal include directive is inserted pointing to the preprocessed file. This embeds the file in the same output document.

In multi-page mode, the preprocessed file is not embedded. Instead, a separate output file is generated, and a link to that file is inserted. The format of the link is controlled with additional arguments:

link_text

Text for the link to insert in multi-page mode.

link_prefix

Text to insert before the link in multi-page mode. Use this to create for example a numbered list of links.

multipage_link

By default a link is inserted in multi-page mode. Set this to False to omit inserting the link. The included file is still processed. Use [cross_referencing] to insert a link elsewhere in the document.

You can add additional options. These options are added as attributes to the inserted include directive for the API reference fragment. For available attributes see the AsciiDoctor manual.

Examples

${api.include("component/reference.adoc")}                                           (1)
${api.include("/mount/data/reference.adoc", leveloffset="+3")}                       (2)
${api.include("component/reference.adoc", link_text="Reference", link_prefix=". ")}  (3)
${api.include("/component/reference.adoc", multipage_link=False)}                   (4)
1 Include and process component/reference.adoc relative to this file.
2 Include and process /mount/data/reference.adoc as an absolute path to the file. Increase the level of the headers by 3.
3 In multi-page mode use the link text "Reference" and prefix with a dot to create a numbered list. In single-page mode the document is embedded.
4 In multi-page mode process the file, but do not create a link to it. In single page mode the document is embedded.

Cross-referencing sections in other AsciiDoc files

In multi-page mode, normal cross references to anchors in included files do not work. A link to the appropariate file needs to be created. For this there is api.cross_document_ref.

${api.cross_document_ref(<file_name>,
                         anchor=<section-anchor>,
                         [link_text=<text>])}
file_name

File containing the anchor to link to.

anchor

Anchor to link to.

link_text

Text to use for the link. If not provided, the anchor name is used.

Examples

${api.cross_document_ref("component/component_a.adoc", anchor="section-1")}  (1)
${api.cross_document_ref("component/component_a.adoc", anchor="section 1",   (2)
                         link_text="Component A - Section 1")}
1 Insert a link with text "section-1".
2 Insert a link with text "Component A - Section 1".

Setting default programming language

When all documentation in a file is for the same programming language, you can set the default language to use for every command using api.language.

${api.language(<language>)}

Other languages will be ignored, unless overridden with a lang argument. This setting also applies to all files included afterwards, but resets and the end of the current file.

language

Language to use as default, or None to reset.

Examples

${api.language("cpp")}  (1)
${api.language("c++")}  (2)
${api.language("java")} (3)
${api.language(None)}   (4)
1 Set the default language to C++.
2 Set the default language to C++. Alternative language name.
3 Set the default language to Java.
4 Remove the default language.

Search namespace

By default AsciiDoxy searches for API elements using their fully qualified name. For languages that support namespaces, a search namespace can be set to start looking for elements using a relative name. The api.namespace sets the search namespace.

${api.namespace(<namespace>)}
namespace

Namespace to start the search from, or None to reset.

AsciiDoxy tries to search the same way the program language would. It searches the selected namespace, but also every namespace above it, until it finds a match. This includes the root namespace if nothing is found earlier.

Examples

${api.namespace("org.asciidoxy.parser")}  (1)
${api.namespace("asciidoxy::example")}    (2)
${api.namespace(None)}                    (3)
1 Search in the Java package org.asciidoxy.parser.
2 Search in the C++ namespace asciidoxy::exmaple.
3 Only allow fully qualified names from now on.

Required version

Your documentation may require features of a specific version of AsciiDoxy. It may also use features that are changed in a future version. To make sure your documentation is always generated with a compatible version of AsciiDoxy, you can specify a required version or version range.

${api.require_version(<specifier>)}
specifier

One or more comma-separated version specifiers matching the PEP 440 standard.

The version specifiers follow PEP 440, which is the same standard for specifying python package versions installed with pip.

Examples

${api.require_version("==0.5.3")}       (1)
${api.require_version("~=0.5.3")}       (2)
${api.require_version(">=0.5.3")}       (3)
${api.require_version(">=0.5.3,<0.7")}  (4)
1 Require version 0.5.3. Allow no other versions.
2 Require version 0.5.3 and any newer version that is compatible. In this case patch increments are allowed, but minor and major increments are not.
3 Require version 0.5.3 and any newer version, including versions with breaking changes.
4 Require version 0.5.3 and above, but below version 0.7.

Multi-page table of contents

In multi-page mode the table of contents generated by AsciiDoctor only contains the sections for each specific page. The contents of other pages in the tree are not visible. You can add an extra table of contents listing each separate page.

${api.multipage_toc([side=<left/right>])}
side

Side of the page to put the table of contents, similar to the AsciiDoc option. Defaults to the left side.

In the table of contents, only the first document title encountered in each AsciiDoc file is used. For documents having multiple titles, like the book type, the other titles are ignored.

It can be combined with the normal AsciiDoctor table of contents. If both tables are configured to appear on the same side, they will hide eachother, so make sure you choose different sides.

The command should be included in the document header. If that is not possible, make sure the document header contains at least:

:docinfo: private

Examples

${api.multipage_toc()}              (1)
${api.multipage_toc(side="left")}   (2)
${api.multipage_toc(side="right")}  (3)
1 Insert a multi-page ToC on the left side of the document (default).
2 Same as above, but with explicit side.
3 Insert a multi-page ToC on the right side of the document.

Reference

Api

class asciidoxy.generator.asciidoc.Api

Methods to insert and link to API reference documentation from AsciiDoc files.

Methods

filter

Set a default filter used when inserting API reference documentation.

insert

Insert API reference documentation.

link

Insert a link to API reference documentation.

cross_document_ref

AsciiDoc cross-document reference.

include

Include another AsciiDoc file, and process it to insert API references.

language

Set the default language for all following commands.

namespace

Set the namespace to start searching for elements for all following commands.

Members
def filter(self,
           members: *Optional[FilterSpec] = None,
           inner_classes: Optional[FilterSpec] = None,
           enum_values: Optional[FilterSpec] = None,
           exceptions: Optional[FilterSpec] = None) -> str

Set a default filter used when inserting API reference documentation.

The filter controls which members of an element are inserted. Only the members matching the filter are inserted, the others are ignored. Depending on the exact type of element inserted, its members, inner classes, enum values and/or exceptions can be filtered.

A filter specification is either a single string, a list of strings, or a dictionary.

A single string is the same as a list of strings with just one item.

A list of strings defines a set of regular expressions to be applied to the name. They are applied in the order they are specified. If the element is still included after all filters have been applied, it is inserted.

Each string can have the following value:

  • NONE: Exclude all elements.

  • ALL: Include all elements.

  • <regular expression> or +<regular expression: Include elements that match the regular expression.

  • -<regular expression>: Exclude elements that match the regular expression.

If the first string is an include regular expression, an implicit NONE is prepended, if the first string is an exclude regular expression, an implicit ALL is prepended.

Some filters support filtering on other properties than the name. By default they only filter on the name. To filter the other properties use a dictionary, where the key is the name of the property, and the value is a string or list of strings with the filter.

Parameters

members: *Optional[FilterSpec]

Filter to apply to members of a compound. Supports filtering on name, kind, and `prot`ection level.

Default value: None

inner_classes: Optional[FilterSpec]

Filter to apply to inner classes of a compound. Supports filtering on name and kind.

Default value: None

enum_values: Optional[FilterSpec]

Filter to apply to enum values of a compound or member. Supports filtering on name only.

Default value: None

exceptions: Optional[FilterSpec]

Filter to apply to exceptions thrown by a member. Supports filtering on the name of the exception type only.

Default value: None

Returns

str

An empty string.


def insert(self,
           name: str,
           kind: *Optional[str] = None,
           lang: Optional[str] = None,
           members: Optional[FilterSpec] = None,
           inner_classes: Optional[FilterSpec] = None,
           enum_values: Optional[FilterSpec] = None,
           exceptions: Optional[FilterSpec] = None,
           ignore_global_filter: bool = False,
           leveloffset: str = "+1",
           asciidoc_options: **) -> str

Insert API reference documentation.

Only name is mandatory. Multiple names may match the same name. Use kind and lang to disambiguate.

For the supported format of the filter arguments see Api.filter().

Parameters

name: str

Fully qualified name of the object to insert.

kind: *Optional[str]

Kind of object to generate reference documentation for.

Default value: None

lang: Optional[str]

Programming language of the object.

Default value: None

members: Optional[FilterSpec]

Filter to apply to members of a compound. Supports filtering on name, kind, and `prot`ection level.

Default value: None

inner_classes: Optional[FilterSpec]

Filter to apply to inner classes of a compound. Supports filtering on name and kind.

Default value: None

enum_values: Optional[FilterSpec]

Filter to apply to enum values of a compound or member. Supports filtering on name only.

Default value: None

exceptions: Optional[FilterSpec]

Filter to apply to exceptions thrown by a member. Supports filtering on the name of the exception type only.

Default value: None

ignore_global_filter: bool

True to ignore the global filter set with Api.filter(). False to apply the filters on top of the global filter.

Default value: False

leveloffset: str

Offset of the top header of the inserted text from the top level header of the including document.

Default value: "+1"

asciidoc_options: **

Any additional option is added as an attribute to the include directive in single page mode.

Returns

str

AsciiDoc text to include in the document.


def link(self,
         name: str,
         kind: *Optional[str] = None,
         lang: Optional[str] = None,
         text: Optional[str] = None,
         full_name: bool = False,
         allow_overloads: bool = True) -> str

Insert a link to API reference documentation.

Only name is mandatory. Multiple names may match the same name. Use kind and lang to disambiguate.

Parameters

name: str

Fully qualified name of the object to link to.

kind: *Optional[str]

Kind of object to link to.

Default value: None

lang: Optional[str]

Programming language of the object.

Default value: None

text: Optional[str]

Alternative text to use for the link. If not supplied, the object name is used.

Default value: None

full_name: bool

Use the fully qualified name of the object for the link text.

Default value: False

allow_overloads: bool

Link to the first match in an overload set. Enabled by default.

Default value: True

Returns

str

AsciiDoc text to include in the document.


def cross_document_ref(self,
                       file_name: str,
                       anchor: str,
                       link_text: str = None) -> str

AsciiDoc cross-document reference.

Since AsciiDoxy in multi-page mode generates intermediate AsciiDoc files and process them with AsciiDoctor in order to create final output document(s) the direct AsciiDoc syntax (i.e. link_tex) doesn’t work. You must use this method instead.

Parameters

file_name: str

Relative or absolute path to the referred AsciiDoc file. Relative paths are relative to the document calling the method.

anchor: str

Anchor to the referred section in the referred AsciiDoc document.

link_text: str

Text of the reference. If None, anchor will be used as text of the

Default value: None

Returns

str

AsciiDoc cross-document reference.


def include(self,
            file_name: str,
            leveloffset: str = "+1",
            link_text: str = "",
            link_prefix: str = "",
            multipage_link: bool = True,
            asciidoc_options: **) -> str

Include another AsciiDoc file, and process it to insert API references.

If the output format is multi-paged, the method will cause generation of separate output document for the included AsciiDoc document and optional insertion of link referring to the document.

Parameters

file_name: str

Relative or absolute path to the file to include. Relative paths are relative to the document calling include.

leveloffset: str

Offset of the top header of the inserted text from the top level header of the including document.

Default value: "+1"

link_text: str

Text of the link which will be inserted when the output format is multi-paged.

Default value: ""

link_prefix: str

Optional text which will be inserted before the link when the output format is multi-paged. It can be used for example to compose a list of linked subdocuments by setting it to ". ".

Default value: ""

multipage_link: bool

True to include a link in a multi-page document (default). Otherwise the separate document is generated but not linked from here.

Default value: True

asciidoc_options: **

Any additional option is added as an attribute to the include directive in single page mode.

Returns

str

AsciiDoc text to include in the document.


def language(self,
             lang: Optional[str]) -> str

Set the default language for all following commands.

Elements will then only be inserted for that language, and other languages are ignored. The language can still be overridden with the lang keyword. Files included after this command will also be affected.

Parameters

lang: Optional[str]

Returns

str

def namespace(self,
              namespace: Optional[str]) -> str

Set the namespace to start searching for elements for all following commands.

If the element cannot be found in this namespace, it is also searched as a fully qualified name. Files included after this command will also be affected.

Parameters

namespace: Optional[str]

The namespace to search, or None to reset. The namespace should use the language specific namespace separator and should also include the separator between the namespace and the short name.

Returns

str

Prev Up
Home
Next
AsciiDoxy