doc: generate correct markdown from schemas.

You can't start a list without a paragraph separator.

```diff
 --- /tmp/before	2022-07-20 22:02:23.485372596 +0930
 +++ /tmp/after	2022-07-20 22:02:33.745528456 +0930
 @@ -21,12 +21,16 @@
         On startup of the daemon, no autoclean is set up.
  
  RETURN VALUE
 -       On success, an object is returned,  containing:  -  enabled  (boolean):
 -       whether invoice autocleaning is active
 +       On success, an object is returned, containing:
  
 -       If enabled is true: - expired_by (u64): how long an invoice must be ex‐
 -       pired (seconds) before we delete it - cycle_seconds (u64): how long  an
 -       invoice must be expired (seconds) before we delete it
 +       • enabled (boolean): whether invoice autocleaning is active
 +
 +       If enabled is true:
 +
 +       • expired_by (u64): how long an invoice must be expired  (seconds)  be‐
 +         fore we delete it
 +       • cycle_seconds  (u64):  how  long an invoice must be expired (seconds)
 +         before we delete it
  
  AUTHOR
         ZmnSCPxj <ZmnSCPxj@protonmail.com> is mainly responsible.
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-09-06 07:03:09 +09:30
committed by neil saitug
parent 3c3f4731bd
commit 8f1164365e
77 changed files with 141 additions and 5 deletions

View File

@@ -195,7 +195,7 @@ def output_members(sub, indent=''):
json_value(whichvalues[-1]))
conditions.append(cond)
sentence = indent + "If " + ", and ".join(conditions) + ":\n"
sentence = indent + "If " + ", and ".join(conditions) + ":\n\n"
if has_members(ifclause['then']):
# Prefix with blank line.
@@ -229,23 +229,23 @@ def generate_from_schema(schema):
output('On success, an empty object is returned.\n')
sub = schema
elif len(toplevels) == 1 and props[toplevels[0]]['type'] == 'object':
output('On success, an object containing **{}** is returned. It is an object containing:\n'.format(toplevels[0]))
output('On success, an object containing **{}** is returned. It is an object containing:\n\n'.format(toplevels[0]))
# Don't have a description field here, it's not used.
assert 'description' not in toplevels[0]
sub = props[toplevels[0]]
elif len(toplevels) == 1 and props[toplevels[0]]['type'] == 'array':
output('On success, an object containing **{}** is returned. It is an array of objects, where each object contains:\n'.format(toplevels[0]))
output('On success, an object containing **{}** is returned. It is an array of objects, where each object contains:\n\n'.format(toplevels[0]))
# Don't have a description field here, it's not used.
assert 'description' not in toplevels[0]
sub = props[toplevels[0]]['items']
else:
output('On success, an object is returned, containing:\n')
output('On success, an object is returned, containing:\n\n')
sub = schema
output_members(sub)
if warnings:
outputs(['\n', 'The following warnings may also be returned:\n'])
outputs(['\n', 'The following warnings may also be returned:\n\n'])
for w, desc in warnings:
output("- **{}**: {}\n".format(w, desc))