Skip to content
Snippets Groups Projects
Commit 22d73d98 authored by Elmar Ludwig's avatar Elmar Ludwig
Browse files

also trigger escaping on ~ and *, fixes #186

parent 0f343644
No related branches found
No related tags found
No related merge requests found
......@@ -355,14 +355,18 @@ class cloze_exercise extends Exercise
$select = $this->isSelect($blank, false) ? ':' : '';
foreach ($this->task['answers'][$blank] as $answer) {
$answer_text = $answer['text'];
if (preg_match('/^([":*~]|$)/', $answer_text)) {
$answer_text = '"' . $answer_text . '"';
}
if ($answer['score'] == 0) {
$answers[] = '*' . $answer['text'];
$answers[] = '*' . $answer_text;
} else if ($answer['score'] == 0.5) {
$answers[] = '~' . $answer['text'];
} else if (preg_match('/^([":*~]|$)/', $answer['text'])) {
$answers[] = '"' . $answer['text'] . '"';
$answers[] = '~' . $answer_text;
} else {
$answers[] = $answer['text'];
$answers[] = $answer_text;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment