From ba2097a382b581dacced5cb9bd70087396a054f0 Mon Sep 17 00:00:00 2001 From: Prabhu Ramachandran Date: Tue, 22 Nov 2011 01:01:11 +0530 Subject: ENH: The question description should be valid HTML This allows us to render code nicely and format the question nicely. Modified the question template suitably. --- docs/sample_questions.py | 13 ++++++++----- templates/exam/question.html | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/sample_questions.py b/docs/sample_questions.py index c77eb9d..2a9eaf8 100644 --- a/docs/sample_questions.py +++ b/docs/sample_questions.py @@ -5,9 +5,11 @@ Question( summary='Factorial', points=2, description=''' -Write a function called "fact" which takes a single integer argument (say "n") -and returns the factorial of the number. -For example fact(3) -> 6''', +Write a function called fact which takes a single integer argument +(say n) and returns the factorial of the number. +For example:
+fact(3) -> 6 +''', test=''' assert fact(0) == 1 assert fact(5) == 120 @@ -16,8 +18,9 @@ assert fact(5) == 120 Question( summary='Simple function', points=1, - description='''Create a simple function called "sqr" which takes a single -argument and returns the square of the argument. For example sqr(3) -> 9.''', + description='''Create a simple function called sqr which takes a single +argument and returns the square of the argument. For example:
+sqr(3) -> 9.''', test=''' import math assert sqr(3) == 9 diff --git a/templates/exam/question.html b/templates/exam/question.html index dec476e..f4d3f67 100644 --- a/templates/exam/question.html +++ b/templates/exam/question.html @@ -50,7 +50,7 @@ function update_time() {% block content %}

{{ question.summary }}

-

{{ question.description }} +

{{ question.description|safe }}
(Marks: {{ question.points }})

-- cgit