Add templates and example files for Python, Go, and JavaScript
This commit is contained in:
78
doc2man/templates/man_page.j2
Normal file
78
doc2man/templates/man_page.j2
Normal 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
|
||||
Reference in New Issue
Block a user