Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/AbstractAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,19 @@ macro show_special(io, O)
end )
end

macro show_special(io, mime, O)
return :( begin
local i = $(esc(io))
local m = $(esc(mime))
local o = $(esc(O))
s = get_attribute(o, :show)
if s !== nothing
s(i, m, o)
return
end
end )
end

macro show_special_elem(io, e)
return :( begin
local i = $(esc(io))
Expand All @@ -475,6 +488,20 @@ macro show_special_elem(io, e)
end )
end

macro show_special_elem(io, mime, e)
return :( begin
local i = $(esc(io))
local m = $(esc(mime))
local a = $(esc(e))
local o = parent(a)
s = get_attribute(o, :show_elem)
if s !== nothing
s(i, m, a)
return
end
end )
end

###############################################################################
# generic fall back if no immediate coercion is possible
# can/ should be called for more generic general coercion mechanisms
Expand Down