mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
Merge branch 'MDL-36571' of git://github.com/timhunt/moodle
This commit is contained in:
commit
91b0d0b75a
@ -126,10 +126,10 @@ abstract class qtype_multichoice_base extends question_graded_automatically {
|
||||
}
|
||||
|
||||
public function make_html_inline($html) {
|
||||
$html = preg_replace('~\s*<p>\s*~', '', $html);
|
||||
$html = preg_replace('~\s*</p>\s*~', '<br />', $html);
|
||||
$html = preg_replace('~<br />$~', '', $html);
|
||||
return $html;
|
||||
$html = preg_replace('~\s*<p>\s*~u', '', $html);
|
||||
$html = preg_replace('~\s*</p>\s*~u', '<br />', $html);
|
||||
$html = preg_replace('~(<br\s*/?>)+$~u', '', $html);
|
||||
return trim($html);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,6 +147,8 @@ class qtype_multichoice_single_question_test extends advanced_testcase {
|
||||
$this->assertEquals("Frog<br />XXX <img src='http://example.com/pic.png' alt='Graph' />",
|
||||
$mc->make_html_inline(" <p> Frog </p> \n\r
|
||||
<p> XXX <img src='http://example.com/pic.png' alt='Graph' /> </p> "));
|
||||
$this->assertEquals('Frog', $mc->make_html_inline('<p>Frog</p><p></p>'));
|
||||
$this->assertEquals('Frog<br />†', $mc->make_html_inline('<p>Frog</p><p>†</p>'));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user