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

resolves #1475 bridge common Ruby object methods #1491

Merged
merged 1 commit into from
Jan 19, 2022

Conversation

ggrossetie
Copy link
Member

It's more a workaround than an actual solution but should be good enough.

resolves #1475

@ggrossetie
Copy link
Member Author

@mojavelinux I would be interesting in hearing your thoughts. The main issue is when we call ConverterFactory.register with an instance (created from a plain JavaScript class):

class DummyConverter {
  // ...
}

asciidoctor.ConverterFactory.register(new DummyConverter(), ['dummy'])

In this case, the instance is missing quite a few Ruby methods.
It's possible to use Opal.klass to bridge a native JS class but as far as I know it's not possible to bridge a instance:

https://github.com/opal/opal/blob/a46adeac3cb7b5e13a8ac9e77dd3aa11278ccef8/opal/corelib/runtime.js#L625-L651

Also, we would need to specify the "superclass" in the register function.

@mojavelinux
Copy link
Member

It seems reasonable to me. I'll admit, I'm not a big fan of this porcelain APIs because of the bridging that has to happen underneath. (I prefer to work within Opal). But I understand that it's important to a certain group of users...and thus the details should be hidden as much as possible in those cases.

@ggrossetie
Copy link
Member Author

It seems reasonable to me.

👍🏻

I'll admit, I'm not a big fan of this porcelain APIs because of the bridging that has to happen underneath. (I prefer to work within Opal). But I understand that it's important to a certain group of users...and thus the details should be hidden as much as possible in those cases

Yes it's a trade-off, the porcelain API is not perfect and won't give the full power of using Opal directly but it's definitely more pleasant to use when you are not familiar with Opal.

@flobilosaurus
Copy link

Hi, is there any plan when this fix is integrated ?

@jayczech23
Copy link

Hi all, also interested in hearing the timeline for integration of this fix.

Thank you :D .

@ggrossetie
Copy link
Member Author

@jayczech23 Since it's a low-level bug fix I'm curious to know why you are waiting for this fix? Are you using the AsciiDoc Slides VS code extension?

@ggrossetie ggrossetie merged commit bb39bb2 into asciidoctor:main Jan 19, 2022
@ggrossetie ggrossetie deleted the issue-1475-converter-eqeq branch January 19, 2022 13:01
ggrossetie added a commit to ggrossetie/asciidoctor.js that referenced this pull request Jan 19, 2022
ggrossetie added a commit to ggrossetie/asciidoctor.js that referenced this pull request Jan 19, 2022
@jayczech23
Copy link

@Mogztter, I am actually attempting to implement RevealJS into an Electron app, came across this error when using Asciidoctor RevealJS API described in docs

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.

TypeError: converter.$== is not a function on custom converter
4 participants