From f4ec1a92545146f147ec768c27d8fa4047087150 Mon Sep 17 00:00:00 2001 From: "OFFICE\\cs" Date: Wed, 11 Dec 2024 11:23:23 +0100 Subject: [PATCH] Rename meta-data to list_global_options and remove unneeded code --- sphinx_needs/directives/list2need.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sphinx_needs/directives/list2need.py b/sphinx_needs/directives/list2need.py index 216a8b904..89e4288af 100644 --- a/sphinx_needs/directives/list2need.py +++ b/sphinx_needs/directives/list2need.py @@ -59,7 +59,7 @@ def presentation(argument: str) -> Any: "links-down": directives.unchanged, "tags": directives.unchanged, "hide": directives.unchanged, - "meta-data": directives.unchanged, + "list_global_options": directives.unchanged, } def run(self) -> Sequence[nodes.Node]: @@ -113,7 +113,7 @@ def run(self) -> Sequence[nodes.Node]: # Retrieve tags defined at list level tags = self.options.get("tags", "") hide = self.options.get("hide", "") - metadata = self.options.get("meta-data", "") + global_options = self.options.get("list_global_options", "") list_needs = [] # Storing the data in a sorted list @@ -212,15 +212,14 @@ def run(self) -> Sequence[nodes.Node]: if hide: if "options" not in list_need: list_need["options"] = {} - hide_option = list_need["options"].get("hide", "") - list_need["options"]["hide"] = hide_option + list_need["options"]["hide"] = hide - if metadata: + if global_options: if "options" not in list_need: list_need["options"] = {} - metadata_items = re.findall(r'([^=,]+)=["\']([^"\']+)["\']', metadata) + global_options_items = re.findall(r'([^=,]+)=["\']([^"\']+)["\']', global_options) - for key, value in metadata_items: + for key, value in global_options_items: current_options = list_need["options"].get(key.strip(), "") if current_options: