rsyntaxtree 1.6.1 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/docs/assets/img/064.png +0 -0
- data/docs/assets/img/065.png +0 -0
- data/docs/assets/svg/064.svg +2 -2
- data/docs/assets/svg/065.svg +2 -2
- data/lib/rsyntaxtree/svg_graph.rb +9 -6
- data/lib/rsyntaxtree/version.rb +1 -1
- data/test/node_styling_test.rb +21 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f13f7407a77bda563986883ec33eed5c2699305e73428582e0caf2c64c7cdf22
|
|
4
|
+
data.tar.gz: 329f1d4357b0034709bd842f117c14ea401dad18b7ca72e65b917149fcc794a9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4bab8dc69ae2631ae4818e41a2b986136ab9b40e20a6e9bd2e4793b745e605193f35920e5679e48f5e37bc89211c26e2a1f659a432292c2fd3c027fe35063ae1
|
|
7
|
+
data.tar.gz: 36db33880b172ac48da638dc0de97797481c88ca6af3bddb632cb1e5f7f795d5146ad1cac5d29f242213157bd16a8c44e031c690d55561fd73076be4bb2dde0e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.6.2] - 2026-06
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Region shade no longer touches the image edge when its padded bounds reach
|
|
7
|
+
past the tree's natural extent (e.g. a deep enclosed/multi-line node): the
|
|
8
|
+
canvas now grows with a margin around the shaded plane.
|
|
9
|
+
|
|
3
10
|
## [1.6.1] - 2026-06
|
|
4
11
|
|
|
5
12
|
### Improved
|
data/docs/assets/img/064.png
CHANGED
|
Binary file
|
data/docs/assets/img/065.png
CHANGED
|
Binary file
|
data/docs/assets/svg/064.svg
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" standalone="no"?>
|
|
2
2
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
-
<svg width="743.6000000000001" height="
|
|
3
|
+
<svg width="743.6000000000001" height="782.075" viewBox="-17.6, 0, 761.2000000000002, 793.325" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
4
4
|
<defs>
|
|
5
5
|
<marker id="arrow" markerUnits="userSpaceOnUse" viewBox="0 0 10 10" refX="10" refY="5" markerWidth="17.6" markerHeight="17.6" orient="auto">
|
|
6
6
|
<path d="M 0 0 L 10 5 L 0 10" fill="#CC79A7"/>
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<line x1="0" y="0" x2="0" y2="10" stroke="#009E73" stroke-width="4"></line>
|
|
25
25
|
</pattern>
|
|
26
26
|
</defs>
|
|
27
|
-
<rect x="-17.6" y="0" width="761.2000000000002" height="
|
|
27
|
+
<rect x="-17.6" y="0" width="761.2000000000002" height="793.325" stroke="none" fill="white" />"
|
|
28
28
|
<rect x='213.4' y='193.5' width='495.0000000000001' height='581.225' rx='11.25' ry='11.25' fill='lightblue' fill-opacity='0.2' stroke='lightblue' stroke-opacity='0.55' stroke-width='2' />
|
|
29
29
|
<text white-space='pre' alignment-baseline='text-top' style='fill: #0072B2; storoke-width: 0; font-size: 32px;' x='216.76250000000002' y='67.5'><tspan x='216.76250000000002' y='67.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">TP</tspan>
|
|
30
30
|
</text>
|
data/docs/assets/svg/065.svg
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" standalone="no"?>
|
|
2
2
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
-
<svg width="
|
|
3
|
+
<svg width="516.2" height="611.075" viewBox="-18.60000000000001, 0, 533.8000000000001, 622.325" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
4
4
|
<defs>
|
|
5
5
|
<marker id="arrow" markerUnits="userSpaceOnUse" viewBox="0 0 10 10" refX="10" refY="5" markerWidth="17.6" markerHeight="17.6" orient="auto">
|
|
6
6
|
<path d="M 0 0 L 10 5 L 0 10" fill="black"/>
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<line x1="0" y="0" x2="0" y2="10" stroke="black" stroke-width="4"></line>
|
|
25
25
|
</pattern>
|
|
26
26
|
</defs>
|
|
27
|
-
<rect x="-
|
|
27
|
+
<rect x="-18.60000000000001" y="0" width="533.8000000000001" height="622.325" stroke="none" fill="white" />"
|
|
28
28
|
<rect x='-7.105427357601002e-15' y='22.5' width='480.0' height='581.225' rx='11.25' ry='11.25' fill='#888888' fill-opacity='0.2' stroke='#888888' stroke-opacity='0.55' stroke-width='2' />
|
|
29
29
|
<rect x='213.4' y='193.5' width='266.6' height='410.225' rx='11.25' ry='11.25' fill='#888888' fill-opacity='0.2' stroke='#888888' stroke-opacity='0.55' stroke-width='2' />
|
|
30
30
|
<rect x='362.79999999999995' y='364.5' width='117.20000000000005' height='239.22500000000002' rx='11.25' ry='11.25' fill='#888888' fill-opacity='0.2' stroke='#888888' stroke-opacity='0.55' stroke-width='2' />
|
|
@@ -69,14 +69,17 @@ module RSyntaxTree
|
|
|
69
69
|
y2 = @height + @global[:height_connector_to_text] / 2
|
|
70
70
|
|
|
71
71
|
# Grow the canvas so region shades that reach past the tree's own bounds
|
|
72
|
-
# (e.g. a region on the root node,
|
|
73
|
-
#
|
|
72
|
+
# (e.g. a region on the root node, or one whose padded edge extends beyond
|
|
73
|
+
# the deepest leaf) keep a margin instead of touching the image edge. A
|
|
74
|
+
# margin is added around the region extents before unioning with the tree
|
|
75
|
+
# bounds. x2/y2 are the viewBox width/height, so right = x1 + x2.
|
|
74
76
|
if @region_bounds
|
|
75
77
|
rb = @region_bounds
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
m = @global[:h_gap_between_nodes]
|
|
79
|
+
left = [x1, rb[:min_x] - m].min
|
|
80
|
+
top = [y1, rb[:min_y] - m].min
|
|
81
|
+
right = [x1 + x2, rb[:max_x] + m].max
|
|
82
|
+
bottom = [y1 + y2, rb[:max_y] + m].max
|
|
80
83
|
new_x2 = right - left
|
|
81
84
|
new_y2 = bottom - top
|
|
82
85
|
@width += new_x2 - x2
|
data/lib/rsyntaxtree/version.rb
CHANGED
data/test/node_styling_test.rb
CHANGED
|
@@ -322,6 +322,27 @@ class NodeStylingTest < Minitest::Test
|
|
|
322
322
|
assert rx + rw <= minx + vbw + eps, "region right clipped beyond viewBox"
|
|
323
323
|
end
|
|
324
324
|
|
|
325
|
+
def test_region_keeps_margin_from_canvas_edge
|
|
326
|
+
# Regression: when a region's padded bounds extend past the tree's natural
|
|
327
|
+
# extent (here an enclosed multi-line node deep in the shaded subtree), the
|
|
328
|
+
# canvas must grow with a margin so the plane does not touch the image edge.
|
|
329
|
+
opts = @base_opts.merge(color: "modern", data: "[S [A x] [%B [C #\\+one\\ \\+two]]]")
|
|
330
|
+
svg = RSyntaxTree::RSGenerator.new(opts).draw_svg
|
|
331
|
+
|
|
332
|
+
minx, miny, vbw, vbh = svg[/viewBox="([^"]*)"/, 1].split(",").map(&:to_f)
|
|
333
|
+
shade = svg[/<rect[^>]*fill-opacity[^>]*>/]
|
|
334
|
+
refute_nil shade
|
|
335
|
+
rx = shade[/\bx='([\-0-9.]+)'/, 1].to_f
|
|
336
|
+
ry = shade[/\by='([\-0-9.]+)'/, 1].to_f
|
|
337
|
+
rw = shade[/width='([\-0-9.]+)'/, 1].to_f
|
|
338
|
+
rh = shade[/height='([\-0-9.]+)'/, 1].to_f
|
|
339
|
+
|
|
340
|
+
bottom_margin = (miny + vbh) - (ry + rh)
|
|
341
|
+
right_margin = (minx + vbw) - (rx + rw)
|
|
342
|
+
assert bottom_margin > 8, "Region must keep a bottom margin from the canvas edge (got #{bottom_margin.round(1)})"
|
|
343
|
+
assert right_margin > 8, "Region must keep a right margin from the canvas edge (got #{right_margin.round(1)})"
|
|
344
|
+
end
|
|
345
|
+
|
|
325
346
|
def test_smart_apostrophe_in_label
|
|
326
347
|
# A straight ASCII apostrophe (U+0027) in a label is rendered as a
|
|
327
348
|
# typographic apostrophe (U+2019) for smarter typography (e.g. X-bar "T'").
|