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

allow `|` in cloze_exercise, re #138

parent 404fdcfb
No related branches found
No related tags found
No related merge requests found
......@@ -369,7 +369,7 @@ class cloze_exercise extends Exercise
foreach ($this->task['answers'][$blank] as $answer) {
$answer_text = $answer['text'];
if (preg_match('/^([":*~]|$)/', $answer_text)) {
if (preg_match('/^([":*~]|$|.*\|)/', $answer_text)) {
$answer_text = '"' . $answer_text . '"';
}
......@@ -424,7 +424,9 @@ class cloze_exercise extends Exercise
}
if ($part !== '') {
foreach (explode('|', $part) as $answer) {
preg_match_all('/( *[*~]?".*?" *|[^|]*)\|/', $part . '|', $matches);
foreach ($matches[1] as $answer) {
$answer = trim($answer);
$points = 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment