Skip to content

Commit

Permalink
Rename meta-data to list_global_options and remove unneeded code
Browse files Browse the repository at this point in the history
  • Loading branch information
OFFICE\cs committed Dec 11, 2024
1 parent 0079b81 commit f4ec1a9
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions sphinx_needs/directives/list2need.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit f4ec1a9

Please sign in to comment.