From 2b2b04d188f18cf85bf4058d675d1c61a31a4e7f Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 29 Dec 2023 00:50:57 +0000 Subject: [PATCH] Shorten the title for D-Bus interface docs The title of an interface can be arbitrarily long, considering that reverse DNS namespaces can be pretty complex. Instead of using the whole interface name, we can use the name without the prefix. --- gio/gdbus-2.0/codegen/codegen_md.py | 2 +- gio/gdbus-2.0/codegen/codegen_rst.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gio/gdbus-2.0/codegen/codegen_md.py b/gio/gdbus-2.0/codegen/codegen_md.py index 4644ef6f5..c509ce05b 100644 --- a/gio/gdbus-2.0/codegen/codegen_md.py +++ b/gio/gdbus-2.0/codegen/codegen_md.py @@ -88,7 +88,7 @@ class MdCodeGenerator: f"Title: {iface.name} D-Bus Interface", f"Slug: {iface.name}", "", - "# " + iface.name, + "# " + iface.name_without_prefix, "", "## Description", "", diff --git a/gio/gdbus-2.0/codegen/codegen_rst.py b/gio/gdbus-2.0/codegen/codegen_rst.py index 303e547cf..6a023f69f 100644 --- a/gio/gdbus-2.0/codegen/codegen_rst.py +++ b/gio/gdbus-2.0/codegen/codegen_rst.py @@ -82,12 +82,13 @@ class RstCodeGenerator: def _generate_header(self, iface): """Generates the header and preamble of the document.""" - header_len = len(iface.name) + iface_name = iface.name_without_prefix + header_len = len(iface_name) res = [ f".. _{iface.name}:", "", "=" * header_len, - iface.name, + iface_name, "=" * header_len, "", "-----------",