Skip to content

Commit 3802408

Browse files
refactor: render triggers only when trigger fields are available
1 parent a07eb00 commit 3802408

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

code_annotations/contrib/sphinx/extensions/openedx_events.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,22 +132,23 @@ def iter_nodes(self):
132132
ids=[f"definition-{event_name}"],
133133
)
134134

135-
event_section += nodes.paragraph(text="Triggers", ids=[f"triggers-{event_name}"])
136-
triggers_bullet_list = nodes.bullet_list()
137-
for repository, path in zip(event_trigger_repository, event_trigger_path):
138-
triggers_bullet_list += nodes.list_item(
139-
"",
140-
nodes.paragraph(
135+
if event_trigger_path and event_trigger_repository:
136+
event_section += nodes.paragraph(text="Triggers", ids=[f"triggers-{event_name}"])
137+
triggers_bullet_list = nodes.bullet_list()
138+
for repository, path in zip(event_trigger_repository, event_trigger_path):
139+
triggers_bullet_list += nodes.list_item(
141140
"",
142-
"Path: ",
143-
nodes.reference(
144-
text=path,
145-
refuri=f"https://github.com/search?q=repo:{repository}+{event_name}+path:{path}"
141+
nodes.paragraph(
142+
"",
143+
"Path: ",
144+
nodes.reference(
145+
text=path,
146+
refuri=f"https://github.com/search?q=repo:{repository}+{event_name}+path:{path}"
147+
),
146148
),
147-
),
148-
)
149+
)
149150

150-
event_section += triggers_bullet_list
151+
event_section += triggers_bullet_list
151152

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

0 commit comments

Comments
 (0)