Skip to content

Commit

Permalink
Merge pull request #136 from eduNEXT/MJG/event-warning
Browse files Browse the repository at this point in the history
feat: add support for optional event warning for in-line annotation
  • Loading branch information
sarina authored Dec 12, 2024
2 parents 0277db1 + 8e3b6c9 commit d2c0f26
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ safelist_path: .annotation_safe_list.yml
coverage_target: 100.0
annotations:
feature_toggle:
# See annotation format documentation: https://edx-toggles.readthedocs.io/en/latest/how_to/documenting_new_feature_toggles.html
# See annotation format documentation: https://docs.openedx.org/projects/openedx-events/en/latest/reference/in-line-code-annotations-for-an-event.html
- ".. event_type:":
- ".. event_name:":
- ".. 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 d2c0f26

Please sign in to comment.