Add templates and example files for Python, Go, and JavaScript
This commit is contained in:
87
doc2man/templates/markdown.j2
Normal file
87
doc2man/templates/markdown.j2
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
{% if title %}
|
||||||
|
# {{ title }}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% if data %}
|
||||||
|
{% for item in data %}
|
||||||
|
{% set file_path = item.file|default('Unknown', true) %}
|
||||||
|
{% set funcs = item.data.functions|default([], true) %}
|
||||||
|
{% set classes = item.data.classes|default([], true) %}
|
||||||
|
{% set desc = item.data.description|default('', true) %}
|
||||||
|
|
||||||
|
{% if desc %}
|
||||||
|
{{ desc }}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% if funcs %}
|
||||||
|
## Functions
|
||||||
|
|
||||||
|
{% for func in funcs %}
|
||||||
|
### `{{ func.name }}`
|
||||||
|
|
||||||
|
{% if func.description %}
|
||||||
|
{{ func.description }}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% if func.args|default([], true) %}
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
|------|------|-------------|
|
||||||
|
{% for param in func.args %}
|
||||||
|
| `{{ param.name }}` | `{{ param.type|default('', true) }}` | {{ param.description|default('', true) }} |
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% if func.returns %}
|
||||||
|
#### Returns
|
||||||
|
|
||||||
|
{% if func.returns.type %}`{{ func.returns.type }}` {% endif %}{{ func.returns.description|default('', true) }}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% if func.raises|default([], true) %}
|
||||||
|
#### Raises
|
||||||
|
|
||||||
|
{% for raise in func.raises %}
|
||||||
|
- `{{ raise.exception }}`: {{ raise.description|default('', true) }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% if func.examples|default([], true) %}
|
||||||
|
#### Examples
|
||||||
|
|
||||||
|
```python
|
||||||
|
{% for example in func.examples %}
|
||||||
|
{{ example }}
|
||||||
|
{% endfor %}
|
||||||
|
```
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
---
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% if classes %}
|
||||||
|
## Classes
|
||||||
|
|
||||||
|
{% for cls in classes %}
|
||||||
|
### `{{ cls.name }}`
|
||||||
|
|
||||||
|
{% if cls.description %}
|
||||||
|
{{ cls.description }}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% if cls.methods|default([], true) %}
|
||||||
|
#### Methods
|
||||||
|
|
||||||
|
{% for method in cls.methods %}
|
||||||
|
- `{{ method.name }}`: {% if method.description %}{{ method.description|first_line }}{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
---
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
No documentation found.
|
||||||
|
{% endif %}
|
||||||
Reference in New Issue
Block a user