aboutsummaryrefslogtreecommitdiff
path: root/scripts/mandoc_gen.py
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-11-29 13:31:37 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-11-29 13:31:37 -0500
commita50e2df51a63ab809e700c7c8a28c124c6fef95e (patch)
tree5fadd12127321568568841902b751c9541d99ff1 /scripts/mandoc_gen.py
parent353a1a40173d4722809e2cad215ab734bf68b283 (diff)
No 'default' column for functions with no defaults
Diffstat (limited to 'scripts/mandoc_gen.py')
-rwxr-xr-xscripts/mandoc_gen.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/mandoc_gen.py b/scripts/mandoc_gen.py
index 260bc5d0..b9cf1cc2 100755
--- a/scripts/mandoc_gen.py
+++ b/scripts/mandoc_gen.py
@@ -71,6 +71,13 @@ lb lb lbx lb
l l l l.
Name Type Description Default'''
+arg_prefix_no_default = '''
+.TS
+allbox;
+lb lb lbx
+l l l.
+Name Type Description'''
+
type_template = ''''\\" t
.\\" Copyright (c) {year} Bruce Hill
.\\" All rights reserved.
@@ -99,11 +106,16 @@ def write_method(path, name, info):
if "args" in info and info["args"]:
lines.append(".SH ARGUMENTS")
- lines.append(arg_prefix)
+ has_defaults = any('default' in a for a in info['args'].values())
+ lines.append(arg_prefix if has_defaults else arg_prefix_no_default)
for arg,arg_info in info["args"].items():
- default = escape(arg_info['default'], spaces=True) if 'default' in arg_info else '-'
- description = markdown_to_roff(arg_info['description'])
- lines.append(f"{arg}\t{arg_info.get('type', '')}\t{description}\t{default}")
+ if has_defaults:
+ default = escape(arg_info['default'], spaces=True) if 'default' in arg_info else '-'
+ description = markdown_to_roff(arg_info['description'])
+ lines.append(f"{arg}\t{arg_info.get('type', '')}\t{description}\t{default}")
+ else:
+ description = markdown_to_roff(arg_info['description'])
+ lines.append(f"{arg}\t{arg_info.get('type', '')}\t{description}")
lines.append(".TE")
if "return" in info: