rsyntaxtree 1.2.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/.tags +84 -0
  4. data/Rakefile +14 -4
  5. data/bin/rsyntaxtree +4 -2
  6. data/docs/_examples/000.md +2 -1
  7. data/docs/_examples/001.md +2 -1
  8. data/docs/_examples/002.md +2 -1
  9. data/docs/_examples/003.md +2 -1
  10. data/docs/_examples/004.md +2 -1
  11. data/docs/_examples/005.md +2 -1
  12. data/docs/_examples/006.md +2 -1
  13. data/docs/_examples/007.md +2 -1
  14. data/docs/_examples/008.md +2 -1
  15. data/docs/_examples/009.md +2 -1
  16. data/docs/_examples/010.md +2 -1
  17. data/docs/_examples/011.md +2 -1
  18. data/docs/_examples/012.md +2 -1
  19. data/docs/_examples/013.md +2 -1
  20. data/docs/_examples/014.md +2 -1
  21. data/docs/_examples/015.md +2 -1
  22. data/docs/_examples/016.md +2 -1
  23. data/docs/_examples/017.md +2 -1
  24. data/docs/_examples/018.md +2 -1
  25. data/docs/_examples/019.md +2 -1
  26. data/docs/_examples/020.md +2 -1
  27. data/docs/_examples/021.md +2 -1
  28. data/docs/_examples/022.md +2 -1
  29. data/docs/_examples/023.md +2 -1
  30. data/docs/_examples/024.md +2 -1
  31. data/docs/_examples/025.md +2 -1
  32. data/docs/_examples/026.md +2 -1
  33. data/docs/_examples/027.md +2 -1
  34. data/docs/_examples/028.md +2 -1
  35. data/docs/_examples/029.md +2 -1
  36. data/docs/_examples/030.md +4 -3
  37. data/docs/_examples/031.md +2 -1
  38. data/docs/_examples/032.md +7 -5
  39. data/docs/_examples/033.md +16 -17
  40. data/docs/_examples/034.md +3 -2
  41. data/docs/_examples/035.md +35 -0
  42. data/docs/_examples/036.md +18 -0
  43. data/docs/_examples/037.md +18 -0
  44. data/docs/assets/img/000.png +0 -0
  45. data/docs/assets/img/001.png +0 -0
  46. data/docs/assets/img/002.png +0 -0
  47. data/docs/assets/img/003.png +0 -0
  48. data/docs/assets/img/004.png +0 -0
  49. data/docs/assets/img/005.png +0 -0
  50. data/docs/assets/img/006.png +0 -0
  51. data/docs/assets/img/007.png +0 -0
  52. data/docs/assets/img/008.png +0 -0
  53. data/docs/assets/img/009.png +0 -0
  54. data/docs/assets/img/010.png +0 -0
  55. data/docs/assets/img/011.png +0 -0
  56. data/docs/assets/img/012.png +0 -0
  57. data/docs/assets/img/013.png +0 -0
  58. data/docs/assets/img/014.png +0 -0
  59. data/docs/assets/img/015.png +0 -0
  60. data/docs/assets/img/016.png +0 -0
  61. data/docs/assets/img/017.png +0 -0
  62. data/docs/assets/img/018.png +0 -0
  63. data/docs/assets/img/019.png +0 -0
  64. data/docs/assets/img/020.png +0 -0
  65. data/docs/assets/img/021.png +0 -0
  66. data/docs/assets/img/022.png +0 -0
  67. data/docs/assets/img/023.png +0 -0
  68. data/docs/assets/img/024.png +0 -0
  69. data/docs/assets/img/025.png +0 -0
  70. data/docs/assets/img/026.png +0 -0
  71. data/docs/assets/img/027.png +0 -0
  72. data/docs/assets/img/028.png +0 -0
  73. data/docs/assets/img/029.png +0 -0
  74. data/docs/assets/img/030.png +0 -0
  75. data/docs/assets/img/031.png +0 -0
  76. data/docs/assets/img/032.png +0 -0
  77. data/docs/assets/img/033.png +0 -0
  78. data/docs/assets/img/034.png +0 -0
  79. data/docs/assets/img/035.png +0 -0
  80. data/docs/assets/img/036.png +0 -0
  81. data/docs/assets/img/037.png +0 -0
  82. data/docs/assets/svg/000.svg +44 -38
  83. data/docs/assets/svg/001.svg +24 -18
  84. data/docs/assets/svg/002.svg +36 -30
  85. data/docs/assets/svg/003.svg +28 -22
  86. data/docs/assets/svg/004.svg +37 -31
  87. data/docs/assets/svg/005.svg +19 -13
  88. data/docs/assets/svg/006.svg +23 -17
  89. data/docs/assets/svg/007.svg +30 -24
  90. data/docs/assets/svg/008.svg +34 -28
  91. data/docs/assets/svg/009.svg +31 -25
  92. data/docs/assets/svg/010.svg +57 -51
  93. data/docs/assets/svg/011.svg +26 -20
  94. data/docs/assets/svg/012.svg +29 -23
  95. data/docs/assets/svg/013.svg +124 -118
  96. data/docs/assets/svg/014.svg +95 -89
  97. data/docs/assets/svg/015.svg +37 -31
  98. data/docs/assets/svg/016.svg +200 -194
  99. data/docs/assets/svg/017.svg +40 -34
  100. data/docs/assets/svg/018.svg +42 -36
  101. data/docs/assets/svg/019.svg +184 -178
  102. data/docs/assets/svg/020.svg +64 -58
  103. data/docs/assets/svg/021.svg +41 -35
  104. data/docs/assets/svg/022.svg +69 -63
  105. data/docs/assets/svg/023.svg +40 -34
  106. data/docs/assets/svg/024.svg +22 -16
  107. data/docs/assets/svg/025.svg +124 -118
  108. data/docs/assets/svg/026.svg +16 -10
  109. data/docs/assets/svg/027.svg +46 -40
  110. data/docs/assets/svg/028.svg +26 -20
  111. data/docs/assets/svg/029.svg +94 -88
  112. data/docs/assets/svg/030.svg +51 -45
  113. data/docs/assets/svg/031.svg +14 -8
  114. data/docs/assets/svg/032.svg +68 -49
  115. data/docs/assets/svg/033.svg +62 -55
  116. data/docs/assets/svg/034.svg +66 -60
  117. data/docs/assets/svg/035.svg +82 -0
  118. data/docs/assets/svg/036.svg +50 -0
  119. data/docs/assets/svg/037.svg +88 -0
  120. data/docs/documentation.md +4 -4
  121. data/docs/documentation_ja.md +10 -6
  122. data/docs/examples.html +1 -1
  123. data/lib/rsyntaxtree/base_graph.rb +29 -14
  124. data/lib/rsyntaxtree/element.rb +6 -11
  125. data/lib/rsyntaxtree/svg_graph.rb +52 -45
  126. data/lib/rsyntaxtree/version.rb +1 -1
  127. data/lib/rsyntaxtree.rb +13 -3
  128. data/test/example_verify_test.rb +13 -3
  129. metadata +12 -3
@@ -16,19 +16,38 @@ module RSyntaxTree
16
16
  @element_list = element_list
17
17
  @symmetrize = params[:symmetrize]
18
18
 
19
- if params[:color]
19
+ case params[:color]
20
+ # Okabe-Ito Color
21
+ when "modern"
22
+ @col_node = "#0072B2" # blue
23
+ @col_leaf = "#009E73" # bluishgreen
24
+ @col_path = "#CC79A7" # reddishpurple
25
+ @col_extra = "#D55E00" # vermillion
26
+ # "#000000" black
27
+ # "#E69F00" orange
28
+ # "#56B4E9" skyblue
29
+ # "#F0E442" yellow
30
+ # "#999999" grey
31
+ when "traditional"
20
32
  @col_node = "blue"
21
33
  @col_leaf = "green"
22
34
  @col_path = "purple"
35
+ @col_extra = "red"
23
36
  else
24
37
  @col_node = "black"
25
38
  @col_leaf = "black"
26
39
  @col_path = "black"
40
+ @col_extra = "black"
27
41
  end
28
42
 
29
43
  @col_bg = "none"
30
44
  @col_fg = "black"
31
- @col_line = "black"
45
+
46
+ @col_line = if params[:hide_default_connectors]
47
+ "none"
48
+ else
49
+ "black"
50
+ end
32
51
 
33
52
  @leafstyle = params[:leafstyle]
34
53
  @fontset = params[:fontset]
@@ -79,13 +98,11 @@ module RSyntaxTree
79
98
 
80
99
  vertical_indent = if !target.triangle &&
81
100
  (@leafstyle == "nothing" || @leafstyle == "none") &&
82
- ETYPE_LEAF == target.type &&
83
- parent.children.size == 1
101
+ ETYPE_LEAF == target.type && parent.children.size == 1
84
102
  parent.vertical_indent + parent.content_height
85
103
  else
86
104
  parent.vertical_indent + parent.content_height + @global[:height_connector]
87
105
  end
88
-
89
106
  target.vertical_indent = vertical_indent
90
107
  end
91
108
 
@@ -185,8 +202,6 @@ module RSyntaxTree
185
202
  triangle_to_parent(parent, child)
186
203
  elsif ETYPE_LEAF != child.type
187
204
  line_to_parent(parent, child)
188
- elsif ETYPE_LEAF == child.type
189
- child.vertical_indent = parent.vertical_indent + parent.content_height + @global[:height_connector] / 2
190
205
  end
191
206
  end
192
207
  else
@@ -226,11 +241,13 @@ module RSyntaxTree
226
241
  end
227
242
 
228
243
  def parse_list
229
- calculate_level
230
- calculate_width
231
- make_balance if @symmetrize
232
- calculate_indent
233
- node_centering
244
+ if @element_list.elements.size > 1
245
+ calculate_level
246
+ calculate_width
247
+ make_balance if @symmetrize
248
+ calculate_indent
249
+ node_centering
250
+ end
234
251
 
235
252
  top = @element_list.get_id(1)
236
253
  diff = top.horizontal_indent
@@ -239,7 +256,6 @@ module RSyntaxTree
239
256
  end
240
257
 
241
258
  offset_l = (top.horizontal_indent - get_leftmost) + @global[:h_gap_between_nodes]
242
- # offset_r = top.width / 2 - offset_l - @global[:h_gap_between_nodes:
243
259
 
244
260
  @element_list.get_elements.each do |e|
245
261
  e.horizontal_indent += offset_l
@@ -253,7 +269,6 @@ module RSyntaxTree
253
269
  width = get_rightmost - get_leftmost + @global[:h_gap_between_nodes]
254
270
  height = @element_list.get_id(1).height
255
271
  height = @height if @height > height
256
-
257
272
  { height: height, width: width }
258
273
  end
259
274
  end
@@ -77,14 +77,6 @@ module RSyntaxTree
77
77
  fontsize = decoration.include?(:subscript) || decoration.include?(:superscript) ? fontsize * SUBSCRIPT_CONST : fontsize
78
78
  style = decoration.include?(:italic) || decoration.include?(:bolditalic) ? :italic : :normal
79
79
  weight = decoration.include?(:bold) || decoration.include?(:bolditalic) ? :bold : :normal
80
-
81
- # e[:cjk] = false
82
- # if e[:decoration].include?(:math)
83
- # font = @fontset[:math]
84
- # elsif text.contains_cjk?
85
- # font = @fontset[:cjk]
86
- # e[:cjk] = true
87
- # elsif decoration.include? :bolditalic
88
80
  font = if decoration.include? :bolditalic
89
81
  @fontset[:bolditalic]
90
82
  elsif decoration.include? :bold
@@ -146,10 +138,13 @@ module RSyntaxTree
146
138
  row_width += width
147
139
  end
148
140
 
149
- total_height += if @enclosure != :none
150
- elements_height.max + @global[:height_connector_to_text]
151
- else
141
+ total_height += if @parent.zero? && @children.empty?
142
+ # tree without parent node
152
143
  elements_height.max
144
+ # elsif @enclosure != :none && @children.empty?
145
+ # elements_height.max
146
+ else
147
+ elements_height.max + @global[:height_connector_to_text]
153
148
  end
154
149
  content_width += row_width
155
150
  end
@@ -16,6 +16,7 @@ module RSyntaxTree
16
16
  attr_accessor :width, :height
17
17
 
18
18
  def initialize(element_list, params, global)
19
+ super(element_list, params, global)
19
20
  @height = 0
20
21
  @width = 0
21
22
  @extra_lines = []
@@ -26,8 +27,8 @@ module RSyntaxTree
26
27
  @fontstyle = params[:fontstyle]
27
28
  @margin = params[:margin].to_i
28
29
  @polyline = params[:polyline]
29
- @line_styles = "<line style='stroke:black; stroke-width:#{FONT_SCALING};' x1='X1' y1='Y1' x2='X2' y2='Y2' />\n"
30
- @polyline_styles = "<polyline style='stroke:black; stroke-width:#{FONT_SCALING}; fill:none;'
30
+ @line_styles = "<line style='stroke:#{@col_line}; stroke-width:#{FONT_SCALING};' x1='X1' y1='Y1' x2='X2' y2='Y2' />\n"
31
+ @polyline_styles = "<polyline style='stroke:#{@col_line}; stroke-width:#{FONT_SCALING}; fill:none;'
31
32
  points='CHIX CHIY MIDX1 MIDY1 MIDX2 MIDY2 PARX PARY' />\n"
32
33
  @polygon_styles = "<polygon style='fill: none; stroke: black; stroke-width:#{FONT_SCALING};' points='X1 Y1 X2 Y2 X3 Y3' />\n"
33
34
  @text_styles = "<text white-space='pre' alignment-baseline='text-top' style='fill: COLOR; font-size: fontsize' x='X_VALUE' y='Y_VALUE'>CONTENT</text>\n"
@@ -35,12 +36,15 @@ module RSyntaxTree
35
36
  @visited_x = {}
36
37
  @visited_y = {}
37
38
  @global = global
38
- super(element_list, params, global)
39
39
  end
40
40
 
41
41
  def svg_data
42
42
  metrics = parse_list
43
- @height = metrics[:height] + @margin * 2
43
+ @height = if @element_list.elements.size == 1
44
+ metrics[:height]
45
+ else
46
+ metrics[:height] + @margin * 2
47
+ end
44
48
  @width = metrics[:width] + @margin * 2
45
49
 
46
50
  x1 = 0 - @margin
@@ -51,7 +55,7 @@ module RSyntaxTree
51
55
 
52
56
  as = @global[:h_gap_between_nodes] / 4 * 0.8
53
57
  as2 = @global[:h_gap_between_nodes] / 2 * 0.8
54
- as3 = @global[:h_gap_between_nodes] / 2 * 0.5
58
+ as4 = @global[:h_gap_between_nodes] * 1.2
55
59
 
56
60
  header = <<~HDR
57
61
  <?xml version="1.0" standalone="no"?>
@@ -61,8 +65,14 @@ module RSyntaxTree
61
65
  <marker id="arrow" markerUnits="strokeWidth" markerWidth="#{as2}" markerHeight="#{as2}" viewBox="0 0 #{as2} #{as2}" refX="#{as}" refY="0">
62
66
  <polyline fill="none" stroke="#{@col_path}" stroke-width="1" points="0,#{as2},#{as},0,#{as2},#{as2}" />
63
67
  </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}"/>
68
+ <marker id="arrowForward" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="#{as2}" markerHeight="#{as2}" orient="auto-start-reverse">
69
+ <path d="M 0 0 L 10 5 L 0 10 z" fill="#{@col_extra}"/>
70
+ </marker>
71
+ <marker id="arrowBackward" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="#{as2}" markerHeight="#{as2}" orient="auto">
72
+ <path d="M 0 0 L 10 5 L 0 10 z" fill="#{@col_extra}"/>
73
+ </marker>
74
+ <marker id="arrowBothways" viewBox="0 0 30 10" refX="15" refY="5" markerWidth="#{as4}" markerHeight="#{as4}" orient="auto">
75
+ <path d="M 0 5 L 10 0 L 10 5 L 20 5 L 20 0 L 30 5 L 20 10 L 20 5 L 10 5 L 10 10 z" fill="#{@col_extra}"/>
66
76
  </marker>
67
77
  <pattern id="hatchBlack" x="10" y="10" width="10" height="10" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
68
78
  <line x1="0" y="0" x2="0" y2="10" stroke="black" stroke-width="4"></line>
@@ -90,7 +100,7 @@ module RSyntaxTree
90
100
  end
91
101
 
92
102
  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)
103
+ @extra_lines << generate_connector(s_x, s_y, t_x, t_y, @col_extra, false, s_arrow, t_arrow)
94
104
  end
95
105
 
96
106
  def draw_a_path(s_x, s_y, t_x, t_y, target_arrow = :none)
@@ -120,10 +130,6 @@ module RSyntaxTree
120
130
  @visited_x[t_x] = 1
121
131
  end
122
132
 
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
126
-
127
133
  dashed = true if target_arrow == :none
128
134
 
129
135
  case target_arrow
@@ -380,24 +386,14 @@ module RSyntaxTree
380
386
  line_pool = {}
381
387
  line_flags = []
382
388
 
383
- # elist = @element_list.get_elements.reverse
384
389
  elist = @element_list.get_elements
385
390
 
386
- elist.each_with_index do |element, i|
391
+ elist.each do |element|
387
392
  x0 = element.horizontal_indent - @global[:h_gap_between_nodes]
388
393
  x1 = element.horizontal_indent + element.content_width / 2
389
394
  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
395
- y1 = element.vertical_indent + element.content_height
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
395
+ y0 = element.vertical_indent + @global[:height_connector_to_text] / 2
396
+ y1 = element.vertical_indent + element.content_height + @global[:height_connector_to_text]
401
397
  et = element.path
402
398
  et.each do |tr|
403
399
  if /\A-(>)?(\d+)\z/ =~ tr
@@ -458,7 +454,6 @@ module RSyntaxTree
458
454
  end
459
455
 
460
456
  paths.each do |t|
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
457
  draw_a_path(t[:x1], t[:y1], t[:x2], t[:y2], t[:arrow])
463
458
  end
464
459
 
@@ -466,35 +461,47 @@ module RSyntaxTree
466
461
  a = v[0]
467
462
  b = v[1]
468
463
 
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
464
+ if a[:y][:top] > b[:y][:bottom]
484
465
  draw_direct_line(a[:x][:center], a[:y][:top], b[:x][:center], b[:y][:bottom], a[:arrow], b[:arrow])
466
+ elsif a[:y][:bottom] < b[:y][:top]
467
+ draw_direct_line(b[:x][:center], b[:y][:top], a[:x][:center], a[:y][:bottom], b[:arrow], a[:arrow])
468
+ elsif a[:x][:center] < b[:x][:center]
469
+ draw_direct_line(a[:x][:right], a[:y][:center], b[:x][:left], b[:y][:center], a[:arrow], b[:arrow])
470
+ else
471
+ draw_direct_line(b[:x][:right], b[:y][:center], a[:x][:left], a[:y][:center], b[:arrow], a[:arrow])
485
472
  end
486
473
  end
487
474
  paths.size + line_pool.keys.size
488
475
  end
489
476
 
490
477
  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
478
+ string = if s_arrow && t_arrow
479
+ "marker-mid='url(#arrowBothways)' "
480
+ elsif s_arrow
481
+ "marker-mid='url(#arrowForward)' "
482
+ elsif t_arrow
483
+ "marker-mid='url(#arrowBackward)' "
484
+ else
485
+ ""
486
+ end
494
487
  dasharray = dashed ? "stroke-dasharray='8 8'" : ""
495
488
  swidth = FONT_SCALING * stroke_width
496
489
 
497
- "<line x1='#{x1}' y1='#{y1}' x2='#{x2}' y2='#{y2}' style='fill: none; stroke: #{col}; stroke-width:#{swidth}' #{dasharray} #{string}/>"
490
+ if s_arrow || t_arrow
491
+ x_mid = if x2 > x1
492
+ x1 + (x2 - x1) / 2
493
+ else
494
+ x1 - (x1 - x2) / 2
495
+ end
496
+ y_mid = if y2 > y1
497
+ y1 + (y2 - y1) / 2
498
+ else
499
+ y1 - (y1 - y2) / 2
500
+ end
501
+ "<path d='M#{x1},#{y1} L#{x_mid},#{y_mid} L#{x2}, #{y2}' style='fill: none; stroke: #{col}; stroke-width:#{swidth}' #{dasharray} #{string}/>"
502
+ else
503
+ "<line x1='#{x1}' y1='#{y1}' x2='#{x2}' y2='#{y2}' style='fill: none; stroke: #{col}; stroke-width:#{swidth}' #{dasharray} #{string}/>"
504
+ end
498
505
  end
499
506
 
500
507
  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.2.0"
4
+ VERSION = "1.2.2"
5
5
  end
data/lib/rsyntaxtree.rb CHANGED
@@ -53,8 +53,17 @@ module RSyntaxTree
53
53
  .gsub(/(?<!\\)¥/, "\\")
54
54
  new_params[key] = data
55
55
 
56
- when :symmetrize, :color, :transparent, :polyline
56
+ when :symmetrize, :transparent, :polyline, :hide_default_connectors
57
57
  new_params[key] = value && (value != "off" && value != "false") ? true : false
58
+ when :color
59
+ new_params[key] = case value
60
+ when "modern", "on", "true"
61
+ "modern"
62
+ when "traditional"
63
+ "traditional"
64
+ else
65
+ "off"
66
+ end
58
67
  when :fontsize
59
68
  new_params[key] = value.to_i * FONT_SCALING
60
69
  when :margin
@@ -108,7 +117,7 @@ module RSyntaxTree
108
117
  # defaults to the following
109
118
  @params = {
110
119
  symmetrize: true,
111
- color: true,
120
+ color: "modern",
112
121
  transparent: false,
113
122
  fontsize: 16,
114
123
  format: "png",
@@ -117,7 +126,8 @@ module RSyntaxTree
117
126
  data: "",
118
127
  margin: 0,
119
128
  vheight: 1.0,
120
- polyline: false
129
+ polyline: false,
130
+ hide_default_connectors: false
121
131
  }
122
132
 
123
133
  @params.merge! new_params
@@ -25,7 +25,8 @@ class ExampleParserTest < Minitest::Test
25
25
  color: "on",
26
26
  symmetrize: "on",
27
27
  transparent: "off",
28
- polyline: "off"
28
+ polyline: "off",
29
+ hide_default_connectors: "off"
29
30
  }
30
31
  name = nil
31
32
  config.each do |key, value|
@@ -34,10 +35,19 @@ class ExampleParserTest < Minitest::Test
34
35
  case key
35
36
  when "name"
36
37
  name = value
37
- when "colorization"
38
- opts[:color] = value
38
+ when "color"
39
+ opts[:color] = case value
40
+ when "modern", "on", "true"
41
+ "modern"
42
+ when "traditional"
43
+ "traditional"
44
+ else
45
+ "off"
46
+ end
39
47
  when "polyline"
40
48
  opts[:polyline] = value
49
+ when "hide_default_connectors"
50
+ opts[:hide_default_connectors] = value
41
51
  when "symmetrization"
42
52
  opts[:symmetrize] = value
43
53
  when "connector"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsyntaxtree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoichiro Hasebe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-30 00:00:00.000000000 Z
11
+ date: 2023-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: optimist
@@ -147,6 +147,9 @@ files:
147
147
  - docs/_examples/032.md
148
148
  - docs/_examples/033.md
149
149
  - docs/_examples/034.md
150
+ - docs/_examples/035.md
151
+ - docs/_examples/036.md
152
+ - docs/_examples/037.md
150
153
  - docs/_includes/box_and_circle_table.html
151
154
  - docs/_includes/escape_char_table.html
152
155
  - docs/_includes/social_media_links.html
@@ -187,6 +190,9 @@ files:
187
190
  - docs/assets/img/032.png
188
191
  - docs/assets/img/033.png
189
192
  - docs/assets/img/034.png
193
+ - docs/assets/img/035.png
194
+ - docs/assets/img/036.png
195
+ - docs/assets/img/037.png
190
196
  - docs/assets/img/elements/circle.png
191
197
  - docs/assets/img/elements/circle_abc.png
192
198
  - docs/assets/img/elements/circle_bold.png
@@ -238,6 +244,9 @@ files:
238
244
  - docs/assets/svg/032.svg
239
245
  - docs/assets/svg/033.svg
240
246
  - docs/assets/svg/034.svg
247
+ - docs/assets/svg/035.svg
248
+ - docs/assets/svg/036.svg
249
+ - docs/assets/svg/037.svg
241
250
  - docs/documentation.md
242
251
  - docs/documentation_ja.md
243
252
  - docs/examples.html
@@ -295,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
295
304
  - !ruby/object:Gem::Version
296
305
  version: '0'
297
306
  requirements: []
298
- rubygems_version: 3.3.3
307
+ rubygems_version: 3.4.1
299
308
  signing_key:
300
309
  specification_version: 4
301
310
  summary: RSyntaxTree is a graphical syntax tree generator written in Ruby