From 5a8195033cadfff066664f09d930bf947daadcc6 Mon Sep 17 00:00:00 2001 From: Edmund Farrow Date: Wed, 13 May 2026 10:48:54 +0100 Subject: [PATCH] iss1752 - Search for garbled nolinks when restoring placeholders #1752 --- renderer.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/renderer.php b/renderer.php index db03ba75a0e..3ab12aae32c 100644 --- a/renderer.php +++ b/renderer.php @@ -97,20 +97,31 @@ public function formulation_and_controls(question_attempt $qa, question_display_ ); // Restore inputnames. foreach ($question->inputs as $name => $input) { + // ISS1752 - The Mathjax filter is mangling the nolink spans if they're between + // curly braces so we have to do an extra search. $questiontext = str_replace( - "[[InMNEYMWDx:{$name}]]", + [ + "[[InMNEYMWDx:{$name}]]", + "<span class=\"nolink\">[[InMNEYMWDx:{$name}]]</span>" + ], "[[input:{$name}]]", $questiontext ); $questiontext = str_replace( - "[[VnMNEYMWDx:{$name}]]", + [ + "[[VnMNEYMWDx:{$name}]]", + "<span class=\"nolink\">[[VnMNEYMWDx:{$name}]]</span>" + ], "[[validation:{$name}]]", $questiontext ); } foreach ($question->prts as $index => $prt) { $questiontext = str_replace( - "[[GDBBdLBJLg:{$index}]]", + [ + "[[GDBBdLBJLg:{$index}]]", + "<span class=\"nolink\">[[GDBBdLBJLg:{$index}]]</span>" + ], "[[feedback:{$index}]]", $questiontext );