mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-20 13:54:36 +01:00
docs: Example notifications heading
- Added missing Example Notifications Heading - Renamed `example_json_notifications` to `example_notifications` - Moved `example_notifications` to the end of the page
This commit is contained in:
parent
976c0c90bc
commit
e94b793f05
5 changed files with 24 additions and 17 deletions
|
@ -22726,7 +22726,13 @@
|
|||
"",
|
||||
"- -32602: Error in given parameters."
|
||||
],
|
||||
"example_json_notifications": [
|
||||
"author": [
|
||||
"Rusty Russell <<rusty@blockstream.com>> wrote the initial version of this man page."
|
||||
],
|
||||
"resources": [
|
||||
"Main web site: <https://github.com/ElementsProject/lightning>"
|
||||
],
|
||||
"example_notifications": [
|
||||
{
|
||||
"method": "message",
|
||||
"params": {
|
||||
|
@ -22748,12 +22754,6 @@
|
|||
}
|
||||
}
|
||||
],
|
||||
"author": [
|
||||
"Rusty Russell <<rusty@blockstream.com>> wrote the initial version of this man page."
|
||||
],
|
||||
"resources": [
|
||||
"Main web site: <https://github.com/ElementsProject/lightning>"
|
||||
],
|
||||
"examples": [
|
||||
{
|
||||
"request": {
|
||||
|
|
|
@ -499,7 +499,7 @@
|
|||
"type": "string"
|
||||
}
|
||||
},
|
||||
"example_json_notifications": {
|
||||
"example_notifications": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"method": {
|
||||
|
|
|
@ -42,7 +42,13 @@
|
|||
"",
|
||||
"- -32602: Error in given parameters."
|
||||
],
|
||||
"example_json_notifications": [
|
||||
"author": [
|
||||
"Rusty Russell <<rusty@blockstream.com>> wrote the initial version of this man page."
|
||||
],
|
||||
"resources": [
|
||||
"Main web site: <https://github.com/ElementsProject/lightning>"
|
||||
],
|
||||
"example_notifications": [
|
||||
{
|
||||
"method": "message",
|
||||
"params": {
|
||||
|
@ -64,12 +70,6 @@
|
|||
}
|
||||
}
|
||||
],
|
||||
"author": [
|
||||
"Rusty Russell <<rusty@blockstream.com>> wrote the initial version of this man page."
|
||||
],
|
||||
"resources": [
|
||||
"Main web site: <https://github.com/ElementsProject/lightning>"
|
||||
],
|
||||
"examples": [
|
||||
{
|
||||
"request": {
|
||||
|
|
|
@ -8,7 +8,7 @@ import re
|
|||
|
||||
# To maintain the sequence of the before return value (body) and after return value (footer) sections in the markdown file
|
||||
BODY_KEY_SEQUENCE = ['reliability', 'usage', 'restriction_format', 'permitted_sqlite3_functions', 'treatment_of_types', 'tables', 'example_usage', 'notes', 'notifications', 'sharing_runes', 'riskfactor_effect_on_routing', 'recommended_riskfactor_values', 'optimality', 'randomization']
|
||||
FOOTER_KEY_SEQUENCE = ['errors', 'trivia', 'author', 'see_also', 'resources', 'examples']
|
||||
FOOTER_KEY_SEQUENCE = ['errors', 'trivia', 'author', 'see_also', 'resources', 'example_notifications', 'examples']
|
||||
|
||||
|
||||
def output_title(title, underline='-', num_leading_newlines=1, num_trailing_newlines=2):
|
||||
|
@ -487,6 +487,13 @@ def generate_footer(schema):
|
|||
output_title(key.replace('_', ' ').upper(), '-', 1)
|
||||
# Wrap see_also list with comma separated values
|
||||
output(esc_underscores(', '.join(schema[key])))
|
||||
elif key == 'example_notifications' and len(schema[key]) > 0:
|
||||
output_title(key.replace('_', ' ').upper(), '-', 1)
|
||||
for i, notification in enumerate(schema.get(key, [])):
|
||||
output('{}**Notification {}**: {}\n'.format('' if i == 0 else '\n\n', i + 1, '\n'.join(notification.get('description', ''))))
|
||||
output('```json\n')
|
||||
output(json.dumps(notification, indent=2).strip() + '\n')
|
||||
output('```')
|
||||
elif key == 'examples' and len(schema[key]) > 0:
|
||||
create_expandable('EXAMPLES', schema['rpc'], schema.get('examples', []))
|
||||
else:
|
||||
|
|
|
@ -13,6 +13,6 @@ TITLE="$(basename "$(basename "$SOURCE" .md)" ."$SECTION" | tr '[:lower:]' '[:up
|
|||
# format. mrkd used to do this for us, lowdown(1) doesn't.
|
||||
TITLELINE="$(head -n1 "$SOURCE")"
|
||||
|
||||
SOURCE=$(tail -n +3 "$SOURCE" | sed -E ':a;N;$!ba;s#\s*<details>\s*<summary>\s*<span style="font-size: 1\.5em; font-weight: bold;">EXAMPLES</span><br>\s*</summary>#\n\nEXAMPLES\n------------\n#g; s#Request:#Request:\n#g; s#Response:#Response:\n#g; s#lightning-cli#lightning-cli:#g;')
|
||||
SOURCE=$(tail -n +3 "$SOURCE" | sed -E ':a;N;$!ba;s#\s*<details>\s*<summary>\s*<span style="font-size: 1\.5em; font-weight: bold;">EXAMPLES</span><br>\s*</summary>#\n\nEXAMPLES\n------------\n#g; s#Request:#Request:\n#g; s#Response:#Response:\n#g; s#lightning-cli#lightning-cli:#g; s#\*\*Notification (1|2|3)\*\*:#**Notification \1**:\n#g;')
|
||||
|
||||
(echo "NAME"; echo "----"; echo "$TITLELINE"; echo "$SOURCE") | $LOWDOWN -s --out-no-smarty -Tman -m "title:$TITLE" -m "section:$SECTION" -m "source:Core Lightning $VERSION" -m "shiftheadinglevelby:-1"
|
||||
|
|
Loading…
Add table
Reference in a new issue