Skip to content

Commit 20916bc

Browse files
joschmittooinaruhugh
authored andcommitted
Add ::MIME"text/plain" versions of show_special macros (Nemocas#1583)
1 parent 281fdb7 commit 20916bc

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/AbstractAlgebra.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,19 @@ macro show_special(io, O)
462462
end )
463463
end
464464

465+
macro show_special(io, mime, O)
466+
return :( begin
467+
local i = $(esc(io))
468+
local m = $(esc(mime))
469+
local o = $(esc(O))
470+
s = get_attribute(o, :show)
471+
if s !== nothing
472+
s(i, m, o)
473+
return
474+
end
475+
end )
476+
end
477+
465478
macro show_special_elem(io, e)
466479
return :( begin
467480
local i = $(esc(io))
@@ -475,6 +488,20 @@ macro show_special_elem(io, e)
475488
end )
476489
end
477490

491+
macro show_special_elem(io, mime, e)
492+
return :( begin
493+
local i = $(esc(io))
494+
local m = $(esc(mime))
495+
local a = $(esc(e))
496+
local o = parent(a)
497+
s = get_attribute(o, :show_elem)
498+
if s !== nothing
499+
s(i, m, a)
500+
return
501+
end
502+
end )
503+
end
504+
478505
###############################################################################
479506
# generic fall back if no immediate coercion is possible
480507
# can/ should be called for more generic general coercion mechanisms

0 commit comments

Comments
 (0)