Permalink
Browse files

Merge branch 'MDL-36571_23' of git://github.com/timhunt/moodle into M…

…OODLE_23_STABLE
  • Loading branch information...
danpoltawski committed Nov 20, 2012
2 parents 21082f7 + 4c1a35e commit 254d78b75f78aea6d8d1c944f232e4fb9735608d
Showing with 6 additions and 4 deletions.
  1. +4 −4 question/type/multichoice/question.php
  2. +2 −0 question/type/multichoice/tests/question_test.php
@@ -126,10 +126,10 @@ public function check_file_access($qa, $options, $component, $filearea, $args, $
}
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 @@ public function test_make_html_inline() {
$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>'));
}
}

0 comments on commit 254d78b

Please sign in to comment.