Skip to content

MkModuleTable

Show source on GitHub

Node for a table containing formatted information about a module.

Example: Regular

Jinja

{{ ["mknodes.info"] | MkModuleTable }}

Python

MkModuleTable([mknodes.info])
Name DocStrings Members
mknodes.info Information/Metadata- related classes.
| Name | DocStrings | Members |
|--- | --- | --- |
| [mknodes.info](https://phil65.github.io/mknodes/) | Information/Metadata- related classes. |  |
<table>
<thead>
<tr>
<th>Name</th>
<th>DocStrings</th>
<th>Members</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://phil65.github.io/mknodes/">mknodes.info</a></td>
<td>Information/Metadata- related classes.</td>
<td></td>
</tr>
</tbody>
</table>

Bases: MkTemplateTable

Name Children Inherits
MkTemplateTable
mknodes.templatenodes.mktemplatetable
Node for a table showing dependencies for a package.
graph TD
  94721312350816["mkmoduletable.MkModuleTable"]
  94721312206496["mktemplatetable.MkTemplateTable"]
  94721308848336["mknode.MkNode"]
  94721311766592["node.Node"]
  140564252373184["builtins.object"]
  94721312206496 --> 94721312350816
  94721308848336 --> 94721312206496
  94721311766592 --> 94721308848336
  140564252373184 --> 94721311766592
/home/runner/work/mknodes/mknodes/mknodes/templatenodes/mkmoduletable/metadata.toml
[metadata]
icon = "mdi:view-module-outline"
name = "MkModuleTable"
group = "documentation"

[requirements.extension.tables]

[examples.regular]
title = "Regular"
jinja = """
{{ ["mknodes.info"] | MkModuleTable }}
"""

[layouts.default]
Name = """
{{ module | get_link }}
"""
DocStrings = """
{{ module | get_doc(fallback="*No docstrings defined.*", only_summary=True) }}
"""
Members = """
{% if module | hasattr("__all__") %}
{{ (module.__all__ | MkList(as_links=True, shorten_after=10)).to_html() }}
{% endif %}
"""
mknodes.templatenodes.mkmoduletable.MkModuleTable
class MkModuleTable(mktemplatetable.MkTemplateTable):
    """Node for a table containing formatted information about a module."""

    ICON = "material/view-module-outline"

    def __init__(
        self,
        modules: Sequence[types.ModuleType | str],
        **kwargs,
    ):
        self.modules = [classhelpers.to_module(i, return_none=False) for i in modules]
        super().__init__(**kwargs)

    def iter_items(self):
        yield from [
            dict(module=module, griffe_module=grifferegistry.get_module(module))
            for module in self.modules
        ]