Skip to content

Commit 16bc004

Browse files
committed
Merge branch 'master' of github.com:mathics/Mathics
2 parents 7808d60 + 4f89498 commit 16bc004

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

mathics/builtin/assignment.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,12 +1003,13 @@ def _get_usage_string(symbol, evaluation, htmlout=False):
10031003
from mathics.doc.common_doc import XMLDoc
10041004

10051005
docstr = bio.builtin.__class__.__doc__
1006+
title = bio.builtin.__class__.__name__
10061007
if docstr is None:
10071008
return None
10081009
if htmlout:
1009-
usagetext = XMLDoc(docstr).html()
1010+
usagetext = XMLDoc(docstr, title).html()
10101011
else:
1011-
usagetext = XMLDoc(docstr).text(0)
1012+
usagetext = XMLDoc(docstr, title).text(0)
10121013
usagetext = re.sub(r"\$([0-9a-zA-Z]*)\$", r"\1", usagetext)
10131014
return usagetext
10141015
return None

mathics/builtin/box/graphics3d.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,6 @@ def calc_dimensions(final_pass=True):
303303
light["target"][j] * boxscale[j] for j in range(3)
304304
]
305305

306-
# Rescale viewpoint
307-
self.viewpoint = [
308-
vp * max([xmax - xmin, ymax - ymin, zmax - zmin])
309-
for vp in self.viewpoint
310-
]
311-
312306
w = 0 if (xmin is None or xmax is None) else xmax - xmin
313307
h = 0 if (ymin is None or ymax is None) else ymax - ymin
314308

@@ -394,6 +388,7 @@ def boxes_to_json(self, leaves=None, **options):
394388
},
395389
"lighting": self.lighting,
396390
"viewpoint": self.viewpoint,
391+
"protocol": "1.0",
397392
}
398393
)
399394

@@ -601,7 +596,11 @@ def boxes_to_tex(self, leaves=None, **options):
601596
""".format(
602597
asy_number(width / 60),
603598
asy_number(height / 60),
604-
self.viewpoint,
599+
# Rescale viewpoint
600+
[
601+
vp * max([xmax - xmin, ymax - ymin, zmax - zmin])
602+
for vp in self.viewpoint
603+
],
605604
asy,
606605
boundbox_asy,
607606
)

mathics/doc/common_doc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,7 @@ class XMLDoc(object):
14891489
Mathics core also uses this in getting usage strings (`??`).
14901490
"""
14911491

1492-
def __init__(self, doc, title, section):
1492+
def __init__(self, doc, title, section=None):
14931493
self.title = title
14941494
if section:
14951495
chapter = section.chapter

mathics/format/svg.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,13 @@ def density_plot_box(self, **options):
178178
for index, triangle_coords in enumerate(self.lines):
179179
triangle = [coords.pos() for coords in triangle_coords]
180180
colors = [rgb.to_js() for rgb in self.vertex_colors[index]]
181-
r = (colors[0][0] + colors[1][0] + colors[2][0]) / 3.0
182-
g = (colors[0][1] + colors[1][1] + colors[2][1]) / 3.0
183-
b = (colors[0][2] + colors[1][2] + colors[2][1]) / 3.0
184-
mid_color = r"rgb(%f%%, %f%%, %f%%)" % (r * 100, g * 100, b * 100)
181+
r = (colors[0][0] + colors[1][0] + colors[2][0]) / 3
182+
g = (colors[0][1] + colors[1][1] + colors[2][1]) / 3
183+
b = (colors[0][2] + colors[1][2] + colors[2][1]) / 3
184+
mid_color = r"rgb(%f, %f, %f)" % (r * 255, g * 255, b * 255)
185185

186186
points = " ".join("%f,%f" % (point[0], point[1]) for point in triangle)
187-
svg_data.append(f'<polygon points="{points}" style="fill: {mid_color}" />')
187+
svg_data.append(f'<polygon points="{points}" fill="{mid_color}" />')
188188

189189
svg = "\n".join(svg_data)
190190
# print("DensityPlot: ", svg)

0 commit comments

Comments
 (0)