diff --git a/courses/fundamentals_of_ada/273_subprogram_contracts.rst b/courses/fundamentals_of_ada/273_subprogram_contracts.rst index 7117eb2cf..3726b79e8 100644 --- a/courses/fundamentals_of_ada/273_subprogram_contracts.rst +++ b/courses/fundamentals_of_ada/273_subprogram_contracts.rst @@ -528,35 +528,24 @@ Quiz .. code:: Ada - type Index_T is range 1 .. 100; - -- Database initialized such that value for element at I = I - Database : array (Index_T) of Integer; + Database : String (1 .. 10) := "ABCDEFGHIJ"; -- Set the value for element Index to Value and -- then increment Index by 1 - function Set_And_Move (Value : Integer; + function Set_And_Move (Value : Character; Index : in out Index_T) return Boolean with Post => ... Given the following expressions, what is their value if they are evaluated in the postcondition -of the call :ada:`Set_And_Move (-1, 10)` +of the call :ada:`Set_And_Move ('X', 4)` -.. list-table:: - - * - ``Database'Old (Index)`` - - - :animate:`11` - - :animate:`Use new index in copy of original Database` - - * - ``Database (Index'Old)`` +.. container:: overlay 1 - - :animate:`-1` - - :animate:`Use copy of original index in current Database` + .. image:: subprogram_contracts_special_attributes-quiz.svg} - * - ``Database (Index)'Old`` +.. container:: overlay 2 - - :animate:`10` - - :animate:`Evaluation of Database (Index) before call` + .. image:: subprogram_contracts_special_attributes-answer.svg} ------------------------------------- Stack Example (Spec with Contracts) diff --git a/images/subprogram_contracts_special_attributes-answer.svg b/images/subprogram_contracts_special_attributes-answer.svg new file mode 100644 index 000000000..548101592 --- /dev/null +++ b/images/subprogram_contracts_special_attributes-answer.svg @@ -0,0 +1,216 @@ + + + + + + + + + + + + + Database'Old (Index) +Database before the call: ABCDEFGHIJ +Index after the call: 5 +Value: E + + + + + + Database (Index'Old) +Database after the call: ABCXEFGHIJ +Index before the call: 4 +Value: X + + + + + + Database (Index)'Old +Database before the call: ABCDEFGHIJ +Index before the call: 5 +Value: D + + + + + + diff --git a/images/subprogram_contracts_special_attributes-quiz.svg b/images/subprogram_contracts_special_attributes-quiz.svg new file mode 100644 index 000000000..318f8e9a3 --- /dev/null +++ b/images/subprogram_contracts_special_attributes-quiz.svg @@ -0,0 +1,188 @@ + + + + + + + + + + + + Database'Old (Index) + + +Value: ? + + + + Database (Index'Old) + + +Value: ? + + + + Database (Index)'Old + + +Value: ? + + + + + diff --git a/pandoc/beamer_filter.py b/pandoc/beamer_filter.py index 0b737d314..12aeab042 100755 --- a/pandoc/beamer_filter.py +++ b/pandoc/beamer_filter.py @@ -362,6 +362,7 @@ def source_file_contents(filename, keywords): "source_include", "admonition", "animate", + "overlay", "speakernote", "columns", "column", @@ -468,6 +469,33 @@ def animate(classes, contents): return value +def is_overlay(classes): + return ("container" in classes) and ("overlay" in classes) + + +def overlay(classes, contents): + slide_number = 1 + if len(classes) > 2: + requested = classes[2] + if len(requested) > 0: + slide_number = int(requested) + slide_number = str(slide_number) + + first = { + "t": "RawBlock", + "c": ["latex", "\\begin{onlyenv}<" + slide_number + ">"], + } + last = {"t": "RawBlock", "c": ["latex", "\\end{onlyenv}"]} + + value = [] + value.append(first) + for c in contents: + value.append(c) + value.append(last) + + return value + + ######################## ## LATEX ENVIRONMENTS ## ########################