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

Put longer type into th title argument in HTML show #2774

Merged
merged 9 commits into from
May 26, 2021

Conversation

mortenpi
Copy link
Contributor

Adds a title argument to the types in the HTML output, so that we would get the full type (up to 256 characters) when hovering over the shortened type with a mouse:

Screenshot from 2021-05-24 14-15-24

@mortenpi
Copy link
Contributor Author

The test failures are coming from the string comparisons of the show output. Will happily fix them if the implementation looks good to you.

@@ -195,10 +199,15 @@ function _show(io::IO, ::MIME"text/html", df::AbstractDataFrame;
if eltypes
write(io, "<tr>")
write(io, "<th></th>")
ct = batch_compacttype(Any[eltype(df[!, idx]) for idx in 1:mxcol])
# We put a longer string for the type into the title argument of the <th> element,
Copy link
Member

Choose a reason for hiding this comment

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

I think it is OK

@bkamins bkamins added this to the patch milestone May 24, 2021
@bkamins
Copy link
Member

bkamins commented May 24, 2021

Looks very good. Thank you!

@ronisbr - it would be good to have it in PrettyTables.jl also.

CC @nalimilan

@ronisbr
Copy link
Member

ronisbr commented May 24, 2021

@ronisbr - it would be good to have it in PrettyTables.jl also.

This feature is awesome! I will add an option into PrettyTables.jl to create comments for each HTML cell. Thus, the packages can use it as they like.

@mortenpi
Copy link
Contributor Author

After a bit of whack-a-mole, I think I got all the tests fixed 🙂

@bkamins
Copy link
Member

bkamins commented May 25, 2021

@nalimilan - can you please have a quick look before I merge (there is a small code layout fix that I asked but it does not affect the solution). Thank you!

Copy link
Member

@nalimilan nalimilan left a comment

Choose a reason for hiding this comment

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

Nice! That's especially useful to explain that T? means Union{T, Missing}.

@bkamins
Copy link
Member

bkamins commented May 26, 2021

@mortenpi - I have pushed a NEWS.md entry for your PR. Please let me know if it is OK. Then I will merge. Thank you!

@mortenpi
Copy link
Contributor Author

LGTM!

@bkamins bkamins merged commit d5bb28d into JuliaData:main May 26, 2021
@bkamins
Copy link
Member

bkamins commented May 26, 2021

Thank you!

@mortenpi mortenpi deleted the mp/html-show-title branch May 26, 2021 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants