[PATCH 2/2] doc: conf.py: Show groups in test catalog

Andrea Cervesato <[email protected]>
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
From: Andrea Cervesato <andrea.cervesato-IBi9RG/[email protected]>

Display the groups field from metadata in the generated test catalog
pages. Groups appear after the source link and before the test
description.

Filter out @group tag lines from the test description to avoid
duplication since they are already shown in the groups list.

Signed-off-by: Andrea Cervesato <andrea.cervesato-IBi9RG/[email protected]>
---
 doc/conf.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/doc/conf.py b/doc/conf.py
index 591c1534dfa7e54b816e88b9eca1dd7fb91df255..bf2eaa898ac49debee88ccc1d26a584ffe20bb7d 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -394,6 +394,7 @@ def _generate_setup_table(keys):
         'needs_checkpoints',
         'forks_child',
         'tags',
+        'groups',
     ]
     my_keys = {k: v for k, v in keys.items() if k not in exclude}
     if len(my_keys) == 0:
@@ -482,11 +483,22 @@ def generate_test_catalog(_):
                 ''
             ])
 
-        # test description
+        # groups information
+        groups = conf.get('groups', None)
+        if groups:
+            text.extend([
+                '',
+                f"**Groups**: {', '.join(groups)}",
+                ''
+            ])
+
+        # test description (filter out @group tags)
         desc = conf.get('doc', None)
         if desc:
             desc_text = []
             for line in desc:
+                if line.lstrip().startswith('@group '):
+                    continue
                 line = regexp.sub(r'**\1**', line)
                 desc_text.append(line)
 

-- 
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.