Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Improve logic for process_needextend #1037

Merged
merged 8 commits into from
Sep 26, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update needextend.py
  • Loading branch information
chrisjsewell committed Sep 25, 2023
commit ded49d18ddbe2cd02cee6b08bf063a254a18cb3e
10 changes: 5 additions & 5 deletions sphinx_needs/directives/needextend.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ def process_needextend(app: Sphinx, doctree: nodes.document, fromdocname: str) -

elif option.startswith("-"):
option_name = option[1:]
if option_name in list_values:
if option_name in link_names:
# If we remove links, then remove all corresponding back links
old_links = [i for i in need[option] if i in all_needs]
need[option_name] = []
if option_name in link_names:
for ref_need in old_links:
all_needs[ref_need][f"{option_name}_back"].remove(found_need["id"])

for ref_need in old_links:
all_needs[ref_need][f"{option_name}_back"].remove(found_need["id"])
if option_name in list_values:
need[option_name] = []
else:
need[option_name] = ""
else:
Expand Down