Skip to content
Snippets Groups Projects
Commit dba08de3 authored by Tim Hunt's avatar Tim Hunt
Browse files

Partially revert "Modify the mathjax filter behaviour to force some maths in...

Partially revert "Modify the mathjax filter behaviour to force some maths in the question text.  Tidy up the healthcheck."

This partially reverts commit fda28532.
parent 51dd844a
No related branches found
No related tags found
No related merge requests found
......@@ -78,7 +78,7 @@ class qtype_stack_renderer extends qtype_renderer {
// Now format the questiontext. This should be done after the subsitutions of inputs and PRTs.
$questiontext = $question->format_text(
stack_maths::process_display_castext($questiontext, $this, true),
stack_maths::process_display_castext($questiontext, $this),
$question->questiontextformat,
$qa, 'question', 'questiontext', $question->id);
......
......@@ -48,12 +48,11 @@ class stack_maths {
* then passed to Moodle's {@link format_text()} function.
* @param string $text the content to process.
* @param qtype_stack_renderer $renderer (options) the STACK renderer, if you have one.
* @param bool $forcesomemaths force the text to contain some mathematics.
* @return string the content ready to pass to format_text.
*/
public static function process_display_castext($text, qtype_stack_renderer $renderer = null, $forcesomemaths = false) {
public static function process_display_castext($text, qtype_stack_renderer $renderer = null) {
return self::get_output()->process_display_castext($text,
stack_utils::get_config()->replacedollars, $renderer, $forcesomemaths);
stack_utils::get_config()->replacedollars, $renderer);
}
/**
......
......@@ -53,8 +53,8 @@ abstract class stack_maths_output_filter_base extends stack_maths_output {
return $html;
}
public function process_display_castext($text, $replacedollars, qtype_stack_renderer $renderer = null, $forcesomemaths = false) {
$text = parent::process_display_castext($text, $replacedollars, $renderer, $forcesomemaths);
public function process_display_castext($text, $replacedollars, qtype_stack_renderer $renderer = null) {
$text = parent::process_display_castext($text, $replacedollars, $renderer);
$text = $this->find_equations_and_replace_delimiters($text);
return $text;
}
......
......@@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see <http://www.gnu.org/licenses/>.
require_once($CFG->dirroot .'/filter/mathjaxloader/filter.php');
/**
* STACK maths output methods for using MathJax.
......@@ -23,13 +22,4 @@ require_once($CFG->dirroot .'/filter/mathjaxloader/filter.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_maths_output_mathjax extends stack_maths_output {
public function process_display_castext($text, $replacedollars, qtype_stack_renderer $renderer = null, $forcesomemaths = false) {
// When rendering with MathJax the questiontext must always contain some maths.
// This is to ensure the javascript is active so that any ajax processing is picked up.
if ($forcesomemaths && strpos($text, '\(') === false && strpos($text, '\[') === false) {
$text .= '\(\)';
}
return parent::process_display_castext($text, $replacedollars, $renderer);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment