Generator
yaarg.generators.base
Provides base generator implementation and utilities to build generators.
BaseGenerator
Base class for yaarg generators.
BaseGenerator#validate_options(options: dict)
Validates generator options.
Arguments
| Name | Type | Description | Default |
|---|---|---|---|
| options | dict | Raw options from markdown | - |
Returns
| Type | Description |
|---|---|
| dict | Validated options |
Details
The result is used as options parameter for generate() method.
BaseGenerator#generate(filepath: Path, symbol: Optional[str], options: dict)
Reads the source code and generates markdown blocks.
Decorators
@abstractmethod
Arguments
| Name | Type | Description | Default |
|---|---|---|---|
| filepath | Path | Path to the source code | - |
| symbol | Optional[str] | Symbol name | - |
| options | dict | Generator options. See also validate_options(). |
- |
Returns
| Type | Description |
|---|---|
| Iterable["markdown_block"] | Markdown blocks |
markdown_block
Represents markdown blocks.
markdown_block#write(text: str)
Appends text to the last input.
Arguments
| Name | Type | Description | Default |
|---|---|---|---|
| text | str | Appended text | - |
Returns
| Type | Description |
|---|---|
| - | - |
markdown_block#writeln(line: str)
Appends text to the last input and insert line break.
Arguments
| Name | Type | Description | Default |
|---|---|---|---|
| line | str | Appended line | - |
Returns
| Type | Description |
|---|---|
| - | - |
markdown_block#build()
Builds final markdown block.
Returns
| Type | Description |
|---|---|
| str | Markdown block contents |
markdown_heading
Represents markdown heading block.
markdown_paragraph
Represents markdown paragraph block.