Skip to content

Commit

Permalink
refactor: render triggers only when trigger fields are available
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi committed Dec 30, 2024
1 parent a07eb00 commit 3802408
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions code_annotations/contrib/sphinx/extensions/openedx_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,23 @@ def iter_nodes(self):
ids=[f"definition-{event_name}"],
)

event_section += nodes.paragraph(text="Triggers", ids=[f"triggers-{event_name}"])
triggers_bullet_list = nodes.bullet_list()
for repository, path in zip(event_trigger_repository, event_trigger_path):
triggers_bullet_list += nodes.list_item(
"",
nodes.paragraph(
if event_trigger_path and event_trigger_repository:
event_section += nodes.paragraph(text="Triggers", ids=[f"triggers-{event_name}"])
triggers_bullet_list = nodes.bullet_list()
for repository, path in zip(event_trigger_repository, event_trigger_path):
triggers_bullet_list += nodes.list_item(
"",
"Path: ",
nodes.reference(
text=path,
refuri=f"https://github.com/search?q=repo:{repository}+{event_name}+path:{path}"
nodes.paragraph(
"",
"Path: ",
nodes.reference(
text=path,
refuri=f"https://github.com/search?q=repo:{repository}+{event_name}+path:{path}"
),
),
),
)
)

event_section += triggers_bullet_list
event_section += triggers_bullet_list

if event.get(".. event_warning:") not in (None, "None", "n/a", "N/A"):
event_section += nodes.warning(
Expand Down

0 comments on commit 3802408

Please sign in to comment.