Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tailor AsciiMath better for MathObjects #2296

Merged
merged 2 commits into from
Feb 7, 2024

Conversation

Alex-Jordan
Copy link
Contributor

This makes changes to the AsciiMath portion of the MathJax config so that it behaves more consistently with MathObjects. AsciiMath input is used by MathView and can be used when composing text that can have math that will be rendered (a student's essay answer or instructor feedback). Changes are:

  • disable in, so you don't see a on your way to making .
  • disable ne so you can enter dne and none without seeing d≠ and no≠.
  • as has been the case for a long time, let ** be interpreted as ^.
  • replace AsciiMath's infty with inf.
  • add Re, Im, log10, U, and ><.

This is well on its way to addressing #638. Perhaps more can be done to get greater consistency with MathObjects and AsciiMath input, but the process is demonstrated now for removing, modifying, or adding triggers.

@Alex-Jordan Alex-Jordan force-pushed the mathview branch 3 times, most recently from 30d6eea to 28fa07a Compare January 4, 2024 23:45
@Alex-Jordan
Copy link
Contributor Author

I made some changes to this.

  • more concise code (and I think more efficient, but that depends on efficiency of javascript looping and indexOf method)
  • In addition to adding what I added before, also added infinity, Infinity, Inf, INFINITY, INF, none, None, NONE, dne, Dne, DNE.
  • No longer disabling in. If you type in, you see . But as soon as you type an f the underlying text is inf and now you see . I think this is fine, and allows in to still be there in case (for example) an instructor wants that in some feedback message.
  • No longer disabling ne, since none and dne are now officially recognized.

Copy link
Member

@drgrice1 drgrice1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks okay to me for the most part.

This file needs some work though.

It needs to be updated to use modern javascript. The var usage needs to be updated to const or let appropriately. I have done this, and was going to make a pull request at some point. Note that you have two var i definitions (on lines 11 and 38). Those are actually the same variable as the second gets hoisted. That is why var should never be used anymore. The for loop does not limit scope of a var.

Also, the formatting will need to be cleaned up. Soon I plan to add a workflow to use prettier on javascript files for formatting. The newTriggers definition will be expanded quite a bit since it exceeds the 120 character limit.

@Alex-Jordan
Copy link
Contributor Author

I updated the var declarations I added (but not the ones that were already in the file and not part of this change).

I'm not sure how best to change the formatting on newTriggers. Is the prettier change coming soon?

@drgrice1
Copy link
Member

Don't worry about the prettier formatting. That will be taken care of when it is ready. I just wanted to point out that the wide formatting wont work with that. Like perltidy, prettier will auto format the code.

Copy link
Member

@pstaabp pstaabp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pstaabp
Copy link
Member

pstaabp commented Feb 7, 2024

Should we close #638 now?

@pstaabp pstaabp merged commit 54cad3d into openwebwork:develop Feb 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants