diff --git a/demo/correct-question.py b/demo/correct-question.py
old mode 100644
new mode 100755
index c5ff284..03933e7
--- a/demo/correct-question.py
+++ b/demo/correct-question.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python3.4
+import re
import sys
+
s = sys.stdin.read()
# set of words converted to lowercase lowercase
diff --git a/demo/questions.yaml b/demo/questions.yaml
index e760d87..83e835d 100644
--- a/demo/questions.yaml
+++ b/demo/questions.yaml
@@ -1,52 +1,54 @@
-
- ref: solar-system-mars
+ ref: solar-system-jupiter
type: radio
- text: Choose the correct answer
+ text: Which one is the largest planet?
options:
- - This one is correct
- - Wrong
- - Very wrong!
- # optional
+ - Jupiter
+ - Mercury
+ - Mars
+ # optional, default is 0, True, True
correct: 0
shuffle: True
discount: True
hint: Just don't choose the wrong ones
# ---------------------------------------------------------------------------
-
- ref: solar-system-jupiter
+ ref: solar-system-mars
type: checkbox
text: Which ones are correct?
options:
- - Yes
- - No
- - Yes
- - Obvious one, not very important
+ - $1 > 0$
+ - $-1 > 1$
+ - $\sqrt{3} > \sqrt{2}$
+ - $0 = 0$
correct: [1, -1, 1, 0.5]
+ # optional
+ discount: True
hint: There are three.
# ---------------------------------------------------------------------------
-
- ref: solar-system-venus
+ ref: question-v1
type: text
text: What's your favorite basic color?
correct: ['blue', 'green']
hint: It's not red.
# ---------------------------------------------------------------------------
-
- ref: question-v1
+ ref: question-v2
type: text_regex
- text: What's your favorite basic color?
+ text: What's my favorite basic color?
correct: '[bB]lue'
hint: It's not red.
# ---------------------------------------------------------------------------
-
- ref: question-v2
+ ref: question-colors
type: textarea
text: Write names of the three basic colors.
correct: demo/correct-question.py
hint: They start by RGB and order does not matter.
# ---------------------------------------------------------------------------
-
- ref: question-v3
+ ref: question-whatever
type: generator
script: demo/generate-question.py
# the script should print a question in yaml format like the ones above.
diff --git a/demo/test.yaml b/demo/test.yaml
index a5e61ac..fe75d6d 100644
--- a/demo/test.yaml
+++ b/demo/test.yaml
@@ -39,18 +39,24 @@ questions:
# choose 1 from the following 3 questions
- solar-system-mars
- solar-system-jupiter
- - solar-system-venus
points: 0.5
# second
- ref:
- question-v1
- question-v2
- - question-v3
# points: 1.0 is the default, if not defined here.
- # third
+ # 3.
+ - ref:
+ - question-colors
+
+ # 4.
+ - ref:
+ - question-whatever
+
+ # 5.
- ref: one-question
- # fourth
+ # 6.
- another-question
diff --git a/questions.py b/questions.py
index f920323..1cc40d4 100644
--- a/questions.py
+++ b/questions.py
@@ -390,7 +390,7 @@ class QuestionTextArea(Question):
self['grade'] = float(value)
except (ValueError):
self['grade'] = 0.0
- raise Exception('Correction of question "%s" returned nonfloat.' % self['ref'])
+ raise Exception('Correction of question "{0}" returned nonfloat "{1}".'.format(self['ref'], value))
return self['grade']
diff --git a/templates/test.html b/templates/test.html
index e90130c..8e8b2b9 100644
--- a/templates/test.html
+++ b/templates/test.html
@@ -178,9 +178,9 @@
% endfor
% elif q['type'] in ('text', 'text_regex'):
-
+
% elif q['type'] == 'textarea':
-
+
% endif
--
libgit2 0.21.2