[pbs-devel] [PATCH proxmox-backup] scanrefs: remove term prefix from title

Aaron Lauterer a.lauterer at proxmox.com
Mon Nov 9 15:59:37 CET 2020


It can happen, that a title is defined as term in the following way:
:term:`My title`

This patch checks for it and strips the leading part and the last `.

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
 docs/_ext/proxmox-scanrefs.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/docs/_ext/proxmox-scanrefs.py b/docs/_ext/proxmox-scanrefs.py
index 58176fe5..8de17620 100644
--- a/docs/_ext/proxmox-scanrefs.py
+++ b/docs/_ext/proxmox-scanrefs.py
@@ -93,6 +93,9 @@ class ReflabelMapper(Builder):
                     logger.info('traversing section {}'.format(title.astext()))
                     ref_name = getattr(title, 'rawsource', title.astext())
 
+                    if (ref_name[:7] == ':term:`'):
+                        ref_name = ref_name[7:-1]
+
                     self.env.online_help[labelid] = {'link': '', 'title': ''}
                     self.env.online_help[labelid]['link'] = "/docs/" + os.path.basename(filename_html) + "#{}".format(labelid)
                     self.env.online_help[labelid]['title'] = ref_name
-- 
2.20.1






More information about the pbs-devel mailing list