Generate RST anchors for methods, signals, and properties

Don't rely on the titles.
This commit is contained in:
Emmanuele Bassi 2023-08-28 16:26:24 +01:00
parent 5f33ae8901
commit 5f8af01b8b

View File

@ -120,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)
@ -142,6 +142,8 @@ class RstCodeGenerator:
else:
access = "readable"
res += [
".. _{title}:",
"",
title,
"^" * len(title),
"",
@ -216,6 +218,8 @@ class RstCodeGenerator:
for m in iface.methods:
title = f"{iface.name}.{m.name}"
res += [
".. _{title}:",
"",
title,
"^" * len(title),
"",
@ -292,6 +296,8 @@ class RstCodeGenerator:
for s in iface.signals:
title = f"{iface.name}::{s.name}"
res += [
".. _{title}:",
"",
title,
"^" * len(title),
"",