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.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/Rakefile +19 -0
  4. data/docs/.gitignore +0 -0
  5. data/docs/404.html +0 -0
  6. data/docs/Gemfile +0 -0
  7. data/docs/_config.yml +0 -0
  8. data/docs/_examples/000.md +0 -0
  9. data/docs/_examples/001.md +0 -0
  10. data/docs/_examples/002.md +0 -0
  11. data/docs/_examples/003.md +0 -0
  12. data/docs/_examples/004.md +0 -0
  13. data/docs/_examples/005.md +0 -0
  14. data/docs/_examples/006.md +0 -0
  15. data/docs/_examples/007.md +0 -0
  16. data/docs/_examples/008.md +0 -0
  17. data/docs/_examples/009.md +0 -0
  18. data/docs/_examples/010.md +0 -0
  19. data/docs/_examples/011.md +0 -0
  20. data/docs/_examples/012.md +0 -0
  21. data/docs/_examples/013.md +0 -0
  22. data/docs/_examples/014.md +0 -0
  23. data/docs/_examples/015.md +0 -0
  24. data/docs/_examples/016.md +0 -0
  25. data/docs/_examples/017.md +0 -0
  26. data/docs/_examples/018.md +0 -0
  27. data/docs/_examples/019.md +0 -0
  28. data/docs/_examples/020.md +0 -0
  29. data/docs/_examples/021.md +0 -0
  30. data/docs/_examples/022.md +0 -0
  31. data/docs/_examples/023.md +0 -0
  32. data/docs/_examples/024.md +0 -0
  33. data/docs/_examples/025.md +0 -0
  34. data/docs/_examples/026.md +0 -0
  35. data/docs/_examples/027.md +0 -0
  36. data/docs/_examples/028.md +0 -0
  37. data/docs/_examples/029.md +0 -0
  38. data/docs/_examples/030.md +0 -0
  39. data/docs/_examples/031.md +0 -0
  40. data/docs/_examples/032.md +0 -0
  41. data/docs/_examples/033.md +0 -0
  42. data/docs/_examples/034.md +0 -0
  43. data/docs/_examples/035.md +0 -0
  44. data/docs/_examples/036.md +0 -0
  45. data/docs/_examples/037.md +0 -0
  46. data/docs/_examples/038.md +0 -0
  47. data/docs/_examples/039.md +0 -0
  48. data/docs/_examples/040.md +0 -0
  49. data/docs/_examples/041.md +0 -0
  50. data/docs/_examples/042.md +0 -0
  51. data/docs/_examples/043.md +0 -0
  52. data/docs/_examples/044.md +0 -0
  53. data/docs/_examples/045.md +0 -0
  54. data/docs/_examples/046.md +0 -0
  55. data/docs/_includes/box_and_circle_table.html +0 -0
  56. data/docs/_includes/escape_char_table.html +0 -0
  57. data/docs/_includes/social_media_links.html +0 -0
  58. data/docs/_layouts/default.html +0 -0
  59. data/docs/assets/css/style.scss +0 -0
  60. data/docs/assets/img/064.png +0 -0
  61. data/docs/assets/img/065.png +0 -0
  62. data/docs/assets/img/elements/circle.png +0 -0
  63. data/docs/assets/img/elements/circle_abc.png +0 -0
  64. data/docs/assets/img/elements/circle_bold.png +0 -0
  65. data/docs/assets/img/elements/circle_hatched.png +0 -0
  66. data/docs/assets/img/elements/circle_one.png +0 -0
  67. data/docs/assets/img/elements/connector.png +0 -0
  68. data/docs/assets/img/elements/connector_bold.png +0 -0
  69. data/docs/assets/img/elements/square.png +0 -0
  70. data/docs/assets/img/elements/square_abc.png +0 -0
  71. data/docs/assets/img/elements/square_bold.png +0 -0
  72. data/docs/assets/img/elements/square_hatched.png +0 -0
  73. data/docs/assets/img/elements/square_one.png +0 -0
  74. data/docs/assets/img/favicon/apple-touch-icon.png +0 -0
  75. data/docs/assets/img/favicon/favicon-16x16.png +0 -0
  76. data/docs/assets/img/favicon/favicon-32x32.png +0 -0
  77. data/docs/assets/img/favicon/favicon.ico +0 -0
  78. data/docs/assets/svg/064.svg +2 -2
  79. data/docs/assets/svg/065.svg +2 -2
  80. data/docs/documentation.md +0 -0
  81. data/docs/documentation_ja.md +0 -0
  82. data/docs/examples.html +0 -0
  83. data/docs/index.html +0 -0
  84. data/fonts/NotoSansMono_SemiCondensed-Bold.ttf +0 -0
  85. data/fonts/NotoSansMono_SemiCondensed-Regular.ttf +0 -0
  86. data/img/sample.png +0 -0
  87. data/lib/rsyntaxtree/base_graph.rb +0 -0
  88. data/lib/rsyntaxtree/element.rb +0 -0
  89. data/lib/rsyntaxtree/elementlist.rb +0 -0
  90. data/lib/rsyntaxtree/markup_parser.rb +0 -0
  91. data/lib/rsyntaxtree/string_parser.rb +0 -0
  92. data/lib/rsyntaxtree/svg_graph.rb +9 -6
  93. data/lib/rsyntaxtree/utils.rb +0 -0
  94. data/lib/rsyntaxtree/version.rb +1 -1
  95. data/lib/rsyntaxtree.rb +0 -0
  96. data/test/node_styling_test.rb +21 -0
  97. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 867e51aad2f9b73b3aeecc016592ed9329a28269266d1caafb2ae42dac9555d0
4
- data.tar.gz: 70c17e7f8aeacd3ad398c81152ad924faa23def26768dca1babce71e6ef867a0
3
+ metadata.gz: dd3b753fd33f6df5903c6df87d02bf7c7ac45de57e1ba18da51f03fe391ab45f
4
+ data.tar.gz: 3f53988bbb1ccd64b75792b822ccb04eca2d7f209500d881610cf2295ced3ce7
5
5
  SHA512:
6
- metadata.gz: cf0c02890fcb35834cbb29b4bad13c764e2e3ec005ffe5207fe9c33f432f406a630abcd9bef0ce05d8e5349ee6b7dc5e1f6c78afdd9411c101015cada35bd58f
7
- data.tar.gz: 9906029477a7d286b98412f462d323060c6e12a79e7a0fb67e6207673f3db23d8a6f02cf771b6d6dc7ad56d6b5bb2c2903e9ac9cefd203de845129374b942e5a
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
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
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
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
File without changes
File without changes
File without changes
File without changes
Binary file
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
@@ -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="768.375" viewBox="-17.6, 0, 761.2000000000002, 779.625" version="1.1" xmlns="http://www.w3.org/2000/svg">
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="779.625" stroke="none" fill="white" />"
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>
@@ -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="515.2" height="597.375" viewBox="-17.6, 0, 532.8000000000001, 608.625" version="1.1" xmlns="http://www.w3.org/2000/svg">
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="-17.6" y="0" width="532.8000000000001" height="608.625" stroke="none" fill="white" />"
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' />
File without changes
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
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, whose top sits above y=0) are not
73
- # clipped. x2/y2 are the viewBox width/height, so right = x1 + x2.
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
- left = [x1, rb[:min_x]].min
77
- top = [y1, rb[:min_y]].min
78
- right = [x1 + x2, rb[:max_x]].max
79
- bottom = [y1 + y2, rb[:max_y]].max
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
File without changes
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RSyntaxTree
4
- VERSION = "1.6.1"
4
+ VERSION = "1.6.3"
5
5
  end
data/lib/rsyntaxtree.rb CHANGED
File without changes
@@ -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'").
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsyntaxtree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoichiro Hasebe