HoldYourWaffle/oncourse-attempt-monk

The monk does not handle math correctly

HoldYourWaffle opened this issue · 0 comments

The monk currently identifies answers based on the 'orphan text' inside an input's label, but "math text" is written in deeply nested "MathJax" structures.

An example of such a structure:

<label for="q50348:19_answer1" class="ml-1">
   <span class="answernumber">b. </span>
   <span class="filter_mathjaxloader_equation">
      <span class="nolink">
         <span class="MathJax_Preview" style="color: inherit; --darkreader-inline-color: inherit; display: none;" data-darkreader-inline-color=""></span>
         <span class="MathJax" id="MathJax-Element-2-Frame" tabindex="0" style="position: relative;" data-mathml="<math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;><mfrac><mn>3</mn><mn>4</mn></mfrac></math>" role="presentation">
            <nobr aria-hidden="true"><span class="math" id="MathJax-Span-26" style="width: 0.811em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0.7em; height: 0px; font-size: 116%;"><span style="position: absolute; clip: rect(1.312em, 1000.7em, 2.922em, -1000em); top: -2.371em; left: 0em;"><span class="mrow" id="MathJax-Span-27"><span class="mfrac" id="MathJax-Span-28"><span style="display: inline-block; position: relative; width: 0.474em; height: 0px; margin-right: 0.12em; margin-left: 0.12em;"><span style="position: absolute; clip: rect(3.355em, 1000.32em, 4.164em, -1000em); top: -4.414em; left: 50%; margin-left: -0.177em;"><span class="mn" id="MathJax-Span-29" style="font-size: 70.7%; font-family: MathJax_Main;">3</span><span style="display: inline-block; width: 0px; height: 3.987em;"></span></span><span style="position: absolute; clip: rect(3.347em, 1000.33em, 4.149em, -1000em); top: -3.597em; left: 50%; margin-left: -0.177em;"><span class="mn" id="MathJax-Span-30" style="font-size: 70.7%; font-family: MathJax_Main;">4</span><span style="display: inline-block; width: 0px; height: 3.987em;"></span></span><span style="position: absolute; clip: rect(0.849em, 1000.47em, 1.239em, -1000em); top: -1.298em; left: 0em;"><span style="display: inline-block; overflow: hidden; vertical-align: 0em; border-top: 1.3px solid; width: 0.474em; height: 0px; --darkreader-inline-border-top:currentcolor;" data-darkreader-inline-border-top=""></span><span style="display: inline-block; width: 0px; height: 1.078em;"></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.371em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.515em; border-left: 0px solid; width: 0px; height: 1.617em; --darkreader-inline-border-left:currentcolor;" data-darkreader-inline-border-left=""></span></span></nobr>
            <span class="MJX_Assistive_MathML" role="presentation">
               <math xmlns="http://www.w3.org/1998/Math/MathML">
                  <mfrac>
                     <mn>3</mn>
                     <mn>4</mn>
                  </mfrac>
               </math>
            </span>
         </span>
         <script type="math/tex" id="MathJax-Element-2"> \frac{3}{4} </script>
      </span>
      <br>
   </span>
</label>