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 ::MIME"text/plain" versions of show_special macros #1583

Merged
merged 1 commit into from
Jan 29, 2024
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
Loading