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

iterate over last dimension when grouping N-D tables of images #627

Merged
merged 3 commits into from Apr 14, 2017
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/showmime.jl
Expand Up @@ -48,9 +48,9 @@ end

function _show_odd{T<:ColorantMatrix, N}(io::IO, m::MIME"text/html", imgs::AbstractArray{T, N})
colons = ([Colon() for i=1:(N-1)]...)
for i = 1:size(imgs, 1)
for i = 1:size(imgs, N)
Copy link
Member

Choose a reason for hiding this comment

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

is it worth changing this to for i in indices(imgs, N) ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. I'll do that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok, done

write(io, "<td style='text-align:center;vertical-align:middle; margin: 0.5em;border:1px #90999f solid;border-collapse:collapse'>")
_show_even(io, m, view(imgs, i, colons...)) # show even
_show_even(io, m, view(imgs, colons..., i)) # show even
write(io, "</td>")
end
end
Expand All @@ -60,9 +60,9 @@ function _show_even{T<:ColorantMatrix, N}(io::IO, m::MIME"text/html", imgs::Abst
centering = center ? " style='margin: auto'" : ""
write(io, "<table$centering>")
write(io, "<tbody>")
for i = 1:size(imgs, 1)
for i = 1:size(imgs, N)
write(io, "<tr>")
_show_odd(io, m, view(imgs, i, colons...)) # show odd
_show_odd(io, m, view(imgs, colons..., i)) # show odd
write(io, "</tr>")
end
write(io, "</tbody>")
Expand Down