asciidoxy/generator/asciidoc.py
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.

        Args:
            file_name:         Relative or absolute path to the file to include. Relative paths are
                                   relative to the document calling include.
            leveloffset:       Offset of the top header of the inserted text from the top level
                                   header of the including document.
            link_text:         Text of the link which will be inserted when the output format is
                                   multi-paged.
            link_prefix:       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 ". ".
            multipage_link:    True to include a link in a multi-page document (default). Otherwise
                                   the separate document is generated but not linked from here.
            asciidoc_options:  Any additional option is added as an attribute to the include
                                   directive in single page mode.

        Returns:
            AsciiDoc text to include in the document.
        """

        file_path = Path(file_name)
        if not file_path.is_absolute():
            file_path = (self._current_file.parent / file_path).resolve()

        if not file_path.is_file():
            raise IncludeFileNotFoundError(file_name)

        sub_context = self._context.sub_context()
        if self._context.preprocessing_run:
            sub_context.current_document = DocumentTreeNode(file_path,
                                                            self._context.current_document)
            self._context.current_document.children.append(sub_context.current_document)
        else:
            sub_context.current_document = self._context.current_document.find_child(file_path)
            assert sub_context.current_document is not None

        out_file = _process_adoc(file_path, sub_context)
        if self._context.multipage:
            if multipage_link:
                referenced_file = relative_path(self._current_file, file_path)
                return (f"{link_prefix}"
                        f"<<{referenced_file}#,{link_text if link_text else referenced_file}>>")
            else:
                return ""

        asciidoc_options["leveloffset"] = leveloffset
        attributes = ",".join(f"{str(key)}={str(value)}" for key, value in asciidoc_options.items())

        rel_path = out_file.relative_to(self._current_file.parent)
        return f"include::{rel_path}[{attributes}]"
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.

        Args:
            file_name:         Relative or absolute path to the file to include. Relative paths are
                                   relative to the document calling include.
            leveloffset:       Offset of the top header of the inserted text from the top level
                                   header of the including document.
            link_text:         Text of the link which will be inserted when the output format is
                                   multi-paged.
            link_prefix:       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 ". ".
            multipage_link:    True to include a link in a multi-page document (default). Otherwise
                                   the separate document is generated but not linked from here.
            asciidoc_options:  Any additional option is added as an attribute to the include
                                   directive in single page mode.

        Returns:
            AsciiDoc text to include in the document.
        
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.
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 .
def include(self,
                file_name: str,
                leveloffset: str = "+1",
                link_text: str = "",
                link_prefix: str = "",
                multipage_link: bool = True,
                **asciidoc_options) -> str:
        file_path = Path(file_name)
        if not file_path.is_absolute():
            file_path = (self._current_file.parent / file_path).resolve()
        if not file_path.is_file():
            raise IncludeFileNotFoundError(file_name)
        sub_context = self._context.sub_context()
        if self._context.preprocessing_run:
            sub_context.current_document = DocumentTreeNode(file_path,
                                                            self._context.current_document)
            self._context.current_document.children.append(sub_context.current_document)
        else:
            sub_context.current_document = self._context.current_document.find_child(file_path)
            assert sub_context.current_document is not None
        out_file = _process_adoc(file_path, sub_context)
        if self._context.multipage:
            if multipage_link:
                referenced_file = relative_path(self._current_file, file_path)
                return (f"{link_prefix}"
                        f"<<{referenced_file}#,{link_text if link_text else referenced_file}>>")
            else:
                return ""
        asciidoc_options["leveloffset"] = leveloffset
        attributes = ",".join(f"{str(key)}={str(value)}" for key, value in asciidoc_options.items())
        rel_path = out_file.relative_to(self._current_file.parent)
        return f"include::{rel_path}[{attributes}]"
def include ( self , file_name : str , leveloffset : str = "+1" , link_text : str = "" , link_prefix : str = "" , multipage_link : bool = True , ** asciidoc_options ) -> str : file_path = Path ( file_name ) if not file_path . is_absolute ( ) : file_path = ( self . _current_file . parent / file_path ) . resolve ( ) if not file_path . is_file ( ) : raise IncludeFileNotFoundError ( file_name ) sub_context = self . _context . sub_context ( ) if self . _context . preprocessing_run : sub_context . current_document = DocumentTreeNode ( file_path , self . _context . current_document ) self . _context . current_document . children . append ( sub_context . current_document ) else : sub_context . current_document = self . _context . current_document . find_child ( file_path ) assert sub_context . current_document is not None out_file = _process_adoc ( file_path , sub_context ) if self . _context . multipage : if multipage_link : referenced_file = relative_path ( self . _current_file , file_path ) return ( f"{link_prefix}" f"<<{referenced_file}#,{link_text if link_text else referenced_file}>>" ) else : return "" asciidoc_options [ "leveloffset" ] = leveloffset attributes = "," . join ( f"{str(key)}={str(value)}" for key , value in asciidoc_options . items ( ) ) rel_path = out_file . relative_to ( self . _current_file . parent ) return f"include::{rel_path}[{attributes}]"
Include another AsciiDoc file, and process it to insert API references.
Include another AsciiDoc file and process it to insert API references .
"""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.

        Args:
            file_name:         Relative or absolute path to the file to include. Relative paths are
                                   relative to the document calling include.
            leveloffset:       Offset of the top header of the inserted text from the top level
                                   header of the including document.
            link_text:         Text of the link which will be inserted when the output format is
                                   multi-paged.
            link_prefix:       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 ". ".
            multipage_link:    True to include a link in a multi-page document (default). Otherwise
                                   the separate document is generated but not linked from here.
            asciidoc_options:  Any additional option is added as an attribute to the include
                                   directive in single page mode.

        Returns:
            AsciiDoc text to include in the document.
        """
AsciiDoc text to include in the document.
AsciiDoc text to include in the document .
self
file_name
str
Relative or absolute path to the file to include. Relative paths are
relative to the document calling include.
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.
Offset of the top header of the inserted text from the top level header of the including document .
link_text
str
Text of the link which will be inserted when the output format is
multi-paged.
Text of the link which will be inserted when the output format is multi - paged .
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 ".
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 " .
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.
True to include a link in a multi - page document ( default ) . Otherwise the separate document is generated but not linked from here .
asciidoc_options
Any additional option is added as an attribute to the include
directive in single page mode.
Any additional option is added as an attribute to the include directive in single page mode .