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

Bugfix: Some boxes serialized as graphics weren't recognized as graphics later on #1041

Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion Source/Chatbook/Graphics.wl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ $$graphicsPattern = HoldPattern @ Alternatives[
_Graphics3D,
_Image,
_Image3D,
_Legended
_Legended,
Dynamic[ RawBoxes[ _FEPrivate`ImportImage ], ___ ]
];

$$definitelyNotGraphics = HoldPattern @ Alternatives[
Expand Down
6 changes: 5 additions & 1 deletion Source/Chatbook/Serialization.wl
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,11 @@ boxesToExpressionURI[ boxes_ ] :=
Replace[
Quiet @ ToExpression[ boxes, StandardForm, HoldComplete ],
{
HoldComplete[ expr_ ] :> MakeExpressionURI @ Unevaluated @ expr,
HoldComplete[ expr_ ] :> (
(* Ensure that the expression is recognized as a graphics expression later: *)
HoldPattern[ graphicsQ[ Verbatim @ expr ] ] = True;
MakeExpressionURI @ Unevaluated @ expr
),
_? FailureQ :> MakeExpressionURI[ "image", RawBoxes @ StyleBox[ boxes, "GraphicsRawBoxes" ] ]
}
];
Expand Down
Loading