MkModuleTable¶
Node for a table containing formatted information about a module.¶
Example: Regular
Jinja
{{ ["mknodes.info"] | MkModuleTable }}
Python
MkModuleTable([mknodes.info])
Name |
DocStrings |
Members |
|---|---|---|
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>
Name |
Children |
Inherits |
|---|---|---|
MkTemplateTable |
graph TD
1810812730["mkmoduletable.MkModuleTable"]
1225063181["mktemplatetable.MkTemplateTable"]
1359323199["mknode.MkNode"]
2751680898["builtins.object"]
1225063181 --> 1810812730
1359323199 --> 1225063181
2751680898 --> 1359323199
/home/runner/work/mknodes/mknodes/src/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 | getattr("__all__") | MkList(as_links=True, shorten_after=10)).to_html() }}
{% endif %}
"""
mknodes.templatenodes.mkmoduletable.MkModuleTable¶
14class MkModuleTable(mktemplatetable.MkTemplateTable):
15 """Node for a table containing formatted information about a module."""
16
17 ICON = "material/view-module-outline"
18
19 def __init__(
20 self,
21 modules: Sequence[types.ModuleType | str],
22 **kwargs,
23 ) -> None:
24 self.modules = [classhelpers.to_module(i, return_none=False) for i in modules]
25 super().__init__(**kwargs)
26
27 def iter_items(self):
28 yield from [
29 dict(module=module, griffe_module=grifferegistry.get_module(module))
30 for module in self.modules
31 ]
Page info
Code for this page
mknodes.manual.nodes_section.create_section_for_nodes¶
93def create_section_for_nodes(
94 nav: mk.MkNav,
95 klasses: Sequence[type[mk.MkNode]],
96) -> mk.MkTable:
97 table = mk.MkTable(columns=["Node", "Docstrings", "Markdown extensions"])
98 for kls in klasses:
99 tpl = "classpage_custom.jinja"
100 page = mk.MkClassPage(kls, icon=kls.ICON, template_path=tpl, parent=nav, hide="toc")
101 nav += page
102 if kls.STATUS:
103 page.metadata.status = kls.STATUS
104 elif kls.JS_FILES:
105 page.metadata.status = "js"
106 elif kls.CSS:
107 page.metadata.status = "css"
108 page.created_by = create_section_for_nodes
109 link = mk.MkLink(page, kls.__name__, icon=kls.ICON)
110 extensions = ", ".join(f"`{i}`" for i in kls.REQUIRED_EXTENSIONS)
111 table.add_row((link, kls.__doc__, extensions))
112 return table
Resources
Resources(css=[],
markdown_extensions={'admonition': {},
'pymdownx.details': {},
'pymdownx.highlight': {'anchor_linenums': True,
'line_spans': '__span',
'pygments_lang_class': True},
'pymdownx.superfences': {'custom_fences': [{'class': 'mermaid',
'format': <function fence_code_format at 0x7ff77e88b060>,
'name': 'mermaid'}]},
'pymdownx.tabbed': {},
'tables': {}},
plugins=[Plugin('mkdocstrings')],
js=[],
assets=[],
packages=[])
Metadata
created:
source_filename: /home/runner/work/mknodes/mknodes/src/mknodes/manual/nodes_section.py
source_function: create_section_for_nodes
source_line_no: 93
hide:
- toc
icon: material/view-module-outline
title: MkModuleTable