summaryrefslogtreecommitdiff
path: root/gio/gdbus-2.0/codegen/codegen_rst.py
diff options
context:
space:
mode:
Diffstat (limited to 'gio/gdbus-2.0/codegen/codegen_rst.py')
-rw-r--r--gio/gdbus-2.0/codegen/codegen_rst.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/gio/gdbus-2.0/codegen/codegen_rst.py b/gio/gdbus-2.0/codegen/codegen_rst.py
index 51da2d572..303e547cf 100644
--- a/gio/gdbus-2.0/codegen/codegen_rst.py
+++ b/gio/gdbus-2.0/codegen/codegen_rst.py
@@ -6,6 +6,7 @@ import os
import re
from . import utils
+import textwrap
# Disable line length warnings as wrapping the templates would be hard
# flake8: noqa: E501
@@ -21,8 +22,8 @@ class RstCodeGenerator:
def _expand(self, s, expandParamsAndConstants):
"""Expands parameters and constant literals."""
res = []
- for line in s.split("\n"):
- line = line.strip()
+ for line in textwrap.dedent(s).split("\n"):
+ line = line.rstrip()
if line == "":
res.append("")
continue
@@ -119,12 +120,12 @@ class RstCodeGenerator:
def _generate_section(self, title, name):
"""Generates a section with the given title."""
res = [
+ f".. _{name} {title}:",
+ "",
"-" * len(title),
title,
"-" * len(title),
"",
- f".. {name} {title}:",
- "",
"",
]
return "\n".join(res)
@@ -141,6 +142,8 @@ class RstCodeGenerator:
else:
access = "readable"
res += [
+ f".. _{title}:",
+ "",
title,
"^" * len(title),
"",
@@ -215,6 +218,8 @@ class RstCodeGenerator:
for m in iface.methods:
title = f"{iface.name}.{m.name}"
res += [
+ f".. _{title}:",
+ "",
title,
"^" * len(title),
"",
@@ -230,6 +235,13 @@ class RstCodeGenerator:
f" {arg_desc}",
"",
]
+ for a in m.out_args:
+ arg_desc = self._expand(a.doc_string, True)
+ res += [
+ f"{a.name}",
+ f" {arg_desc}",
+ "",
+ ]
res += [""]
if m.since:
res += [
@@ -284,6 +296,8 @@ class RstCodeGenerator:
for s in iface.signals:
title = f"{iface.name}::{s.name}"
res += [
+ f".. _{title}:",
+ "",
title,
"^" * len(title),
"",