Skip to content

Commit

Permalink
feat: add support for optional event warning for in-line annotation
Browse files Browse the repository at this point in the history
Add warning for openedx-events annotations so developers can include
relevant information about the current event. As for now, these warnings
have been used to indicate that the event at the time of implementation
doesn't have for the event bus.
  • Loading branch information
mariajgrimaldi committed Dec 11, 2024
1 parent 0277db1 commit 4a2cd09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ annotations:
- ".. event_description:":
- ".. event_data:":
- ".. event_key_field:":
- ".. event_warning:":
extensions:
python:
- py
Expand Down
5 changes: 5 additions & 0 deletions code_annotations/contrib/sphinx/extensions/openedx_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ def iter_nodes(self):
f" {event['line_number']})"
)

if event.get(".. event_warning:") not in (None, "None", "n/a", "N/A"):
event_section += nodes.warning(
"", nodes.paragraph("", event[".. event_warning:"]), ids=[f"warning-{event_name}"]
)

subject_header += event_section

if domain_header:
Expand Down

0 comments on commit 4a2cd09

Please sign in to comment.