The wording of "Use MathJax Content Delivery Network (CDN)" checkbox in the configuration does not make sense. It actually means "use the mathjax library given in the URL below". If it is not checked, it will look in libraries/mathjax/mathjax.js.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hameerabbasi’s picture

cilefen’s picture

Title: MathJax copy on local domain not injected properly. » MathJax CDN option text does not make sense
Version: 7.x-2.4 » 8.x-2.x-dev
Category: Bug report » Task
Issue summary: View changes

You must check the CDN box, even if you are using your own copy of the library. The wording is poor in that dialog. To not check the box means "use the library from the default libraries location".

There is the answer. This is something to fix in terms of the wording.

I've bumped this to 8.x-2.x because it looks the same there too.

cilefen’s picture

I would redesign this with radio buttons with this approximate wording:

  • Use the default CDN
  • Use your URL (if chosen, a text box appears)
  • Use the library location (if chosen, a note appears explaining what to do)
pmagunia’s picture

I'd be happy to create a patch for this based on @cilefen comment #3. Will have something within in a week if that is OK.

pmagunia’s picture

Assigned: Unassigned » pmagunia
pmagunia’s picture

pmagunia’s picture

Status: Active » Needs review

Patch submitted for review

hameerabbasi’s picture

Where do I apply this? I've tried patch -p1 < ClarifyMathJaxOptionText.patch in multiple locations, including sites/all/modules/mathjax, /sites/all/modules, /sites/all, /sites and /. It gives me a File to patch prompt every time.

cilefen’s picture

@hameerabbasi Thank you for testing this.

Usually, use git apply. In this case, you should be in the module directory. Note, the patch is for Drupal 8 and you must patch against a git checkout of this project. In Drupal 8, that will be in modules/mathjax.
https://www.drupal.org/node/1054616

hameerabbasi’s picture

Assigned: pmagunia » hameerabbasi

I'm on 7.x, currently. Let me set up an install for 8 beta real quick on my local machine to test.

hameerabbasi’s picture

I'm having trouble testing this, I can't install a new module via the Extend interface, it just redirects back to the same page.

I've tried XAMPP, WAMP and XAMPP Drupal module. It simply doesn't work. I've tried taking ownership too.

I apologize. Can someone else test this on their install or help me out?

cilefen’s picture

@hameerabbasi I am pleased to have you helping. We will need continued help so I would like to show you how this is done. There are some things you may not know that will help things make sense:

  1. Downloading and installing modules via the GUI in Drupal 8 is broken right now, which is why it did not work for you.
  2. Patches are always "rolled" against the development branch. That means you must have git installed to test a patch.

One of the *amp stacks may provide you a command prompt with access to git or download it. Next, do the following:

cd modules
git clone --branch 8.x-2.x http://git.drupal.org/project/mathjax.git

It will be a good idea to get the libraries module as well and unzip it to modules/libraries.

Now you can return to the Drupal 8 GUI and enable the MathJax module. You should verify that the module works before applying the patch. Next, you apply the patch:

cd modules/mathjax
git apply ClarifyMathJaxOptionText.patch

Clear the site caches and review the changes.

hameerabbasi’s picture

Status: Needs review » Needs work
FileSize
55.77 KB
61.02 KB
40.63 KB
39.08 KB

Thank you for all your help. However, it seems the patch breaks the module. I tested before the patch, and also after, and reversed with git apply -R and tested again. Made sure to clear all caches each time.

It appears it works for custom URL and local libraries directory. It's just the CDN part that's broken.

Also, just a little suggestion: The default value filled into the text field should be the address of the CDN.

pmagunia’s picture

@hameerabbasi,

This patch should address the issue you mentioned in comment #13.

A new variable/constant is created for the official MathJax CDN so that it does not depend on the value of the textfield.

Just type this command assuming we left off where we did:

git apply interdiff.txt

The txt file will need to be added to the MathJax 8 directory. You will also need to be in that directory when you execute the command. You may get a warning about whitespace but it can be ignored at this point.

Since we already applied the first patch, you don't need to worry about ClarifyMathJaxOptionText2.patch attached to this comment.

hameerabbasi’s picture

Status: Needs work » Reviewed & tested by the community

It works for my Drupal 8 installation.

I have to say, this is a great community. I made a mistake assuming the module problem was on my end and you helped me through it.

I know how to use command lines and I program, too, mainly in C#. But it's nice to see you welcome newcomers this way.

Take care!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 14: ClarifyMathJaxOptionText2.patch, failed testing.

cilefen’s picture

@hameerabbasi Thank you for reviewing. I have a few more things to add:

+++ b/src/Form/MathjaxSettingsForm.php
@@ -45,20 +45,25 @@ class MathjaxSettingsForm extends ConfigFormBase {
+      '#title' => $this->t('Path to MathJax source files'),

Would "Path to MathJax source" make more sense here?

Custom URL could be path could be "Custom URL".

If "MathJax CDN" is chosen, the text input field should be visible but disabled.

Let's start with those.

pmagunia’s picture

Status: Needs work » Needs review
FileSize
7.48 KB
1.16 KB

Attaching patch with recommendations from comment #18.

hameerabbasi’s picture

Status: Needs review » Reviewed & tested by the community

It seems to work. Great recommendations. I had one more, probably minor. When MaxJax CDN is selected, the text box should show the URL of the default CDN repo. If it's on custom, the URL should be freely editable. If it's on the libraries directory, it should still be visible show the URL of the libraries directory.

I'm marking this Reviewed and tested since it's already pretty good. However, feel free to mark it is "needs work" and submit another patch if it's feasible and practical to implement my suggestions.

cilefen’s picture

Status: Reviewed & tested by the community » Needs review

Let's not rush.

pmagunia’s picture

After retesting, patch in comment #19 still works well.

cilefen’s picture

Status: Needs review » Needs work

'"Custom URL" source' should be 'Custom URL'.

When you switch from 'MathJax' CDN to 'Custom URL' and back to 'MathJax CDN', the module does not render equations any more.

There could be other issues but let's start with those.

pmagunia’s picture

The equations are still being rendered when I switch between CDN and Custom the way you mention.

The last submitted patch, 6: ClarifyMathJaxOptionText.patch, failed testing.

The last submitted patch, 19: ClarifyMathJaxOptionText3.patch, failed testing.

The last submitted patch, 6: ClarifyMathJaxOptionText.patch, failed testing.

The last submitted patch, 14: ClarifyMathJaxOptionText2.patch, failed testing.

The last submitted patch, 19: ClarifyMathJaxOptionText3.patch, failed testing.

cilefen’s picture

Version: 8.x-2.x-dev » 3.0.x-dev