$qa, 'question', 'generalfeedback', $this->id);
}
+ /**
+ * Take some HTML that should probably already be a single line, like a
+ * multiple choice choice, or the corresponding feedback, and make it so that
+ * it is suitable to go in a place where the HTML must be inline, like inside a <p> tag.
+ * @param string $html to HTML to fix up.
+ * @return string the fixed HTML.
+ */
+ public function make_html_inline($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);
+ }
+
/**
* Checks whether the users is allow to be served a particular file.
* @param question_attempt $qa the question attempt being displayed.