|
16 | 16 | from math import ceil |
17 | 17 | from typing import Optional |
18 | 18 |
|
19 | | -from mathics.builtin.box.layout import GridBox, RowBox, to_boxes |
| 19 | +from mathics.builtin.box.layout import ( |
| 20 | + GridBox, |
| 21 | + InterpretationBox, |
| 22 | + PaneBox, |
| 23 | + RowBox, |
| 24 | + to_boxes, |
| 25 | +) |
20 | 26 | from mathics.builtin.forms.base import FormBaseClass |
21 | 27 | from mathics.builtin.makeboxes import MakeBoxes, NumberForm_to_String |
22 | 28 | from mathics.builtin.tensors import get_dimensions |
|
29 | 35 | StringFromPython, |
30 | 36 | ) |
31 | 37 | from mathics.core.builtin import Builtin |
| 38 | +from mathics.core.convert.prettyprint import expression_to_2d_text |
32 | 39 | from mathics.core.evaluation import Evaluation |
33 | 40 | from mathics.core.expression import BoxError, Expression |
34 | 41 | from mathics.core.list import ListExpression |
@@ -561,8 +568,18 @@ class OutputForm(FormBaseClass): |
561 | 568 | = -Graphics- |
562 | 569 | """ |
563 | 570 |
|
| 571 | + formats = {"OutputForm[s_String]": "s"} |
564 | 572 | summary_text = "plain-text output format" |
565 | 573 |
|
| 574 | + def eval_makeboxes(self, expr, form, evaluation): |
| 575 | + """MakeBoxes[OutputForm[expr_], form_]""" |
| 576 | + print(" eval Makeboxes outputform") |
| 577 | + text2d = expression_to_2d_text(expr, evaluation, form).text |
| 578 | + elem1 = PaneBox(String(text2d)) |
| 579 | + elem2 = Expression(SymbolOutputForm, expr) |
| 580 | + result = InterpretationBox(elem1, elem2) |
| 581 | + return result |
| 582 | + |
566 | 583 |
|
567 | 584 | class PythonForm(FormBaseClass): |
568 | 585 | """ |
|
0 commit comments