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 all 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
10 changes: 5 additions & 5 deletions src/showmime.jl
Expand Up @@ -39,7 +39,7 @@ map8(x::Number) = N0f8(x)

function _show_odd{T<:ColorantMatrix}(io::IO, m::MIME"text/html", imgs::AbstractArray{T, 1})
# display a vector of images in a row
for j = 1:length(imgs)
for j in eachindex(imgs)
write(io, "<td style='text-align:center;vertical-align:middle; margin: 0.5em;border:1px #90999f solid;border-collapse:collapse'>")
show_element(IOContext(io, thumbnail=true), imgs[j])
write(io, "</td>")
Expand All @@ -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 in indices(imgs, N)
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 in indices(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