Handler¶
Module containing the handler for ASP files.
log = logging.getLogger(__name__)
module-attribute
¶
project_data = tomllib.load(f)
module-attribute
¶
ASPHandler
¶
Bases: BaseHandler
MKDocStrings handler for ASP files.
__init__(theme: str = 'material', **_kwargs: Any) -> None
¶
Initialize the handler.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
theme
|
str
|
The theme to use for the handler. |
'material'
|
config_file_path
|
The path to the configuration file. |
required | |
paths
|
A list of paths to search for ASP files. |
required | |
locale
|
The locale to use for the handler. |
required | |
load_external_modules
|
Whether to load external modules. |
required | |
**kwargs
|
Keyword arguments. |
required |
collect(identifier: str, config: dict) -> dict | None
¶
Collect data from ASP files.
This function will be called for all markdown files annotated with '::: some/path/to/file.lp'.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier
|
str
|
The identifier used in the annotation. |
required |
config
|
dict
|
The configuration dictionary. |
required |
Returns:
Type | Description |
---|---|
dict | None
|
The collected data as a dictionary. |
do_convert_markdown_simple(text: str, heading_level: int) -> Markup
¶
parse_files(asp_parser: ASPParser, document_parser: DocumentParser, paths: list[Path]) -> dict[Path, Document]
¶
Parse the files at the given paths and return a dictionary of documents.
This also handles the inclusion of other files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
asp_parser
|
ASPParser
|
The ASP parser. |
required |
document_parser
|
DocumentParser
|
The document parser. |
required |
paths
|
list[Path]
|
The paths to parse. |
required |
Returns:
Type | Description |
---|---|
dict[Path, Document]
|
A dictionary of documents. |
render(data: dict, config: dict)
¶
Render the collected data to html.
This function will be called for all data
collected by the collect function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
dict
|
The data collected by the collect function. |
required |
config
|
dict
|
The configuration dictionary. |
required |
Returns:
Type | Description |
---|---|
The rendered data as a string |
ASPParser
¶
DependencyGraph
dataclass
¶
Document
dataclass
¶
A document representing the content of a particular ASP file.
DocumentParser
¶
EncodingInfo
dataclass
¶
Content of the encoding including statements and lines.
from_documents(documents: list[Document]) -> EncodingInfo
staticmethod
¶
Create a encoding content from an ASP document.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
document
|
The ASP document. |
required |
Returns:
Type | Description |
---|---|
EncodingInfo
|
The encoding content. |
PredicateInfo
dataclass
¶
predicates: Dict[str, Predicate] = field(default_factory=OrderedDict)
class-attribute
instance-attribute
¶
Dictionary of predicates with their signatures as keys.
from_documents(documents: dict[Document]) -> PredicateInfo
staticmethod
¶
Create a predicate list from a list of documents.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
documents
|
dict[Document]
|
The documents to create the predicate list from. |
required |
Returns:
Type | Description |
---|---|
PredicateInfo
|
The predicate list. |