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

Add to_iruby_mimebundle support #304

Merged
merged 4 commits into from
Jun 20, 2021
Merged

Add to_iruby_mimebundle support #304

merged 4 commits into from
Jun 20, 2021

Conversation

mrkn
Copy link
Contributor

@mrkn mrkn commented Jun 19, 2021

Introduce to_iruby_mimebundle method support like IPython's _repr_mimebundle.

The new display algorithm is below.

If the object to be displayed can respond to to_iruby_mimebundle, IRuby first tries to format the object by this method.
Then, IRuby tries to format the object by the renderers registered in the registry into MIME-types that are not formatted by to_iruby_mimebundle.
Moreover, IRuby tries to format the object by to_xxx method for the MIME-types that have not been formatted in the following list.

  • text/html by to_html method
  • text/markdown by to_markdown method
  • image/svg+xml by to_svg method
  • image/png by to_png method
  • application/pdf by to_pdf method
  • image/jpeg by to_jpeg method
  • text/latex by to_latex or to_tex method
  • application/javascript by to_javascript method

If none of MIME-type are formatted at this time, IRuby tries to format the object by to_iruby method.

Finally, IRuby generates the text/plain format by inspect method if text/plain format is not generated yet.

@mrkn
Copy link
Contributor Author

mrkn commented Jun 19, 2021

CI fails due to network errors. I tried to re-run after some hours.

@mrkn mrkn force-pushed the to_iruby_mimebundle branch from 2a03683 to d0c8e9c Compare June 20, 2021 03:50
@mrkn
Copy link
Contributor Author

mrkn commented Jun 20, 2021

CI fails due to network errors. I tried to re-run after some hours.

It was not due to network errors, but my fault by missing apt update before apt install.

@mrkn mrkn merged commit 9ebae7d into master Jun 20, 2021
@mrkn mrkn deleted the to_iruby_mimebundle branch June 20, 2021 04:00
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.

1 participant