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

changed optional argument syntax of \img command (img.js extension) to be more LaTeX-like #14

Merged
merged 3 commits into from
Jan 20, 2015

Conversation

burnpanck
Copy link
Contributor

Optional arguments are now given either as

\img[valign=<valign>,width=<width>,height=<height>]{URL}

or

\img[<valign>][<width>][<height>]{URL}

which are both common ways to supply optional parameters in LaTeX (the latter is usually used when there is just one optional argument). Example in http://jsfiddle.net/c6sy534g/

@burnpanck
Copy link
Contributor Author

Packed source was not yet updated, as I didn't come around yet to actually install MathJax's toolchain.

@pkra
Copy link
Contributor

pkra commented Oct 13, 2014

Thanks. I haven't had time to look in detail. But you can pack it any way you like; we don't have many for third-party extensions. Coudl you fill out http://www.mathjax.org/cla/ (and reply to the confirmation email)? We don't require this for third party extensions in general, but since this is one the MathJax team created and since it might eventually make it to the core repository, we'd need a CLA. Thanks!

@pkra
Copy link
Contributor

pkra commented Oct 20, 2014

Sorry for the delay. This looks good in general.

Perhaps the error messages could end in 'in %1' (which means "in \image" for this macro). Ideally, they would be localizable (but this can wait until this actually enteres the core). For both, cf. https://github.com/mathjax/MathJax/blob/master/unpacked/extensions/TeX/verb.js#L47

@pkra
Copy link
Contributor

pkra commented Nov 7, 2014

bump

@burnpanck
Copy link
Contributor Author

like so?

var opts = optarg.split(',');
for(var i=0,l=opts.length;i<l;++i){
var parts = opts[i].split('=');
var key = parts[0].trim();
Copy link
Member

Choose a reason for hiding this comment

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

Note that the string trim() function is not available in IE8 and below, so this will cause those browsers to die. Perhaps using parts[0].replace(/^ +/,"").replace(/ +$/,"")would be better (if less efficient) here.

@pkra
Copy link
Contributor

pkra commented Jan 19, 2015

I clearly lost track of this. Can we merge this?

@dpvc
Copy link
Member

dpvc commented Jan 19, 2015

Well, I had made some comments on the code that haven't been addressed. But since it was your extension to begin with, it is really up to you whether you want to accept the changes or not (or accept and then modify afterward).

I'm happy in principle with it, but do thing those few things could be altered.

@pkra
Copy link
Contributor

pkra commented Jan 19, 2015

Thanks, Davide.

@burnpanck are you ok with merging it or do you want to modify this further?

@burnpanck
Copy link
Contributor Author

Sorry, my fault. I'm rather busy these days unfortunately. I did now apply the changes @dpvc suggested. With that I am ok to merge.

@pkra
Copy link
Contributor

pkra commented Jan 20, 2015

Thanks, @burnpanck -- that's great!

pkra added a commit that referenced this pull request Jan 20, 2015
changed optional argument syntax of \img command (img.js extension) to be more LaTeX-like
@pkra pkra merged commit eb1949a into mathjax:master Jan 20, 2015
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.

None yet

3 participants