From 44727c507146dac33b30c88f0ad46bfb10fbd59f Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Sat, 31 Jan 2026 00:58:43 +0000 Subject: [PATCH] Add templates and example files for Python, Go, and JavaScript --- doc2man/templates/man_page.j2 | 78 +++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 doc2man/templates/man_page.j2 diff --git a/doc2man/templates/man_page.j2 b/doc2man/templates/man_page.j2 new file mode 100644 index 0000000..05b25d0 --- /dev/null +++ b/doc2man/templates/man_page.j2 @@ -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