Add templates and example files for Python, Go, and JavaScript
Some checks failed
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled

This commit is contained in:
2026-01-31 00:58:43 +00:00
parent c616f61484
commit 44727c5071

View File

@@ -0,0 +1,78 @@
.TH {{ title|upper|replace(' ', '_') }} {{ section }}
.SH NAME
{% if data %}
{% for item in data %}
{% set funcs = item.data.functions|default([], true) %}
{% if funcs %}
{% for func in funcs %}
{{ func.name }} \- {{ func.description|first_line if func.description else '' }}
{% endfor %}
{% else %}
{{ title }} \- {{ item.data.description|first_line if item.data.description else '' }}
{% endif %}
{% endfor %}
{% else %}
{{ title }} \- Documentation generated by Doc2Man
{% endif %}
.SH SYNOPSIS
{% if data %}
{% for item in data %}
{% set funcs = item.data.functions|default([], true) %}
{% if funcs %}
{% for func in funcs %}
.B {{ func.name }}
{% for param in func.args|default([], true) %}
.I {{ param.name }}
{% endfor %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
.SH DESCRIPTION
{% if data %}
{% for item in data %}
{{ item.data.description|default('', true) }}
{% endfor %}
{% else %}
This manual page documents the command-line interface for {{ title }}.
{% endif %}
.SH OPTIONS
{% if data %}
{% for item in data %}
{% set funcs = item.data.functions|default([], true) %}
{% if funcs %}
{% for func in funcs %}
{% for param in func.args|default([], true) %}
.TP
.B {{ param.name }}
{% if param.type %}({{ param.type }}){% endif %}
{{ param.description|default('', true) }}
{% endfor %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
.SH EXAMPLES
{% if data %}
{% for item in data %}
{% set funcs = item.data.functions|default([], true) %}
{% if funcs %}
{% for func in funcs %}
{% for example in func.examples|default([], true) %}
.TP
.B Example:
.PP
.nf
{% for line in example.split('\n') %}
{{ line }}
{% endfor %}
.fi
{% endfor %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
.SH SEE ALSO
.BR doc2man (1)
.SH AUTHOR
Doc2Man Contributors