marcusgreen / moodle-qtype_gapfill

Fill in the blanks question type with very easy to learn syntax
6 stars 20 forks source link

fix html structure #77

Closed t-schroeder closed 3 years ago

t-schroeder commented 3 years ago

There are too many closing tags for the "qtext" div. The consequence is that when attempting a quiz the page layout is broken.

I can create an issue and attach a screenshot, sample question if necessary.

marcusgreen commented 3 years ago

Could you give me steps to reproduce this. I have a unit test to check the divs are evenly closed here https://github.com/marcusgreen/moodle-qtype_gapfill/blob/f5533b7922389be95b1782bd9b3cf4c2acfd18e3/tests/walkthrough_test.php#L514 I was addressing something like this in this recent code https://github.com/marcusgreen/moodle-qtype_gapfill/issues/76

t-schroeder commented 3 years ago

Nevermind, I just realized I was using version 2021063001 of your plugin. With your fix for #76 you already fixed the problem I was trying to fix here.

The empty div tags for "qtext" and "answeroptions" (which should be start tags instead) still technically create wrong HTML, but seems like most browsers are robus enough to handle that.

marcusgreen commented 3 years ago

When I worked on that I was looking for a tool to add proper html validation into the unit tests, but (surprisingly) I couldn't find anything, so settled on my crude checking that there was an even number of start and end divs. I would rather my code put out correct HTML even if browsers do tolerate errors. I appreciate your input and will look at your other issue as soon as I can. Update: I have just asked about this in the moodle developers chat on Telegram.

marcusgreen commented 3 years ago

I have been running the rendered output through this validator https://validator.w3.org/nu/#textarea And it is a bit of a mess. I will work on ensuring the output is more compliant in future versions.