Skip to content

Commit

Permalink
Bugfix: Some boxes serialized as graphics weren't recognized as graph…
Browse files Browse the repository at this point in the history
…ics later on
  • Loading branch information
rhennigan committed Jan 21, 2025
1 parent 59a2cd7 commit 18acbec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit 18acbec

Please sign in to comment.