Skip to content

Commit

Permalink
Merge pull request #1041 from WolframResearch/1020-some-expressions-a…
Browse files Browse the repository at this point in the history
…rent-recognized-as-graphics-causing-internal-failures

Bugfix: Some boxes serialized as graphics weren't recognized as graphics later on
  • Loading branch information
rhennigan authored Jan 21, 2025
2 parents 59a2cd7 + 18acbec commit 41fe620
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 41fe620

Please sign in to comment.