rsyntaxtree 1.1.4 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/.tags +581 -102
  4. data/docs/_examples/000.md +4 -4
  5. data/docs/_examples/010.md +0 -1
  6. data/docs/_examples/029.md +56 -0
  7. data/docs/_examples/030.md +33 -0
  8. data/docs/_examples/031.md +20 -0
  9. data/docs/_examples/032.md +26 -0
  10. data/docs/_examples/033.md +26 -0
  11. data/docs/_examples/034.md +26 -0
  12. data/docs/assets/img/000.png +0 -0
  13. data/docs/assets/img/001.png +0 -0
  14. data/docs/assets/img/002.png +0 -0
  15. data/docs/assets/img/003.png +0 -0
  16. data/docs/assets/img/004.png +0 -0
  17. data/docs/assets/img/005.png +0 -0
  18. data/docs/assets/img/006.png +0 -0
  19. data/docs/assets/img/007.png +0 -0
  20. data/docs/assets/img/008.png +0 -0
  21. data/docs/assets/img/009.png +0 -0
  22. data/docs/assets/img/010.png +0 -0
  23. data/docs/assets/img/011.png +0 -0
  24. data/docs/assets/img/012.png +0 -0
  25. data/docs/assets/img/013.png +0 -0
  26. data/docs/assets/img/014.png +0 -0
  27. data/docs/assets/img/015.png +0 -0
  28. data/docs/assets/img/017.png +0 -0
  29. data/docs/assets/img/018.png +0 -0
  30. data/docs/assets/img/020.png +0 -0
  31. data/docs/assets/img/021.png +0 -0
  32. data/docs/assets/img/023.png +0 -0
  33. data/docs/assets/img/024.png +0 -0
  34. data/docs/assets/img/025.png +0 -0
  35. data/docs/assets/img/026.png +0 -0
  36. data/docs/assets/img/027.png +0 -0
  37. data/docs/assets/img/028.png +0 -0
  38. data/docs/assets/img/029.png +0 -0
  39. data/docs/assets/img/030.png +0 -0
  40. data/docs/assets/img/031.png +0 -0
  41. data/docs/assets/img/032.png +0 -0
  42. data/docs/assets/img/033.png +0 -0
  43. data/docs/assets/img/034.png +0 -0
  44. data/docs/assets/svg/000.svg +35 -31
  45. data/docs/assets/svg/001.svg +3 -0
  46. data/docs/assets/svg/002.svg +3 -0
  47. data/docs/assets/svg/003.svg +3 -0
  48. data/docs/assets/svg/004.svg +3 -0
  49. data/docs/assets/svg/005.svg +3 -0
  50. data/docs/assets/svg/006.svg +3 -0
  51. data/docs/assets/svg/007.svg +3 -0
  52. data/docs/assets/svg/008.svg +3 -0
  53. data/docs/assets/svg/009.svg +3 -0
  54. data/docs/assets/svg/010.svg +13 -8
  55. data/docs/assets/svg/011.svg +3 -0
  56. data/docs/assets/svg/012.svg +3 -0
  57. data/docs/assets/svg/013.svg +3 -0
  58. data/docs/assets/svg/014.svg +3 -0
  59. data/docs/assets/svg/015.svg +3 -0
  60. data/docs/assets/svg/016.svg +3 -0
  61. data/docs/assets/svg/017.svg +3 -0
  62. data/docs/assets/svg/018.svg +3 -0
  63. data/docs/assets/svg/019.svg +3 -0
  64. data/docs/assets/svg/020.svg +3 -0
  65. data/docs/assets/svg/021.svg +3 -0
  66. data/docs/assets/svg/022.svg +3 -0
  67. data/docs/assets/svg/023.svg +3 -0
  68. data/docs/assets/svg/024.svg +3 -0
  69. data/docs/assets/svg/025.svg +3 -0
  70. data/docs/assets/svg/026.svg +3 -0
  71. data/docs/assets/svg/027.svg +3 -0
  72. data/docs/assets/svg/028.svg +3 -0
  73. data/docs/assets/svg/029.svg +126 -0
  74. data/docs/assets/svg/030.svg +76 -0
  75. data/docs/assets/svg/031.svg +36 -0
  76. data/docs/assets/svg/032.svg +73 -0
  77. data/docs/assets/svg/033.svg +74 -0
  78. data/docs/assets/svg/034.svg +91 -0
  79. data/docs/documentation.md +18 -5
  80. data/docs/documentation_ja.md +11 -3
  81. data/docs/examples.html +44 -41
  82. data/lib/rsyntaxtree/element.rb +1 -2
  83. data/lib/rsyntaxtree/markup_parser.rb +1 -1
  84. data/lib/rsyntaxtree/svg_graph.rb +81 -15
  85. data/lib/rsyntaxtree/version.rb +1 -1
  86. data/test/markup_parser_test.rb +2 -0
  87. metadata +21 -3
@@ -0,0 +1,74 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg width="623.2" height="1676.8" viewBox="-20, -20, 643.2, 1696.8" version="1.1" xmlns="http://www.w3.org/2000/svg">
4
+ <defs>
5
+ <marker id="arrow" markerUnits="strokeWidth" markerWidth="11.520000000000001" markerHeight="11.520000000000001" viewBox="0 0 11.520000000000001 11.520000000000001" refX="5.760000000000001" refY="0">
6
+ <polyline fill="none" stroke="black" stroke-width="1" points="0,11.520000000000001,5.760000000000001,0,11.520000000000001,11.520000000000001" />
7
+ </marker>
8
+ <marker id="arrowSolid" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="7.2" markerHeight="7.2" orient="auto-start-reverse">
9
+ <path d="M 0 0 L 10 5 L 0 10 z" stroke="black"/>
10
+ </marker>
11
+ <pattern id="hatchBlack" x="10" y="10" width="10" height="10" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
12
+ <line x1="0" y="0" x2="0" y2="10" stroke="black" stroke-width="4"></line>
13
+ </pattern>
14
+ <pattern id="hatchForNode" x="10" y="10" width="10" height="10" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
15
+ <line x1="0" y="0" x2="0" y2="10" stroke="black" stroke-width="4"></line>
16
+ </pattern>
17
+ <pattern id="hatchForLeaf" x="10" y="10" width="10" height="10" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
18
+ <line x1="0" y="0" x2="0" y2="10" stroke="black" stroke-width="4"></line>
19
+ </pattern>
20
+ </defs>
21
+ <rect x="-20" y="-20" width="643.2" height="1696.8" stroke="none" fill="white" />"
22
+ <text white-space='pre' alignment-baseline='text-top' style='fill: black; font-size: 64px;' x='252.0' y='132.0'><tspan x='252.0' y='132.0' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">ABC</tspan>
23
+ <tspan x='252.0' y='308.0' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">abc</tspan>
24
+ </text>
25
+ <text white-space='pre' alignment-baseline='text-top' style='fill: black; font-size: 64px;' x='28.80000000000001' y='730.4'><tspan x='28.80000000000001' y='730.4' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">DEF</tspan>
26
+ </text>
27
+ <text white-space='pre' alignment-baseline='text-top' style='fill: black; font-size: 64px;' x='252.0' y='730.4'><tspan x='252.0' y='730.4' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">GHI</tspan>
28
+ <tspan x='252.0' y='906.4' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">ghi</tspan>
29
+ </text>
30
+ <text white-space='pre' alignment-baseline='text-top' style='fill: black; font-size: 64px;' x='475.20000000000005' y='730.4'><tspan x='475.20000000000005' y='730.4' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">JKL</tspan>
31
+ </text>
32
+ <text white-space='pre' alignment-baseline='text-top' style='fill: black; font-size: 64px;' x='475.20000000000005' y='1029.6'><tspan x='475.20000000000005' y='1029.6' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">MNO</tspan>
33
+ </text>
34
+ <text white-space='pre' alignment-baseline='text-top' style='fill: black; font-size: 64px;' x='475.20000000000005' y='1372.8'><tspan x='475.20000000000005' y='1372.8' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">XYZ</tspan>
35
+ </text>
36
+ <polyline style='stroke:black; stroke-width:2; fill:none;'
37
+ points='82.80000000000001 620.4 82.80000000000001 491.7 306.0 491.7 306.0 363.0' />
38
+ <polyline style='stroke:black; stroke-width:2; fill:none;'
39
+ points='306.0 620.4 306.0 491.7 306.0 491.7 306.0 363.0' />
40
+ <polyline style='stroke:black; stroke-width:2; fill:none;'
41
+ points='529.2 620.4 529.2 491.7 306.0 491.7 306.0 363.0' />
42
+ <polyline style='stroke:black; stroke-width:2; fill:none;'
43
+ points='529.2 919.6 529.2 852.5 529.2 852.5 529.2 785.4' />
44
+ <polyline style='stroke:black; stroke-width:2; fill:none;'
45
+ points='529.2 1262.8 529.2 1173.6999999999998 529.2 1173.6999999999998 529.2 1084.6' />
46
+ <line style="stroke:black; stroke-width:2; " x1="252.0" y1="198.0" x2="360.0" y2="198.0"></line>
47
+ <line x1='237.6' y1='33.0' x2='374.4' y2='33.0' style='fill: none; stroke: black; stroke-width:2' />
48
+ <line x1='237.6' y1='33.0' x2='237.6' y2='352.0' style='fill: none; stroke: black; stroke-width:2' />
49
+ <line x1='374.4' y1='33.0' x2='374.4' y2='352.0' style='fill: none; stroke: black; stroke-width:2' />
50
+ <line x1='237.6' y1='352.0' x2='374.4' y2='352.0' style='fill: none; stroke: black; stroke-width:2' />
51
+ <line style="stroke:black; stroke-width:2; " x1="252.0" y1="796.4" x2="360.0" y2="796.4"></line>
52
+ <line x1='237.6' y1='631.4' x2='374.4' y2='631.4' style='fill: none; stroke: black; stroke-width:2' />
53
+ <line x1='237.6' y1='631.4' x2='237.6' y2='950.4' style='fill: none; stroke: black; stroke-width:2' />
54
+ <line x1='374.4' y1='631.4' x2='374.4' y2='950.4' style='fill: none; stroke: black; stroke-width:2' />
55
+ <line x1='237.6' y1='950.4' x2='374.4' y2='950.4' style='fill: none; stroke: black; stroke-width:2' />
56
+ <line x1='460.80000000000007' y1='930.6' x2='597.6000000000001' y2='930.6' style='fill: none; stroke: black; stroke-width:2' />
57
+ <line x1='460.80000000000007' y1='930.6' x2='460.80000000000007' y2='1073.6' style='fill: none; stroke: black; stroke-width:2' />
58
+ <line x1='597.6000000000001' y1='930.6' x2='597.6000000000001' y2='1073.6' style='fill: none; stroke: black; stroke-width:2' />
59
+ <line x1='460.80000000000007' y1='1073.6' x2='597.6000000000001' y2='1073.6' style='fill: none; stroke: black; stroke-width:2' />
60
+ <line x1='460.80000000000007' y1='1273.8' x2='597.6000000000001' y2='1273.8' style='fill: none; stroke: black; stroke-width:2' />
61
+ <line x1='460.80000000000007' y1='1273.8' x2='460.80000000000007' y2='1416.8' style='fill: none; stroke: black; stroke-width:2' />
62
+ <line x1='597.6000000000001' y1='1273.8' x2='597.6000000000001' y2='1416.8' style='fill: none; stroke: black; stroke-width:2' />
63
+ <line x1='460.80000000000007' y1='1416.8' x2='597.6000000000001' y2='1416.8' style='fill: none; stroke: black; stroke-width:2' />
64
+ <line x1='306.0' y1='961.4' x2='306.0' y2='1504.8' style='fill: none; stroke: black; stroke-width:2' />
65
+ <line x1='306.0' y1='961.4' x2='306.0' y2='1504.8' style='fill: none; stroke: black; stroke-width:2' />
66
+ <line x1='306.0' y1='1504.8' x2='82.80000000000001' y2='1504.8' style='fill: none; stroke: black; stroke-width:2' />
67
+ <line x1='82.80000000000001' y1='1504.8' x2='82.80000000000001' y2='785.4' style='fill: none; stroke: black; stroke-width:2' marker-end='url(#arrow)' />
68
+ <line x1='270.0' y1='961.4' x2='270.0' y2='1636.8' style='fill: none; stroke: black; stroke-width:2' stroke-dasharray='8 8' />
69
+ <line x1='270.0' y1='1636.8' x2='529.2' y2='1636.8' style='fill: none; stroke: black; stroke-width:2' stroke-dasharray='8 8' />
70
+ <line x1='529.2' y1='1636.8' x2='529.2' y2='1427.8' style='fill: none; stroke: black; stroke-width:2' stroke-dasharray='8 8' />
71
+ <line x1='306.0' y1='363.0' x2='529.2' y2='919.6' style='fill: none; stroke: black; stroke-width:2' />
72
+ <line x1='306.0' y1='363.0' x2='82.80000000000001' y2='620.4' style='fill: none; stroke: black; stroke-width:2' />
73
+ <line x1='165.60000000000002' y1='702.9' x2='223.2' y2='702.9' style='fill: none; stroke: black; stroke-width:2' />
74
+ <line x1='306.0' y1='961.4' x2='529.2' y2='1262.8' style='fill: none; stroke: black; stroke-width:2' /></svg>
@@ -0,0 +1,91 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg width="2715.2" height="1236.8" viewBox="-20, -20, 2735.2, 1256.8" version="1.1" xmlns="http://www.w3.org/2000/svg">
4
+ <defs>
5
+ <marker id="arrow" markerUnits="strokeWidth" markerWidth="13.440000000000001" markerHeight="13.440000000000001" viewBox="0 0 13.440000000000001 13.440000000000001" refX="6.720000000000001" refY="0">
6
+ <polyline fill="none" stroke="black" stroke-width="1" points="0,13.440000000000001,6.720000000000001,0,13.440000000000001,13.440000000000001" />
7
+ </marker>
8
+ <marker id="arrowSolid" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="8.4" markerHeight="8.4" orient="auto-start-reverse">
9
+ <path d="M 0 0 L 10 5 L 0 10 z" stroke="black"/>
10
+ </marker>
11
+ <pattern id="hatchBlack" x="10" y="10" width="10" height="10" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
12
+ <line x1="0" y="0" x2="0" y2="10" stroke="black" stroke-width="4"></line>
13
+ </pattern>
14
+ <pattern id="hatchForNode" x="10" y="10" width="10" height="10" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
15
+ <line x1="0" y="0" x2="0" y2="10" stroke="black" stroke-width="4"></line>
16
+ </pattern>
17
+ <pattern id="hatchForLeaf" x="10" y="10" width="10" height="10" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
18
+ <line x1="0" y="0" x2="0" y2="10" stroke="black" stroke-width="4"></line>
19
+ </pattern>
20
+ </defs>
21
+ <rect x="-20" y="-20" width="2735.2" height="1256.8" stroke="none" fill="white" />"
22
+ <text white-space='pre' alignment-baseline='text-top' style='fill: black; font-size: 64px;' x='1080.2875' y='132.0'><tspan x='1080.2875' y='132.0' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">Clause</tspan>
23
+ </text>
24
+ <text white-space='pre' alignment-baseline='text-top' style='fill: black; font-size: 64px;' x='173.79999999999995' y='475.20000000000005'><tspan x='173.79999999999995' y='475.20000000000005' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">Sbj<tspan style='fill:none;'>■</tspan>IntrVerb</tspan>
25
+ </text>
26
+ <text white-space='pre' alignment-baseline='text-top' style='fill: black; font-size: 64px;' x='33.59999999999991' y='818.4'><tspan x='33.59999999999991' y='818.4' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">Sbj<tspan style='fill:none;'>■</tspan></tspan>
27
+ <tspan x='164.5999999999999' y='818.4' style="font-style: italic; " text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">sleep</tspan>
28
+ </text>
29
+ <text white-space='pre' alignment-baseline='text-top' style='fill: black; font-size: 64px;' x='448.9999999999998' y='818.4'><tspan x='448.9999999999998' y='818.4' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">Sbj<tspan style='fill:none;'>■</tspan></tspan>
30
+ <tspan x='579.9999999999998' y='818.4' style="font-style: italic; " text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">run</tspan>
31
+ </text>
32
+ <text white-space='pre' alignment-baseline='text-top' style='fill: black; font-size: 64px;' x='1744.2749999999996' y='475.20000000000005'><tspan x='1744.2749999999996' y='475.20000000000005' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">Sbj<tspan style='fill:none;'>■</tspan>TrVerb<tspan style='fill:none;'>■</tspan>Obj</tspan>
33
+ </text>
34
+ <text white-space='pre' alignment-baseline='text-top' style='fill: black; font-size: 64px;' x='1297.3499999999997' y='818.4'><tspan x='1297.3499999999997' y='818.4' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">Sbj<tspan style='fill:none;'>■</tspan></tspan>
35
+ <tspan x='1428.3499999999997' y='818.4' style="font-style: italic; " text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">kick</tspan>
36
+ <tspan x='1553.3499999999997' y='818.4' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif"><tspan style='fill:none;'>■</tspan>Obj</tspan>
37
+ </text>
38
+ <text white-space='pre' alignment-baseline='text-top' style='fill: black; font-size: 64px;' x='820.3999999999999' y='1161.6'><tspan x='820.3999999999999' y='1161.6' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">Sbj<tspan style='fill:none;'>■</tspan></tspan>
39
+ <tspan x='951.3999999999999' y='1161.6' style="font-style: italic; " text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">kick<tspan style='fill:none;'>■</tspan>the<tspan style='fill:none;'>■</tspan>bucket</tspan>
40
+ </text>
41
+ <text white-space='pre' alignment-baseline='text-top' style='fill: black; font-size: 64px;' x='1574.7999999999997' y='1161.6'><tspan x='1574.7999999999997' y='1161.6' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">Sbj<tspan style='fill:none;'>■</tspan></tspan>
42
+ <tspan x='1705.7999999999997' y='1161.6' style="font-style: italic; " text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">kick<tspan style='fill:none;'>■</tspan>the<tspan style='fill:none;'>■</tspan>habit</tspan>
43
+ </text>
44
+ <text white-space='pre' alignment-baseline='text-top' style='fill: black; font-size: 64px;' x='2286.2' y='818.4'><tspan x='2286.2' y='818.4' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">Sbj<tspan style='fill:none;'>■</tspan></tspan>
45
+ <tspan x='2417.2' y='818.4' style="font-style: italic; " text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">kiss</tspan>
46
+ <tspan x='2532.2' y='818.4' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif"><tspan style='fill:none;'>■</tspan>Obj</tspan>
47
+ </text>
48
+ <line style='stroke:black; stroke-width:2;' x1='370.79999999999995' y1='365.2' x2='1179.7875' y2='187.0' />
49
+ <line style='stroke:black; stroke-width:2;' x1='1988.7749999999999' y1='365.2' x2='1179.7875' y2='187.0' />
50
+ <line style='stroke:black; stroke-width:2;' x1='174.0999999999999' y1='708.4' x2='370.79999999999995' y2='530.2' />
51
+ <line style='stroke:black; stroke-width:2;' x1='567.4999999999998' y1='708.4' x2='370.79999999999995' y2='530.2' />
52
+ <line style='stroke:black; stroke-width:2;' x1='1496.8499999999997' y1='708.4' x2='1988.7749999999999' y2='530.2' />
53
+ <line style='stroke:black; stroke-width:2;' x1='2480.7' y1='708.4' x2='1988.7749999999999' y2='530.2' />
54
+ <line style='stroke:black; stroke-width:2;' x1='1130.3999999999999' y1='1051.6' x2='1496.8499999999997' y2='873.4' />
55
+ <line style='stroke:black; stroke-width:2;' x1='1863.2999999999997' y1='1051.6' x2='1496.8499999999997' y2='873.4' />
56
+ <line x1='1063.4875' y1='33.0' x2='1296.0874999999999' y2='33.0' style='fill: none; stroke: black; stroke-width:2' />
57
+ <line x1='1063.4875' y1='33.0' x2='1063.4875' y2='176.0' style='fill: none; stroke: black; stroke-width:2' />
58
+ <line x1='1296.0874999999999' y1='33.0' x2='1296.0874999999999' y2='176.0' style='fill: none; stroke: black; stroke-width:2' />
59
+ <line x1='1063.4875' y1='176.0' x2='1296.0874999999999' y2='176.0' style='fill: none; stroke: black; stroke-width:2' />
60
+ <line x1='156.99999999999994' y1='376.2' x2='584.5999999999999' y2='376.2' style='fill: none; stroke: black; stroke-width:2' />
61
+ <line x1='156.99999999999994' y1='376.2' x2='156.99999999999994' y2='519.2' style='fill: none; stroke: black; stroke-width:2' />
62
+ <line x1='584.5999999999999' y1='376.2' x2='584.5999999999999' y2='519.2' style='fill: none; stroke: black; stroke-width:2' />
63
+ <line x1='156.99999999999994' y1='519.2' x2='584.5999999999999' y2='519.2' style='fill: none; stroke: black; stroke-width:2' />
64
+ <line x1='16.79999999999991' y1='719.4' x2='331.3999999999999' y2='719.4' style='fill: none; stroke: black; stroke-width:2' />
65
+ <line x1='16.79999999999991' y1='719.4' x2='16.79999999999991' y2='862.4' style='fill: none; stroke: black; stroke-width:2' />
66
+ <line x1='331.3999999999999' y1='719.4' x2='331.3999999999999' y2='862.4' style='fill: none; stroke: black; stroke-width:2' />
67
+ <line x1='16.79999999999991' y1='862.4' x2='331.3999999999999' y2='862.4' style='fill: none; stroke: black; stroke-width:2' />
68
+ <line x1='432.19999999999976' y1='719.4' x2='702.7999999999997' y2='719.4' style='fill: none; stroke: black; stroke-width:2' />
69
+ <line x1='432.19999999999976' y1='719.4' x2='432.19999999999976' y2='862.4' style='fill: none; stroke: black; stroke-width:2' />
70
+ <line x1='702.7999999999997' y1='719.4' x2='702.7999999999997' y2='862.4' style='fill: none; stroke: black; stroke-width:2' />
71
+ <line x1='432.19999999999976' y1='862.4' x2='702.7999999999997' y2='862.4' style='fill: none; stroke: black; stroke-width:2' />
72
+ <line x1='1727.4749999999997' y1='376.2' x2='2250.075' y2='376.2' style='fill: none; stroke: black; stroke-width:2' />
73
+ <line x1='1727.4749999999997' y1='376.2' x2='1727.4749999999997' y2='519.2' style='fill: none; stroke: black; stroke-width:2' />
74
+ <line x1='2250.075' y1='376.2' x2='2250.075' y2='519.2' style='fill: none; stroke: black; stroke-width:2' />
75
+ <line x1='1727.4749999999997' y1='519.2' x2='2250.075' y2='519.2' style='fill: none; stroke: black; stroke-width:2' />
76
+ <line x1='1280.5499999999997' y1='719.4' x2='1713.1499999999996' y2='719.4' style='fill: none; stroke: black; stroke-width:2' />
77
+ <line x1='1280.5499999999997' y1='719.4' x2='1280.5499999999997' y2='862.4' style='fill: none; stroke: black; stroke-width:2' />
78
+ <line x1='1713.1499999999996' y1='719.4' x2='1713.1499999999996' y2='862.4' style='fill: none; stroke: black; stroke-width:2' />
79
+ <line x1='1280.5499999999997' y1='862.4' x2='1713.1499999999996' y2='862.4' style='fill: none; stroke: black; stroke-width:2' />
80
+ <line x1='803.5999999999999' y1='1062.6' x2='1457.1999999999998' y2='1062.6' style='fill: none; stroke: black; stroke-width:2' />
81
+ <line x1='803.5999999999999' y1='1062.6' x2='803.5999999999999' y2='1205.6' style='fill: none; stroke: black; stroke-width:2' />
82
+ <line x1='1457.1999999999998' y1='1062.6' x2='1457.1999999999998' y2='1205.6' style='fill: none; stroke: black; stroke-width:2' />
83
+ <line x1='803.5999999999999' y1='1205.6' x2='1457.1999999999998' y2='1205.6' style='fill: none; stroke: black; stroke-width:2' />
84
+ <line x1='1557.9999999999998' y1='1062.6' x2='2168.6' y2='1062.6' style='fill: none; stroke: black; stroke-width:2' />
85
+ <line x1='1557.9999999999998' y1='1062.6' x2='1557.9999999999998' y2='1205.6' style='fill: none; stroke: black; stroke-width:2' />
86
+ <line x1='2168.6' y1='1062.6' x2='2168.6' y2='1205.6' style='fill: none; stroke: black; stroke-width:2' />
87
+ <line x1='1557.9999999999998' y1='1205.6' x2='2168.6' y2='1205.6' style='fill: none; stroke: black; stroke-width:2' />
88
+ <line x1='2269.3999999999996' y1='719.4' x2='2691.9999999999995' y2='719.4' style='fill: none; stroke: black; stroke-width:2' />
89
+ <line x1='2269.3999999999996' y1='719.4' x2='2269.3999999999996' y2='862.4' style='fill: none; stroke: black; stroke-width:2' />
90
+ <line x1='2691.9999999999995' y1='719.4' x2='2691.9999999999995' y2='862.4' style='fill: none; stroke: black; stroke-width:2' />
91
+ <line x1='2269.3999999999996' y1='862.4' x2='2691.9999999999995' y2='862.4' style='fill: none; stroke: black; stroke-width:2' /></svg>
@@ -129,12 +129,25 @@ The backslash character `\` must be used to print certain characters used in the
129
129
 
130
130
  You can draw any number of paths of three different types:
131
131
 
132
- - Non-directional (rendered `- - -`)
133
- - Directional (rendered `----->`)
134
- - Bidirectional (rendered `<----->`)
132
+ - Non-directional (rendered as dashed line `- - -`)
133
+ - Directional (rendered as solid line `----->`)
134
+ - Bidirectional (rendered as solid line `<----->`)
135
135
 
136
- Each path is distinguished by a path ID number. The path ID is specified by putting a plus sign and a number (e.g. `+7`) at the end of the node text. If a greater-than sign is placed between the plus sign and the number (e.g. `+>7`), an arrowhead will appear at the end of the path.
137
- A node can have any number of path IDs. The same path ID must appear in the text of the *two* nodes between which the path is rendered. The same ID number cannot appear in more than two places.
136
+ Each path is distinguished by a unique ID number. The ID is specified by putting a plus sign and a number (e.g. `+7`) at the end of the node text. If a greater-than sign is placed between the plus sign and the number (e.g. `+>7`), an arrowhead will appear at the end of the path.
137
+
138
+ A node can have any number of IDs. The same ID must appear in the text of the *two* nodes between which the path is rendered. The same ID number cannot appear in more than two places.
139
+
140
+ ### Draw Extra Connectors between Nodes (experimental)
141
+
142
+ You can also add extra connector between nodes in the same fasion as you draw paths between nodes. Extra connectors are drawn as straigt lines (not as `polyline`s).
143
+
144
+ - Non-directional (rendered as solid line `-----`)
145
+ - Directional (rendered as solid line `----->`)
146
+ - Bidirectional (rendered as solid line `<----->`)
147
+
148
+ Each additional connectors is distinguished by an ID number. The ID is specified by putting a a number after a sequence of a plus and a minus symbols (e.g. `+-8`) at the end of the node text. If a greater-than sign is placed between the minus sign and the number (e.g. `+->8`), an arrowhead will appear at the end of the connector.
149
+
150
+ A node can have any number of IDs. The same ID must appear in the text of the *two* nodes between which the additional connector is rendered. The same ID number cannot appear in more than two places.
138
151
 
139
152
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.0/dist/jquery.min.js"></script>
140
153
  <script src="https://cdn.jsdelivr.net/npm/lightbox2@2.11.3/src/js/lightbox.js"></script>
@@ -143,10 +143,18 @@ SVG形式を用いる場合,期待通りの表示を得るためには,ご
143
143
  - 方向(矢印)のあるパス(`----->`)
144
144
  - 両方向の矢印のあるパス(`<----->`)
145
145
 
146
- 樹形図の中でパスを表示したいとき,パスの両端をIDで指定します.パスIDをプラス(`+`)記号と共にノードのテキストの最後で指定してください(例:`+7`).
147
- プラス記号とパスIDの間に `>` 記号を入れると(例:`+>7`),パスの終端に矢印が付きます.
146
+ 樹形図の中でパスを表示したいとき,パスの両端を数字のIDで指定します。数字をプラス(`+`)記号と共にノードのテキストの最後で指定してください(例:`+7`).
147
+ プラス記号とID番号の間に `>` 記号を入れると(例:`+>7`),パスの終端に矢印が付きます.
148
148
 
149
- パスIDにはどのような数字を用いても構いませんが,必ず **2箇所** で同じIDを指定することが必要です.同じIDを2箇所以上で指定することはできません.
149
+ IDにはどのような数字を用いても構いませんが,必ず **2箇所** で同じIDを指定することが必要です.同じIDを3箇所以上で指定することはできません.
150
+
151
+ ### ノードからノードへの追加的なコネクターの描画(試験的機能)
152
+
153
+ パスの指定と類似した方式でノードからノードへのコネクターを追加することができます。追加的なコネクターは直線で描画されます(`polyline`にはなりません)。
154
+
155
+ 追加のコネクターは数字のIDで指定します,プラスとマイナスを連続させた(`+-`)後にIDを指定してください(例:`+-8`).マイナス記号とID番号の間に `>` 記号を入れると(例:`+->8`),コネクターの終端に矢印が付きます.
156
+
157
+ IDにはどのような数字を用いても構いませんが,必ず **2箇所** で同じIDを指定することが必要です.同じIDを3箇所以上で指定することはできません.
150
158
 
151
159
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.0/dist/jquery.min.js"></script>
152
160
  <script src="https://cdn.jsdelivr.net/npm/lightbox2@2.11.3/src/js/lightbox.js"></script>
data/docs/examples.html CHANGED
@@ -8,55 +8,58 @@ layout: default
8
8
  {% assign categories = all_examples | map: 'category' | join: ',' | split: ',' | group_by: category %}
9
9
  <ul>
10
10
  {%- for category in categories -%}
11
- <li><a href="#category-{{ category.name | slugify }}">{{ category.name }}</a> [{{category.size}}]</li>
11
+ {%- if category.name != "Test" -%}
12
+ <li><a href="#category-{{ category.name | slugify }}">{{ category.name }}</a> [{{category.size}}]</li>
13
+ {%- endif -%}
12
14
  {%- endfor -%}
13
15
  </ul>
14
16
 
15
17
  {%- for category in categories -%}
16
- <hr />
17
- <h2 id="category-{{category.name | slugify }}"><b>{{ category.name }}</b></h2>
18
- {%- for example in all_examples -%}
19
- {% if example.category contains category.name %}
20
- <h3>{{ example.caption }}</h3>
21
- <div style='text-align:left;'>
22
- <button onclick="copyToClipBoard('text-{{ example.name }}')" style='margin: 20px 0; font-size: 0.85em;'>
23
- Copy to Clipboard
24
- </button>
25
- </div>
26
- <div class='grid'>
27
- <div style='margin-top: 0; margin-bottom: auto;'>
28
- <div id="text-{{example.name}}" style='max-height: 600px; overflow-y: auto; margin-bottom: 20px;'>
29
- {{ example.content | markdownify }}
30
- </div>
31
- <table style='line-height: 110%; font-size: 0.85em; margin-bottom: 20px;'>
32
- <thead></thead>
33
- <tbody>
34
- <tr><td>Category</td><td>{{ example.category}}</td></tr>
35
- <tr><td>Connector</td><td>{{ example.connector }}</td></tr>
36
- <tr><td>Polyline</td><td>{{ example.polyline }}</td></tr>
37
- <tr><td>Colorization</td><td>{{ example.colorization }}</td></tr>
38
- <tr><td>Radical Symmetirization</td><td>{{ example.symmetrization }}</td></tr>
39
- <tr><td>Font</td><td>{{ example.font }}</td></tr>
40
- {% if example.reference %}
41
- <tr><td>Reference</td><td>{{ example.reference }}</td></tr>
42
- {% endif %}
43
- </tbody>
44
- </table>
45
- </div>
46
- <div style='margin-top: 0; margin-bottom: auto;'>
47
- <a href='assets/img/{{ example.name }}.png' data-lightbox='{{ example.name }}'>
48
- <img src='assets/img/{{ example.name}}.png'/>
49
- </a>
50
- </div>
51
- </div>
52
- <div><a href="#examples">🔝</a></div>
53
- {% endif %}
54
- {%- endfor -%}
18
+ {%- if category.name != "Test" -%}
19
+ <hr />
20
+ <h2 id="category-{{category.name | slugify }}"><b>{{ category.name }}</b></h2>
21
+ {%- for example in all_examples -%}
22
+ {%- if example.category contains category.name -%}
23
+ <h3>{{ example.caption }}</h3>
24
+ <div style='text-align:left;'>
25
+ <button onclick="copyToClipBoard('text-{{ example.name }}')" style='margin: 20px 0; font-size: 0.85em;'>
26
+ Copy to Clipboard
27
+ </button>
28
+ </div>
29
+ <div class='grid'>
30
+ <div style='margin-top: 0; margin-bottom: auto;'>
31
+ <div id="text-{{example.name}}" style='max-height: 600px; overflow-y: auto; margin-bottom: 20px;'>
32
+ {{ example.content | markdownify }}
33
+ </div>
34
+ <table style='line-height: 110%; font-size: 0.85em; margin-bottom: 20px;'>
35
+ <thead></thead>
36
+ <tbody>
37
+ <tr><td>Category</td><td>{{ example.category}}</td></tr>
38
+ <tr><td>Connector</td><td>{{ example.connector }}</td></tr>
39
+ <tr><td>Polyline</td><td>{{ example.polyline }}</td></tr>
40
+ <tr><td>Colorization</td><td>{{ example.colorization }}</td></tr>
41
+ <tr><td>Radical Symmetirization</td><td>{{ example.symmetrization }}</td></tr>
42
+ <tr><td>Font</td><td>{{ example.font }}</td></tr>
43
+ {% if example.reference %}
44
+ <tr><td>Reference</td><td>{{ example.reference }}</td></tr>
45
+ {% endif %}
46
+ </tbody>
47
+ </table>
48
+ </div>
49
+ <div style='margin-top: 0; margin-bottom: auto;'>
50
+ <a href='assets/img/{{ example.name }}.png' data-lightbox='{{ example.name }}'>
51
+ <img src='assets/img/{{ example.name}}.png'/>
52
+ </a>
53
+ </div>
54
+ </div>
55
+ <div><a href="#examples">🔝</a></div>
56
+ {%- endif -%}
57
+ {%- endfor -%}
58
+ {%- endif -%}
55
59
  {%- endfor -%}
56
60
 
57
61
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.0/dist/jquery.min.js"></script>
58
62
  <script src="https://cdn.jsdelivr.net/npm/lightbox2@2.11.3/src/js/lightbox.js"></script>
59
-
60
63
  <script>
61
64
  function copyToClipBoard(id){
62
65
  var copyText = document.getElementById(id).innerText;
@@ -20,7 +20,6 @@ module RSyntaxTree
20
20
  @id = id # Unique element id
21
21
  @parent = parent # Parent element id
22
22
  @children = [] # Child element ids
23
- @type = type # Element type
24
23
  @level = level # Element level in the tree (0=top etc...)
25
24
  @width = 0 # Width of the part of the tree including itself and it governs
26
25
  @content_width = 0 # Width of the content
@@ -28,7 +27,7 @@ module RSyntaxTree
28
27
  @vertical_indent = 0 # Drawing offset
29
28
  content = content.strip
30
29
 
31
- @path = if /.+?\^?((?:\+>?\d+)+)\^?\z/m =~ content
30
+ @path = if /.+?\^?((?:\+-?>?\d+)+)\^?\z/m =~ content
32
31
  $1.sub(/\A\+/, "").split("+")
33
32
  else
34
33
  []
@@ -13,7 +13,7 @@ class MarkupParser < Parslet::Parser
13
13
  rule(:brackets) { str('#') }
14
14
  rule(:triangle) { str('^') }
15
15
 
16
- rule(:path) { (str('+') >> str('>').maybe >> match('\d').repeat(1)).as(:path) }
16
+ rule(:path) { (str('+') >> str('-').maybe >> str('>').maybe >> match('\d').repeat(1)).as(:path) }
17
17
  rule(:escaped) { str('\\') >> match('[#<>{}\\^+*_=~\|\n\-]').as(:chr) }
18
18
  rule(:non_escaped) { ((match('[#<>{}\\^+*_=~\|\-]') | str('\\n')).absent? >> any).as(:chr) }
19
19
  rule(:text) { (escaped | non_escaped).repeat(1).as(:text) }
@@ -49,8 +49,9 @@ module RSyntaxTree
49
49
  y2 = @height + @margin
50
50
  extra_lines = @extra_lines.join("\n")
51
51
 
52
+ as = @global[:h_gap_between_nodes] / 4 * 0.8
52
53
  as2 = @global[:h_gap_between_nodes] / 2 * 0.8
53
- as = as2 / 2
54
+ as3 = @global[:h_gap_between_nodes] / 2 * 0.5
54
55
 
55
56
  header = <<~HDR
56
57
  <?xml version="1.0" standalone="no"?>
@@ -60,6 +61,9 @@ module RSyntaxTree
60
61
  <marker id="arrow" markerUnits="strokeWidth" markerWidth="#{as2}" markerHeight="#{as2}" viewBox="0 0 #{as2} #{as2}" refX="#{as}" refY="0">
61
62
  <polyline fill="none" stroke="#{@col_path}" stroke-width="1" points="0,#{as2},#{as},0,#{as2},#{as2}" />
62
63
  </marker>
64
+ <marker id="arrowSolid" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="#{as3}" markerHeight="#{as3}" orient="auto-start-reverse">
65
+ <path d="M 0 0 L 10 5 L 0 10 z" stroke="#{@col_line}"/>
66
+ </marker>
63
67
  <pattern id="hatchBlack" x="10" y="10" width="10" height="10" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
64
68
  <line x1="0" y="0" x2="0" y2="10" stroke="black" stroke-width="4"></line>
65
69
  </pattern>
@@ -85,9 +89,13 @@ module RSyntaxTree
85
89
  end
86
90
  end
87
91
 
92
+ def draw_direct_line(s_x, s_y, t_x, t_y, s_arrow = false, t_arrow = false)
93
+ @extra_lines << generate_connector(s_x, s_y, t_x, t_y, @col_line, false, s_arrow, t_arrow)
94
+ end
95
+
88
96
  def draw_a_path(s_x, s_y, t_x, t_y, target_arrow = :none)
89
97
  x_spacing = @global[:h_gap_between_nodes] * 1.25
90
- y_spacing = @global[:height_connector] * 0.65
98
+ y_spacing = @global[:height_connector] * 0.75
91
99
 
92
100
  ymax = [s_y, t_y].max
93
101
  new_y = if ymax < @height
@@ -112,14 +120,15 @@ module RSyntaxTree
112
120
  @visited_x[t_x] = 1
113
121
  end
114
122
 
115
- s_y += @global[:h_gap_between_nodes] / 2
116
- t_y += @global[:h_gap_between_nodes] / 2
117
- new_y += @global[:h_gap_between_nodes] / 2
123
+ # s_y += @global[:h_gap_between_nodes] / 2
124
+ # t_y += @global[:h_gap_between_nodes] / 2
125
+ # new_y += @global[:h_gap_between_nodes] / 2
118
126
 
119
127
  dashed = true if target_arrow == :none
120
128
 
121
129
  case target_arrow
122
130
  when :single
131
+ @extra_lines << generate_line(new_s_x, s_y, new_s_x, new_y, @col_path, dashed)
123
132
  @extra_lines << generate_line(new_s_x, s_y, new_s_x, new_y, @col_path, dashed)
124
133
  @extra_lines << generate_line(new_s_x, new_y, new_t_x, new_y, @col_path, dashed)
125
134
  @extra_lines << generate_line(new_t_x, new_y, new_t_x, t_y, @col_path, dashed, true)
@@ -362,37 +371,64 @@ module RSyntaxTree
362
371
  end
363
372
 
364
373
  def draw_paths
374
+ paths = []
365
375
  path_pool_target = {}
366
376
  path_pool_other = {}
367
377
  path_pool_source = {}
368
378
  path_flags = []
379
+
380
+ line_pool = {}
381
+ line_flags = []
382
+
369
383
  # elist = @element_list.get_elements.reverse
370
384
  elist = @element_list.get_elements
371
385
 
372
- elist.each do |element|
386
+ elist.each_with_index do |element, i|
387
+ x0 = element.horizontal_indent - @global[:h_gap_between_nodes]
373
388
  x1 = element.horizontal_indent + element.content_width / 2
389
+ x2 = element.horizontal_indent + element.content_width + @global[:h_gap_between_nodes]
390
+ y0 = if /nothing|none/ =~ @leafstyle && element.type == ETYPE_LEAF && element.enclosure != :none
391
+ element.vertical_indent - @global[:height_connector_to_text]
392
+ else
393
+ element.vertical_indent + @global[:height_connector_to_text] / 2
394
+ end
374
395
  y1 = element.vertical_indent + element.content_height
375
- y1 += @global[:height_connector_to_text] if element.enclosure != :none
396
+ if i == elist.size - 1 && /nothing|none/ =~ @leafstyle
397
+ y1 -= @global[:height_connector_to_text] / 2
398
+ else
399
+ y1 += @global[:height_connector_to_text]
400
+ end
376
401
  et = element.path
377
402
  et.each do |tr|
378
- if /\A>(\d+)\z/ =~ tr
403
+ if /\A-(>)?(\d+)\z/ =~ tr
404
+ arrow = $1
405
+ tr = $2
406
+ if line_pool[tr]
407
+ line_pool[tr] << { x: { left: x0, center: x1, right: x2 }, y: { top: y0, center: y0 + (y1 - y0) / 2, bottom: y1 }, arrow: arrow }
408
+ else
409
+ line_pool[tr] = [{ x: { left: x0, center: x1, right: x2 }, y: { top: y0, center: y0 + (y1 - y0) / 2, bottom: y1 }, arrow: arrow }]
410
+ end
411
+ line_flags << tr
412
+ elsif /\A>(\d+)\z/ =~ tr
379
413
  tr = $1
380
414
  if path_pool_target[tr]
381
415
  path_pool_target[tr] << [x1, y1]
382
416
  else
383
417
  path_pool_target[tr] = [[x1, y1]]
384
418
  end
419
+ path_flags << tr
385
420
  elsif path_pool_source[tr]
386
421
  if path_pool_other[tr]
387
422
  path_pool_other[tr] << [x1, y1]
388
423
  else
389
424
  path_pool_other[tr] = [[x1, y1]]
390
425
  end
426
+ path_flags << tr
391
427
  else
392
428
  path_pool_source[tr] = [x1, y1]
429
+ path_flags << tr
393
430
  end
394
- path_flags << tr
395
- raise RSTError, "Error: input text contains a path having more than two ends:\n > #{tr}" if path_flags.tally.any? { |_k, v| v > 2 }
431
+ raise RSTError, "Error: input text contains a path having more than two ends:\n > #{tr}" if path_flags.tally.any? { |_k, v| v > 2 } || line_flags.tally.any? { |_k, v| v > 2 }
396
432
  end
397
433
  end
398
434
 
@@ -400,7 +436,6 @@ module RSyntaxTree
400
436
  raise RSTError, "Error: input text contains a path having only one end:\n > #{k}" if v == 1
401
437
  end
402
438
 
403
- paths = []
404
439
  path_pool_source.each do |k, v|
405
440
  path_flags.delete(k)
406
441
  if (targets = path_pool_target[k])
@@ -423,12 +458,43 @@ module RSyntaxTree
423
458
  end
424
459
 
425
460
  paths.each do |t|
426
- draw_a_path(t[:x1], t[:y1] + @global[:height_connector_to_text] / 2,
427
- t[:x2], t[:y2] + @global[:height_connector_to_text] / 2,
428
- t[:arrow])
461
+ # draw_a_path(t[:x1], t[:y1] - @global[:height_connector_to_text], t[:x2], t[:y2] - @global[:height_connector_to_text], t[:arrow])
462
+ draw_a_path(t[:x1], t[:y1], t[:x2], t[:y2], t[:arrow])
463
+ end
464
+
465
+ line_pool.each do |_k, v|
466
+ a = v[0]
467
+ b = v[1]
468
+
469
+ if (a[:y][:bottom] > b[:y][:top] && a[:y][:top] < b[:y][:bottom]) || (b[:y][:bottom] > a[:y][:top] && b[:y][:top] < a[:y][:bottom])
470
+ y_top = [a[:y][:top], b[:y][:top]].max
471
+ y_bottom = [a[:y][:bottom], b[:y][:bottom]].min
472
+ y_center = y_top + (y_top - y_bottom).abs / 2
473
+ if a[:x][:center] < b[:x][:center]
474
+ draw_direct_line(a[:x][:right], y_center, b[:x][:left], y_center, a[:arrow], b[:arrow])
475
+ else
476
+ draw_direct_line(b[:x][:right], y_center, a[:x][:left], y_center, b[:arrow], a[:arrow])
477
+ end
478
+ next
479
+ end
480
+
481
+ if a[:y][:bottom] < b[:y][:bottom]
482
+ draw_direct_line(a[:x][:center], a[:y][:bottom], b[:x][:center], b[:y][:top], a[:arrow], b[:arrow])
483
+ else
484
+ draw_direct_line(a[:x][:center], a[:y][:top], b[:x][:center], b[:y][:bottom], a[:arrow], b[:arrow])
485
+ end
429
486
  end
487
+ paths.size + line_pool.keys.size
488
+ end
489
+
490
+ def generate_connector(x1, y1, x2, y2, col, dashed = false, s_arrow = false, t_arrow = false, stroke_width = 1)
491
+ string = +""
492
+ string << "marker-start='url(#arrowSolid)' " if s_arrow
493
+ string << "marker-end='url(#arrowSolid)' " if t_arrow
494
+ dasharray = dashed ? "stroke-dasharray='8 8'" : ""
495
+ swidth = FONT_SCALING * stroke_width
430
496
 
431
- paths.size
497
+ "<line x1='#{x1}' y1='#{y1}' x2='#{x2}' y2='#{y2}' style='fill: none; stroke: #{col}; stroke-width:#{swidth}' #{dasharray} #{string}/>"
432
498
  end
433
499
 
434
500
  def generate_line(x1, y1, x2, y2, col, dashed = false, arrow = false, stroke_width = 1)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RSyntaxTree
4
- VERSION = "1.1.4"
4
+ VERSION = "1.2.0"
5
5
  end
@@ -29,6 +29,8 @@ class MarkupParserTest < Minitest::Test
29
29
  # {:path=>"+12"@0}
30
30
  @parser.path.parse('+>34')
31
31
  # {:path=>"+>34"@0}d
32
+ @parser.path.parse('+-87')
33
+ # {:path=>"+-87"@0}d
32
34
  end
33
35
 
34
36
  def test_rule_escaped