diff --git a/sphinx_needs/directives/list2need.py b/sphinx_needs/directives/list2need.py index 5861f10bd..216a8b904 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 + "meta-data": directives.unchanged, } def run(self) -> Sequence[nodes.Node]: @@ -215,23 +215,20 @@ def run(self) -> Sequence[nodes.Node]: hide_option = list_need["options"].get("hide", "") list_need["options"]["hide"] = hide_option - if metadata: if "options" not in list_need: list_need["options"] = {} metadata_items = re.findall(r'([^=,]+)=["\']([^"\']+)["\']', metadata) - + for key, value in metadata_items: current_options = list_need["options"].get(key.strip(), "") - - if current_options: - list_need["options"][key.strip()] = current_options + "," + value + list_need["options"][key.strip()] = ( + current_options + "," + value + ) else: list_need["options"][key.strip()] = value - - template = Template(NEED_TEMPLATE, autoescape=True)