Skip to content

Commit

Permalink
Add RST validation for LTI 1.3 related directives
Browse files Browse the repository at this point in the history
  • Loading branch information
PasiSa authored and markkuriekkinen committed Jun 9, 2023
1 parent 41e2440 commit 5e7920a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 8 additions & 1 deletion access/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def load(exercise_key: str, course_dir: str, filename: str, lang: str) -> "Exerc


class Parent(PydanticModel):
children: List[Union["Chapter", "Exercise", "LTIExercise", "ExerciseCollection"]] = []
children: List[Union["Chapter", "Exercise", "LTIExercise", "LTI1p3Exercise", "ExerciseCollection"]] = []

def postprocess(self, **kwargs: Any):
for c in self.children:
Expand Down Expand Up @@ -317,6 +317,12 @@ class LTIExercise(Exercise):
lti_open_in_iframe: NotRequired[bool]


class LTI1p3Exercise(Exercise):
lti1p3: str
lti_open_in_iframe: NotRequired[bool]
lti_custom: NotRequired[str]


class ExerciseCollection(Item):
target_category: str
target_url: str
Expand Down Expand Up @@ -344,6 +350,7 @@ def validate_static_content(cls, paths: Localized[Path]):
Parent.update_forward_refs()
Exercise.update_forward_refs()
LTIExercise.update_forward_refs()
LTI1p3Exercise.update_forward_refs()
ExerciseCollection.update_forward_refs()
Chapter.update_forward_refs()

Expand Down
9 changes: 9 additions & 0 deletions util/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ def exercise(
if k in exercise:
of[k] = exercise[k]

if 'lti1p3' in exercise:
for k in (
'lti1p3',
'lti_open_in_iframe',
'lti_custom',
):
if k in exercise:
of[k] = exercise[k]

if 'exercise_info' in exercise:
of['exercise_info'] = exercise['exercise_info']
else:
Expand Down

0 comments on commit 5e7920a

Please sign in to comment.