03-31-2021, 12:12 PM | #16 |
Grand Sorcerer
Posts: 27,547
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
No. Client Javascripts have been enabled all along. It's definitely the URLInterceptor:
Code:
Debug: Warning: URLInterceptor blocking access to url QUrl("file:///C%3A/Program Files/Sigil/polyfills/MJ/MathJax.js?config=local/SIGIL_EBOOK_MML_SVG") |
03-31-2021, 12:17 PM | #17 |
Sigil Developer
Posts: 7,637
Karma: 5433388
Join Date: Nov 2009
Device: many
|
I am sure it is drive letter related but it should not be % url encoding related
as that is converted to a local file path before comparison. So in URLInterceptor.cpp, the the following code snippet: Code:
QString destpath = destination.toLocalFile(); ... // or the path must be inside the Sigil's MathJax folder if (destpath.startsWith(mathjaxfolder)) { info.block(false); return; } qDebug() << destpath; qDebug() << mathjaxfolder; I am guessing there is some drive letter case or leading / difference going on. Last edited by KevinH; 03-31-2021 at 12:24 PM. |
Advert | |
|
03-31-2021, 12:25 PM | #18 |
Sigil Developer
Posts: 7,637
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Do you want me to push that change and then add [deploy] for you to test with?
|
03-31-2021, 12:28 PM | #19 |
Grand Sorcerer
Posts: 27,547
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Actually, I think it may be the way the mathjax folder/url is being concatenated on Windows
Debug: mathjax: "/C:/Program Files/Sigil/polyfills/MJ/" Debug: usercss: "C:/Users/Doug/AppData/Local/sigil-ebook/sigil/" Both are resulting in technically correct urls for the user css file and the mathjax javascript file when all is said and done, but in the case of the mathjax folder: if the URLInterceptor is being told to specifically allow file calls from inside the "/C:/Program Files/Sigil/polyfills/MJ/" folder then that's why it's failing. No such folder exists (that starts with a forward slash). We either build the mathjax folder/url differently for Windows, or we special-case the starts-with section of the URLInterceptor's mathjax exemption on Windows to strip the leading slash Last edited by DiapDealer; 03-31-2021 at 12:33 PM. |
03-31-2021, 12:31 PM | #20 |
Sigil Developer
Posts: 7,637
Karma: 5433388
Join Date: Nov 2009
Device: many
|
So the path to the mathjaxfolder is built in MainWindow.cpp Perhaps the bug is there. The mathjax folder should not have a leading "/" in it, right.
From MainWindow.cpp: Code:
#ifdef Q_OS_MAC // On Mac OS X QCoreApplication::applicationDirPath() points to Sigil.app/Contents/MacOS/ QDir execdir(QCoreApplication::applicationDirPath()); execdir.cdUp(); mathjaxurl = execdir.absolutePath() + "/polyfills/MJ/"; #elif defined(Q_OS_WIN32) mathjaxurl = "/" + QCoreApplication::applicationDirPath() + "/polyfills/MJ/"; #else On Windows I am not so sure. What does QCoreApplicationDirPath() return? But then later on we need to build a file url from it and we do it manually. Maybe that is why the "/" is prepended? Code:
m_mathjaxfolder = mathjaxurl; mathjaxurl = mathjaxurl + "MathJax.js"; mathjaxurl = "file://" + Utility::URLEncodePath(mathjaxurl); mathjaxurl = mathjaxurl + "?config=local/SIGIL_EBOOK_MML_SVG"; Last edited by KevinH; 03-31-2021 at 12:37 PM. |
Advert | |
|
03-31-2021, 12:40 PM | #21 |
Sigil Developer
Posts: 7,637
Karma: 5433388
Join Date: Nov 2009
Device: many
|
So we could remove the addition of the leading "/" for Windows in the first snippet:
Code:
#ifdef Q_OS_MAC // On Mac OS X QCoreApplication::applicationDirPath() points to Sigil.app/Contents/MacOS/ QDir execdir(QCoreApplication::applicationDirPath()); execdir.cdUp(); mathjaxurl = execdir.absolutePath() + "/polyfills/MJ/"; #elif defined(Q_OS_WIN32) mathjaxurl = QCoreApplication::applicationDirPath() + "/polyfills/MJ/"; #else Code:
m_mathjaxfolder = mathjaxurl; mathjaxurl = mathjaxurl + "MathJax.js"; mathjaxurl = QUrl::fromLocalFile(mathjaxurl).toString(); mathjaxurl = mathjaxurl + "?config=local/SIGIL_EBOOK_MML_SVG"; Last edited by KevinH; 03-31-2021 at 12:43 PM. |
03-31-2021, 12:50 PM | #22 |
Grand Sorcerer
Posts: 27,547
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I think should, yes. Let me give it a whirl on Windows and Linux and I'll get back to you.
QCoreApplicationDirPath() returns the folder where the Sigil exe is, by the way. That's also where the poyfill folder is located as well. |
03-31-2021, 12:52 PM | #23 |
Sigil Developer
Posts: 7,637
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Just tried it and it works fine on MacOS.
|
03-31-2021, 01:18 PM | #24 |
Grand Sorcerer
Posts: 27,547
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
It fixed things on Windows and continued to work without issue on Linux! Seem a lot cleaner method too.
I'm consistently getting a few errors in inspector related to MathJax on Windows and Linux, though. Are you seeing anything about missing MathMenu.js files and MathZoom.js files? MathJax seems to be looking for them in polyfills/MJ/extensions. The files are definitely not there, I'm just wondering what's looking for them (and if they should be there). |
03-31-2021, 01:25 PM | #25 |
Sigil Developer
Posts: 7,637
Karma: 5433388
Join Date: Nov 2009
Device: many
|
The MathMenu can not be used was was intentionally removed as it allowed the user to change MathJax settings and it can not be interacted with as Preview is not a Browser.
MathZoom is an accessibility features but Prefix's Zoom takes precedence and so it is unneeded as well. MathJax will dynamically load only those extensions that are present. So we should be good to go. Last edited by KevinH; 03-31-2021 at 01:28 PM. |
03-31-2021, 01:27 PM | #26 |
Sigil Developer
Posts: 7,637
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Can you push push that MainWindows Mathjax fix with [deploy] or do you want me to do it?
|
03-31-2021, 01:44 PM | #27 |
Grand Sorcerer
Posts: 27,547
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I'll take care of it.
I know you've already pushed some bigger changes beyond 1.5.1, so I won't be able to use CI to deploy something on the order of a 1.5.2, but that's fine. This has been broken on Windows since July of last year and this is the first report we've gotten on it! So I don't think there's a huge need. We can definitely hold off until Sigil 1.6. I'll make a patch for the 1.5.1 source for anyone who wants to roll their own, and can make an installer available for @snarkophilus and the few others who might not want to live without the fix. This one's on me. I clearly only tested MathJax functionality on my main Linux machine since version 1.2.0, and didn't look any further when it appeared to work. Also, I can't seem to recreate the issue I was having on Linux where setting a custom Sigil temp folder was breaking MathJax functionality in 1.5.1. Perhaps I just missed a restart after changing the enable javascript setting Last edited by DiapDealer; 03-31-2021 at 02:20 PM. |
03-31-2021, 02:11 PM | #28 |
Sigil Developer
Posts: 7,637
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Sounds good.
|
03-31-2021, 07:00 PM | #29 |
Wannabe Connoisseur
Posts: 425
Karma: 2516674
Join Date: Apr 2011
Location: Geelong, Australia
Device: Kobo Libra 2, Kobo Aura 2, Sony PRS-T1, Sony PRS-350, Palm TX
|
Thanks guys for your busy work while I was asleep
|
04-01-2021, 11:07 AM | #30 |
Grand Sorcerer
Posts: 27,547
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
No problem.
It was such a simple change that I replaced the Windows installer packages in the github Sigil 1.5.1 release. Feel free to redownload the installer (don't forget to verify the checksums) and verify that it solves the problem for you. I included a note and the patch for 1.5.1 in the documentation of the release, as well. Last edited by DiapDealer; 04-01-2021 at 02:53 PM. |
Tags |
mathml |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Convert Mathjax to AZW3 | mathbooks | Conversion | 1 | 01-16-2019 10:24 PM |
Calibre mathjax | ELITSIO | Calibre | 7 | 04-01-2017 04:27 AM |
epub and mathjax | vri | Calibre | 24 | 03-31-2017 10:56 PM |
MathJax.epub | phossler | Editor | 8 | 08-23-2015 12:28 PM |
Including MathJax | net-buoy | Sigil | 3 | 02-22-2013 04:44 PM |