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

Delimiters not created correctly in MathJax.Hub.Config #60

Closed
nerk opened this issue Oct 5, 2014 · 6 comments
Closed

Delimiters not created correctly in MathJax.Hub.Config #60

nerk opened this issue Oct 5, 2014 · 6 comments
Assignees
Labels
Milestone

Comments

@nerk
Copy link
Member

nerk commented Oct 5, 2014

The asciidoctor.js generated MathJax.Hub.Config script block is incorrect and differs from the one created by Ruby Asciidoctor (tested with 1.5.0 and 1.5.1).

This node.js sample code

var asciidoctor = require('asciidoctor.js')();
var opal = asciidoctor.Opal;

var  processor = asciidoctor.Asciidoctor(true);

var content = ":stem: \nhttp://asciidoctor.org[*Asciidoctor*] " +
    "running on http://opalrb.org[_Opal_] " +
    "brings AsciiDoc to Node.js!";
var options = opal.hash2(
    ['doctype', 'header_footer'],
    {doctype: 'article', header_footer: true});
var html = processor.$convert(content, options);
console.log(html);

embeds this

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  tex2jax: {
    inlineMath: [\(,\)],
    displayMath: [\[,\]],
    ignoreClass: "nostem|nolatexmath"
  },
  asciimath2jax: {
    delimiters: [\$,\$],
    ignoreClass: "nostem|noasciimath"
  }
});
</script>

non-working configuration block into HTML.

The correct one created by Ruby Asciidoctor looks like this:

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  tex2jax: {
    inlineMath: [["\\(","\\)"]],
    displayMath: [["\\[","\\]"]],
    ignoreClass: "nostem|nolatexmath"
  },
  asciimath2jax: {
    delimiters: [["\\$","\\$"]],
    ignoreClass: "nostem|noasciimath"
  }
});
</script>
@mojavelinux
Copy link
Member

I wonder if this is an Opal error that we'll need to work around. Aha, I think I see it. We are relying on the to_s export of an array to do the right thing and this is where Opal gets confused. We'll need to be more explicit about how we construct this JavaScript string in core. Let's get this fixed for 1.5.2 upstream (core).

@mojavelinux
Copy link
Member

I've made the necessary change upstream. Now, we'll need a spec to verify the output to ensure it doesn't break in the future.

@ggrossetie
Copy link
Member

@mojavelinux @nerk I believe Asciidoctor.js 1.5.2 had resolved this issue ?

@mojavelinux
Copy link
Member

I'm quite certain it does. I'll wait to get the ack from @nerk.

@nerk
Copy link
Member Author

nerk commented Dec 23, 2014

@mojavelinux @Mogztter Yes, this issue is resolved!

@ggrossetie
Copy link
Member

Hooray

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants