rsyntaxtree 1.6.1 → 1.6.3
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 +19 -0
- data/Rakefile +19 -0
- data/docs/.gitignore +0 -0
- data/docs/404.html +0 -0
- data/docs/Gemfile +0 -0
- data/docs/_config.yml +0 -0
- data/docs/_examples/000.md +0 -0
- data/docs/_examples/001.md +0 -0
- data/docs/_examples/002.md +0 -0
- data/docs/_examples/003.md +0 -0
- data/docs/_examples/004.md +0 -0
- data/docs/_examples/005.md +0 -0
- data/docs/_examples/006.md +0 -0
- data/docs/_examples/007.md +0 -0
- data/docs/_examples/008.md +0 -0
- data/docs/_examples/009.md +0 -0
- data/docs/_examples/010.md +0 -0
- data/docs/_examples/011.md +0 -0
- data/docs/_examples/012.md +0 -0
- data/docs/_examples/013.md +0 -0
- data/docs/_examples/014.md +0 -0
- data/docs/_examples/015.md +0 -0
- data/docs/_examples/016.md +0 -0
- data/docs/_examples/017.md +0 -0
- data/docs/_examples/018.md +0 -0
- data/docs/_examples/019.md +0 -0
- data/docs/_examples/020.md +0 -0
- data/docs/_examples/021.md +0 -0
- data/docs/_examples/022.md +0 -0
- data/docs/_examples/023.md +0 -0
- data/docs/_examples/024.md +0 -0
- data/docs/_examples/025.md +0 -0
- data/docs/_examples/026.md +0 -0
- data/docs/_examples/027.md +0 -0
- data/docs/_examples/028.md +0 -0
- data/docs/_examples/029.md +0 -0
- data/docs/_examples/030.md +0 -0
- data/docs/_examples/031.md +0 -0
- data/docs/_examples/032.md +0 -0
- data/docs/_examples/033.md +0 -0
- data/docs/_examples/034.md +0 -0
- data/docs/_examples/035.md +0 -0
- data/docs/_examples/036.md +0 -0
- data/docs/_examples/037.md +0 -0
- data/docs/_examples/038.md +0 -0
- data/docs/_examples/039.md +0 -0
- data/docs/_examples/040.md +0 -0
- data/docs/_examples/041.md +0 -0
- data/docs/_examples/042.md +0 -0
- data/docs/_examples/043.md +0 -0
- data/docs/_examples/044.md +0 -0
- data/docs/_examples/045.md +0 -0
- data/docs/_examples/046.md +0 -0
- data/docs/_includes/box_and_circle_table.html +0 -0
- data/docs/_includes/escape_char_table.html +0 -0
- data/docs/_includes/social_media_links.html +0 -0
- data/docs/_layouts/default.html +0 -0
- data/docs/assets/css/style.scss +0 -0
- data/docs/assets/img/064.png +0 -0
- data/docs/assets/img/065.png +0 -0
- data/docs/assets/img/elements/circle.png +0 -0
- data/docs/assets/img/elements/circle_abc.png +0 -0
- data/docs/assets/img/elements/circle_bold.png +0 -0
- data/docs/assets/img/elements/circle_hatched.png +0 -0
- data/docs/assets/img/elements/circle_one.png +0 -0
- data/docs/assets/img/elements/connector.png +0 -0
- data/docs/assets/img/elements/connector_bold.png +0 -0
- data/docs/assets/img/elements/square.png +0 -0
- data/docs/assets/img/elements/square_abc.png +0 -0
- data/docs/assets/img/elements/square_bold.png +0 -0
- data/docs/assets/img/elements/square_hatched.png +0 -0
- data/docs/assets/img/elements/square_one.png +0 -0
- data/docs/assets/img/favicon/apple-touch-icon.png +0 -0
- data/docs/assets/img/favicon/favicon-16x16.png +0 -0
- data/docs/assets/img/favicon/favicon-32x32.png +0 -0
- data/docs/assets/img/favicon/favicon.ico +0 -0
- data/docs/assets/svg/064.svg +2 -2
- data/docs/assets/svg/065.svg +2 -2
- data/docs/documentation.md +0 -0
- data/docs/documentation_ja.md +0 -0
- data/docs/examples.html +0 -0
- data/docs/index.html +0 -0
- data/fonts/NotoSansMono_SemiCondensed-Bold.ttf +0 -0
- data/fonts/NotoSansMono_SemiCondensed-Regular.ttf +0 -0
- data/img/sample.png +0 -0
- data/lib/rsyntaxtree/base_graph.rb +0 -0
- data/lib/rsyntaxtree/element.rb +0 -0
- data/lib/rsyntaxtree/elementlist.rb +0 -0
- data/lib/rsyntaxtree/markup_parser.rb +0 -0
- data/lib/rsyntaxtree/string_parser.rb +0 -0
- data/lib/rsyntaxtree/svg_graph.rb +9 -6
- data/lib/rsyntaxtree/utils.rb +0 -0
- data/lib/rsyntaxtree/version.rb +1 -1
- data/lib/rsyntaxtree.rb +0 -0
- 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: dd3b753fd33f6df5903c6df87d02bf7c7ac45de57e1ba18da51f03fe391ab45f
|
|
4
|
+
data.tar.gz: 3f53988bbb1ccd64b75792b822ccb04eca2d7f209500d881610cf2295ced3ce7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66e9a66413e457d4de55902743cc9ad61861c4b7fcdb4d9951d79966893e0665f5fea1e369ec69bbf058104627fc156250c841e2213f22b55b1c5b306991f311
|
|
7
|
+
data.tar.gz: 94ff87d7fab49605087c81bc98639c86fe768c1842048438c87381d22ebbf4d651cc0b5b6cadc16acf169cdee9021b694a8239777bc6088a4d3eb3d5f985d248
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.6.3] - 2026-07
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Packaged files no longer carry owner-only permissions. `gem build` preserves
|
|
7
|
+
on-disk modes, so gems built from a checkout with `0600`/`0700` files shipped
|
|
8
|
+
a library unreadable — and a `rsyntaxtree` CLI unexecutable — by anyone but
|
|
9
|
+
the owner after `sudo gem install`. File modes are now normalized before the
|
|
10
|
+
gem is built: `0755` for commands (`bin/`, `exe/`) and shebang scripts, `0644`
|
|
11
|
+
for everything else. This also drops stray executable bits that the working
|
|
12
|
+
tree had picked up on data files (images, fonts, Markdown, CSS, library
|
|
13
|
+
sources).
|
|
14
|
+
|
|
15
|
+
## [1.6.2] - 2026-06
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- Region shade no longer touches the image edge when its padded bounds reach
|
|
19
|
+
past the tree's natural extent (e.g. a deep enclosed/multi-line node): the
|
|
20
|
+
canvas now grows with a margin around the shaded plane.
|
|
21
|
+
|
|
3
22
|
## [1.6.1] - 2026-06
|
|
4
23
|
|
|
5
24
|
### Improved
|
data/Rakefile
CHANGED
|
@@ -13,6 +13,25 @@ Rake::TestTask.new do |task|
|
|
|
13
13
|
task.warning = false
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
# Gem packaging preserves on-disk file modes. Owner-only permissions (which a
|
|
17
|
+
# Dropbox-synced checkout tends to produce) ship files that are unreadable, and
|
|
18
|
+
# a CLI that is unexecutable, for anyone but the owner after `sudo gem install`.
|
|
19
|
+
# Normalize every tracked file before the gem is built: a file is executable
|
|
20
|
+
# only if it is a command (bin/, exe/) or a script with a shebang; everything
|
|
21
|
+
# else is data and gets 0644. Deciding by path/content rather than by the
|
|
22
|
+
# current mode also drops stray executable bits picked up from the filesystem.
|
|
23
|
+
task :normalize_permissions do
|
|
24
|
+
`git ls-files -z`.split("\x0").each do |f|
|
|
25
|
+
next unless File.file?(f)
|
|
26
|
+
|
|
27
|
+
executable = f.start_with?("bin/", "exe/") ||
|
|
28
|
+
File.open(f, "rb") { |io| io.read(2) } == "#!"
|
|
29
|
+
File.chmod(executable ? 0o755 : 0o644, f)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
Rake::Task["build"].enhance([:normalize_permissions])
|
|
34
|
+
|
|
16
35
|
desc "Generate SVG and PNG example images locally"
|
|
17
36
|
task :generate do
|
|
18
37
|
require_relative "dev/generate_examples"
|
data/docs/.gitignore
CHANGED
|
File without changes
|
data/docs/404.html
CHANGED
|
File without changes
|
data/docs/Gemfile
CHANGED
|
File without changes
|
data/docs/_config.yml
CHANGED
|
File without changes
|
data/docs/_examples/000.md
CHANGED
|
File without changes
|
data/docs/_examples/001.md
CHANGED
|
File without changes
|
data/docs/_examples/002.md
CHANGED
|
File without changes
|
data/docs/_examples/003.md
CHANGED
|
File without changes
|
data/docs/_examples/004.md
CHANGED
|
File without changes
|
data/docs/_examples/005.md
CHANGED
|
File without changes
|
data/docs/_examples/006.md
CHANGED
|
File without changes
|
data/docs/_examples/007.md
CHANGED
|
File without changes
|
data/docs/_examples/008.md
CHANGED
|
File without changes
|
data/docs/_examples/009.md
CHANGED
|
File without changes
|
data/docs/_examples/010.md
CHANGED
|
File without changes
|
data/docs/_examples/011.md
CHANGED
|
File without changes
|
data/docs/_examples/012.md
CHANGED
|
File without changes
|
data/docs/_examples/013.md
CHANGED
|
File without changes
|
data/docs/_examples/014.md
CHANGED
|
File without changes
|
data/docs/_examples/015.md
CHANGED
|
File without changes
|
data/docs/_examples/016.md
CHANGED
|
File without changes
|
data/docs/_examples/017.md
CHANGED
|
File without changes
|
data/docs/_examples/018.md
CHANGED
|
File without changes
|
data/docs/_examples/019.md
CHANGED
|
File without changes
|
data/docs/_examples/020.md
CHANGED
|
File without changes
|
data/docs/_examples/021.md
CHANGED
|
File without changes
|
data/docs/_examples/022.md
CHANGED
|
File without changes
|
data/docs/_examples/023.md
CHANGED
|
File without changes
|
data/docs/_examples/024.md
CHANGED
|
File without changes
|
data/docs/_examples/025.md
CHANGED
|
File without changes
|
data/docs/_examples/026.md
CHANGED
|
File without changes
|
data/docs/_examples/027.md
CHANGED
|
File without changes
|
data/docs/_examples/028.md
CHANGED
|
File without changes
|
data/docs/_examples/029.md
CHANGED
|
File without changes
|
data/docs/_examples/030.md
CHANGED
|
File without changes
|
data/docs/_examples/031.md
CHANGED
|
File without changes
|
data/docs/_examples/032.md
CHANGED
|
File without changes
|
data/docs/_examples/033.md
CHANGED
|
File without changes
|
data/docs/_examples/034.md
CHANGED
|
File without changes
|
data/docs/_examples/035.md
CHANGED
|
File without changes
|
data/docs/_examples/036.md
CHANGED
|
File without changes
|
data/docs/_examples/037.md
CHANGED
|
File without changes
|
data/docs/_examples/038.md
CHANGED
|
File without changes
|
data/docs/_examples/039.md
CHANGED
|
File without changes
|
data/docs/_examples/040.md
CHANGED
|
File without changes
|
data/docs/_examples/041.md
CHANGED
|
File without changes
|
data/docs/_examples/042.md
CHANGED
|
File without changes
|
data/docs/_examples/043.md
CHANGED
|
File without changes
|
data/docs/_examples/044.md
CHANGED
|
File without changes
|
data/docs/_examples/045.md
CHANGED
|
File without changes
|
data/docs/_examples/046.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/docs/_layouts/default.html
CHANGED
|
File without changes
|
data/docs/assets/css/style.scss
CHANGED
|
File without changes
|
data/docs/assets/img/064.png
CHANGED
|
Binary file
|
data/docs/assets/img/065.png
CHANGED
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
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' />
|
data/docs/documentation.md
CHANGED
|
File without changes
|
data/docs/documentation_ja.md
CHANGED
|
File without changes
|
data/docs/examples.html
CHANGED
|
File without changes
|
data/docs/index.html
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/img/sample.png
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/rsyntaxtree/element.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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/utils.rb
CHANGED
|
File without changes
|
data/lib/rsyntaxtree/version.rb
CHANGED
data/lib/rsyntaxtree.rb
CHANGED
|
File without changes
|
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'").
|