Open HelloLudger opened 2 years ago
Problem seems to be, that they are not wrapped in a <p>
tag:
Thank you for the feedback, can you confirm that your second message indicates it is still not working as you expect. I have never taken account of or used the question type with Markdown, though I probably should. You can see here some examples that illustrate what I have tried with it. https://github.com/marcusgreen/moodle-qtype_gapfill/blob/master/examples/en/gapfill_examples.xml Let me know your thoughts.
Yes, I can confirm that it's still not working.
The problem is: the question text [A|B|C] sometext
is converted to
<input ..../>
<p>sometext<p/>
but it should become
<p><input ..../> sometext<p/>
Since you're not doing the markdown conversion, it might be the order in which you're calling the text-conversation? Do you call it for the input and the rest of text in the line separately?
A solution seems to be to change line 83-92 in https://github.com/marcusgreen/moodle-qtype_gapfill/blob/5aa766b49a733475ef42d20f83ba8396bec7e169/renderer.php from
foreach ($question->textfragments as $place => $fragment) {
if ($place > 0) {
$questiontext .= $this->embedded_element($qa, $place, $options, $markedgaps);
}
// Format the non entry field parts of the question text.
// This will also ensure images get displayed.
$questiontext .= $question->format_text($fragment, $question->questiontextformat,
$qa, 'question', 'questiontext', $question->id);
}
to
foreach ($question->textfragments as $place => $fragment) {
if ($place > 0) {
$questiontext .= $this->embedded_element($qa, $place, $options, $markedgaps);
}
$questiontext .= $fragment;
}
// Format the non entry field parts of the question text.
// This will also ensure images get displayed.
$questiontext = $question->format_text($questiontext, $question->questiontextformat,
$qa, 'question', 'questiontext', $question->id);
Not sure about possible sideeffects.
Seems to work:
Hi Ludger, I have been going over the outstanding issues and I noticed I have not addressed this. It is still on my ToDo list to investigate.
Describe the bug A forced linebreak breaks markdown. This makes tables and good looking questions impossible.
To Reproduce
And set questiontext format to markdown.
Expected behavior No line break before inputs and therefor functioning tables.
Screenshots
This problem seems to be exclusive to markdown. Unformatted text looks like this:
Other:
Question as Moodle-XML (renamed to TXT): MarkdownNotWorking.txt