Romern / syncMyMoodle

Synchronization client for RWTH Moodle
GNU General Public License v3.0
73 stars 18 forks source link

MathJax integration for quizzes #54

Closed Gameheld closed 3 years ago

Gameheld commented 3 years ago

MathJaix LaTeX elements are now rendered correctly in the output pdf.

However, wkhtmltopdf gets stuck while trying to retrieve images embedded in quizzes. I added a js-delay, that stops after 30s and prints the pdf. For now, images are not displayed in the pdf. There are however not many lectures that i know of that use images inside quizzes so that might not be an important problem.

I also fixed multiple quiz downloads that occured to me.

before mathjaix_before

after mathjaix_after

Romern commented 3 years ago

The 30s delay makes it very slow. I would prefer some other way of addressing the issue, or lowering the delay, does it really need to be that long?

Gameheld commented 3 years ago

I tested it with a 20s delay and in some tests, the MathJax didnt load properly. With 30s, it worked fine.

In 6d620dc I used the option 'window-status': 'finished' in the wkhtmltopdf call. This causes it to wait exactly until mathjax is fully loaded. However, it also tries to retrieve images and then gets stuck somehow which I tried to fix with a img-tag recognition workaround, but it still seems to get stuck with using that option on some quizzes for me, although the quiz doesnt contain any images. I dont know why this occurs and therefore I instead used a js-delay. The problem is that wkhtmltopdf doesnt have a useful verbosity option which really makes debugging that problem a guessing game...

Romern commented 3 years ago

I think we should then disable it by default, and add the info to the readme.

Gameheld commented 3 years ago

good idea, meanwhile I can try to figure out something more about the problem and try to find a solution.

Romern commented 3 years ago

A solution could be to write a moodle quiz parser, I did write one a couple years ago in java: https://gist.github.com/Romern/3ac8db103abaed2a73c707a55bd78186 . It outputs latex. would have to rewrite it in python though