1414
1515(* For new style packages see: https://mathematica.stackexchange.com/a/176489) *)
1616(* Declare package context *)
17- BeginPackage ["preview`" ]
17+ BeginPackage ["preview`" ];
1818
19- PreviewFunction [response_ ] := Module [{parsedResponse , latexString , wolframString },
19+ PreviewFunction [response_ ] := Module [{latexString , wolframString , parsedResponse },
2020 Print ["Running Preview Function" ];
2121 Print ["Preview Input:" , response ];
2222
3232 ]
3333 ];
3434
35- latexString = ToString [TeXForm [ parsedResponse ] ];
36- wolframString = ToString [InputForm [ parsedResponse ] ];
35+ latexString = ToString [parsedResponse , TeXForm ];
36+ wolframString = ToString [parsedResponse , InputForm ];
3737
38- (* Below is the current format expected by Lambda Feedback. Both the latex and sympy fields are currently required.
39- To suggest that sympy gets renamed to parsed-expression or similar.*)
4038 < |
41- "command" -> "preview" ,
42- "result" -> < |
43- "preview" -> < |
44- "latex" -> latexString ,
45- "sympy" -> wolframString
46- |>
47- |>
48- |>
49- ]
39+ "parsedResponse" -> ToString [parsedResponse ],
40+ "latexString" -> latexString ,
41+ "sympyString" -> wolframString
42+ |>
43+ ];
5044
51- Begin ["`Private`" ]
45+ Begin ["`Private`" ];
5246
5347SafeToExpression [str_ String ] :=
5448 Module [{expr , result },
8579
8680
8781
88- End []
89- EndPackage []
82+ End [];
83+ EndPackage [];
0 commit comments