rsyntaxtree 1.2.8 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.tags +1 -0
- data/bin/rsyntaxtree +3 -1
- data/docs/assets/img/000.png +0 -0
- data/docs/assets/img/001.png +0 -0
- data/docs/assets/img/002.png +0 -0
- data/docs/assets/img/003.png +0 -0
- data/docs/assets/img/004.png +0 -0
- data/docs/assets/img/005.png +0 -0
- data/docs/assets/img/006.png +0 -0
- data/docs/assets/img/007.png +0 -0
- data/docs/assets/img/008.png +0 -0
- data/docs/assets/img/009.png +0 -0
- data/docs/assets/img/010.png +0 -0
- data/docs/assets/img/011.png +0 -0
- data/docs/assets/img/012.png +0 -0
- data/docs/assets/img/013.png +0 -0
- data/docs/assets/img/014.png +0 -0
- data/docs/assets/img/015.png +0 -0
- data/docs/assets/img/016.png +0 -0
- data/docs/assets/img/017.png +0 -0
- data/docs/assets/img/018.png +0 -0
- data/docs/assets/img/019.png +0 -0
- data/docs/assets/img/020.png +0 -0
- data/docs/assets/img/021.png +0 -0
- data/docs/assets/img/022.png +0 -0
- data/docs/assets/img/023.png +0 -0
- data/docs/assets/img/024.png +0 -0
- data/docs/assets/img/025.png +0 -0
- data/docs/assets/img/026.png +0 -0
- data/docs/assets/img/027.png +0 -0
- data/docs/assets/img/028.png +0 -0
- data/docs/assets/img/029.png +0 -0
- data/docs/assets/img/030.png +0 -0
- data/docs/assets/img/031.png +0 -0
- data/docs/assets/img/032.png +0 -0
- data/docs/assets/img/033.png +0 -0
- data/docs/assets/img/034.png +0 -0
- data/docs/assets/img/035.png +0 -0
- data/docs/assets/img/036.png +0 -0
- data/docs/assets/img/037.png +0 -0
- data/docs/assets/img/038.png +0 -0
- data/docs/assets/img/039.png +0 -0
- data/docs/assets/img/040.png +0 -0
- data/docs/assets/img/041.png +0 -0
- data/docs/assets/img/042.png +0 -0
- data/docs/assets/img/043.png +0 -0
- data/docs/assets/img/044.png +0 -0
- data/docs/assets/img/045.png +0 -0
- data/docs/assets/img/046.png +0 -0
- data/docs/assets/img/047.png +0 -0
- data/docs/assets/svg/000.svg +35 -35
- data/docs/assets/svg/001.svg +19 -19
- data/docs/assets/svg/002.svg +37 -37
- data/docs/assets/svg/003.svg +29 -29
- data/docs/assets/svg/004.svg +41 -41
- data/docs/assets/svg/005.svg +21 -21
- data/docs/assets/svg/006.svg +25 -25
- data/docs/assets/svg/007.svg +31 -31
- data/docs/assets/svg/008.svg +35 -35
- data/docs/assets/svg/009.svg +35 -35
- data/docs/assets/svg/010.svg +52 -52
- data/docs/assets/svg/011.svg +30 -30
- data/docs/assets/svg/012.svg +35 -35
- data/docs/assets/svg/013.svg +116 -116
- data/docs/assets/svg/014.svg +96 -96
- data/docs/assets/svg/015.svg +33 -33
- data/docs/assets/svg/016.svg +397 -397
- data/docs/assets/svg/017.svg +35 -35
- data/docs/assets/svg/018.svg +37 -37
- data/docs/assets/svg/019.svg +95 -95
- data/docs/assets/svg/020.svg +62 -62
- data/docs/assets/svg/021.svg +42 -42
- data/docs/assets/svg/022.svg +75 -75
- data/docs/assets/svg/023.svg +51 -51
- data/docs/assets/svg/024.svg +23 -23
- data/docs/assets/svg/025.svg +99 -99
- data/docs/assets/svg/026.svg +19 -19
- data/docs/assets/svg/027.svg +50 -50
- data/docs/assets/svg/028.svg +21 -21
- data/docs/assets/svg/029.svg +69 -69
- data/docs/assets/svg/030.svg +35 -35
- data/docs/assets/svg/031.svg +15 -15
- data/docs/assets/svg/032.svg +41 -41
- data/docs/assets/svg/033.svg +39 -39
- data/docs/assets/svg/034.svg +40 -40
- data/docs/assets/svg/035.svg +39 -39
- data/docs/assets/svg/036.svg +17 -17
- data/docs/assets/svg/037.svg +29 -29
- data/docs/assets/svg/038.svg +39 -39
- data/docs/assets/svg/039.svg +7 -7
- data/docs/assets/svg/040.svg +67 -67
- data/docs/assets/svg/041.svg +49 -49
- data/docs/assets/svg/042.svg +15 -15
- data/docs/assets/svg/043.svg +150 -150
- data/docs/assets/svg/044.svg +8 -8
- data/docs/assets/svg/045.svg +56 -56
- data/docs/assets/svg/046.svg +647 -647
- data/docs/assets/svg/047.svg +26 -31
- data/lib/rsyntaxtree/base_graph.rb +2 -1
- data/lib/rsyntaxtree/svg_graph.rb +3 -4
- data/lib/rsyntaxtree/version.rb +1 -1
- data/lib/rsyntaxtree.rb +10 -3
- metadata +1 -1
data/docs/assets/svg/047.svg
CHANGED
@@ -1,17 +1,17 @@
|
|
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="95.4" height="317.25" viewBox="-16.8, 0, 112.2, 328.5" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
4
4
|
<defs>
|
5
|
-
<marker id="arrow" markerUnits="userSpaceOnUse" viewBox="0 0 10 10" refX="10" refY="5" markerWidth="
|
5
|
+
<marker id="arrow" markerUnits="userSpaceOnUse" viewBox="0 0 10 10" refX="10" refY="5" markerWidth="16.8" markerHeight="16.8" orient="auto">
|
6
6
|
<path d="M 0 0 L 10 5 L 0 10" fill="black"/>
|
7
7
|
</marker>
|
8
|
-
<marker id="arrowBackward" markerUnits="userSpaceOnUse" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="
|
8
|
+
<marker id="arrowBackward" markerUnits="userSpaceOnUse" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="16.8" markerHeight="16.8" orient="auto">
|
9
9
|
<path d="M 0 0 L 10 5 L 0 10 z" fill="black"/>
|
10
10
|
</marker>
|
11
|
-
<marker id="arrowForward" markerUnits="userSpaceOnUse" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="
|
11
|
+
<marker id="arrowForward" markerUnits="userSpaceOnUse" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="16.8" markerHeight="16.8" orient="auto">
|
12
12
|
<path d="M 10 0 L 0 5 L 10 10 z" fill="black"/>
|
13
13
|
</marker>
|
14
|
-
<marker id="arrowBothways" markerUnits="userSpaceOnUse" viewBox="0 0 30 10" refX="15" refY="5" markerWidth="
|
14
|
+
<marker id="arrowBothways" markerUnits="userSpaceOnUse" viewBox="0 0 30 10" refX="15" refY="5" markerWidth="50.400000000000006" markerHeight="16.8" orient="auto">
|
15
15
|
<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="black"/>
|
16
16
|
</marker>
|
17
17
|
<pattern id="hatchBlack" x="10" y="10" width="10" height="10" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
|
@@ -24,44 +24,39 @@
|
|
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="
|
28
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size:
|
29
|
-
<tspan x='
|
30
|
-
<tspan x='
|
31
|
-
<tspan x='
|
32
|
-
<tspan x='
|
33
|
-
<tspan x='
|
34
|
-
<tspan x='58.599999999999994' y='660.0' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif"> </tspan>
|
27
|
+
<rect x="-16.8" y="0" width="112.2" height="328.5" stroke="none" fill="white" />"
|
28
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='16.799999999999997' y='67.5'><tspan x='29.799999999999997' y='67.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif"> </tspan>
|
29
|
+
<tspan x='29.799999999999997' y='112.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif"> </tspan>
|
30
|
+
<tspan x='29.799999999999997' y='157.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif"> </tspan>
|
31
|
+
<tspan x='29.799999999999997' y='202.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif"> </tspan>
|
32
|
+
<tspan x='29.799999999999997' y='247.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif"> </tspan>
|
33
|
+
<tspan x='29.799999999999997' y='292.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif"> </tspan>
|
35
34
|
</text>
|
36
|
-
<line style='fill:none; stroke:black; stroke-linejoin:round; stroke-linecap:round; stroke-width:2;' x1='
|
35
|
+
<line style='fill:none; stroke:black; stroke-linejoin:round; stroke-linecap:round; stroke-width:2;' x1='17.799999999999997' y1='54.0' x2='60.8' y2='54.0'></line>
|
37
36
|
|
38
|
-
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='2' points='
|
37
|
+
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='2' points='50.55,48.375 60.8,54.0 50.55,59.625' />
|
39
38
|
|
40
|
-
<line style='fill:none; stroke:black; stroke-linejoin:round; stroke-linecap:round; stroke-width:3;' x1='
|
39
|
+
<line style='fill:none; stroke:black; stroke-linejoin:round; stroke-linecap:round; stroke-width:3;' x1='17.799999999999997' y1='99.0' x2='60.8' y2='99.0'></line>
|
41
40
|
|
42
|
-
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='3' points='
|
41
|
+
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='3' points='50.55,93.375 60.8,99.0 50.55,104.625' />
|
43
42
|
|
44
|
-
<line style='fill:none; stroke:black; stroke-linejoin:round; stroke-linecap:round; stroke-width:2;' x1='
|
43
|
+
<line style='fill:none; stroke:black; stroke-linejoin:round; stroke-linecap:round; stroke-width:2;' x1='17.799999999999997' y1='144.0' x2='60.8' y2='144.0'></line>
|
45
44
|
|
46
|
-
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='2' points='
|
45
|
+
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='2' points='28.049999999999997,149.625 17.799999999999997,144.0 28.049999999999997,138.375' />
|
47
46
|
|
48
|
-
<line style='fill:none; stroke:black; stroke-linejoin:round; stroke-linecap:round; stroke-width:3;' x1='
|
47
|
+
<line style='fill:none; stroke:black; stroke-linejoin:round; stroke-linecap:round; stroke-width:3;' x1='17.799999999999997' y1='189.0' x2='60.8' y2='189.0'></line>
|
49
48
|
|
50
|
-
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='3' points='
|
49
|
+
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='3' points='28.049999999999997,194.625 17.799999999999997,189.0 28.049999999999997,183.375' />
|
51
50
|
|
52
|
-
<line style='fill:none; stroke:black; stroke-linejoin:round; stroke-linecap:round; stroke-width:2;' x1='
|
51
|
+
<line style='fill:none; stroke:black; stroke-linejoin:round; stroke-linecap:round; stroke-width:2;' x1='17.799999999999997' y1='234.0' x2='60.8' y2='234.0'></line>
|
53
52
|
|
54
|
-
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='2' points='
|
53
|
+
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='2' points='28.049999999999997,239.625 17.799999999999997,234.0 28.049999999999997,228.375' />
|
55
54
|
|
56
|
-
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='2' points='
|
55
|
+
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='2' points='50.55,228.375 60.8,234.0 50.55,239.625' />
|
57
56
|
|
58
|
-
<line style='fill:none; stroke:black; stroke-linejoin:round; stroke-linecap:round; stroke-width:3;' x1='
|
57
|
+
<line style='fill:none; stroke:black; stroke-linejoin:round; stroke-linecap:round; stroke-width:3;' x1='17.799999999999997' y1='279.0' x2='60.8' y2='279.0'></line>
|
59
58
|
|
60
|
-
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='3' points='
|
59
|
+
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='3' points='28.049999999999997,284.625 17.799999999999997,279.0 28.049999999999997,273.375' />
|
61
60
|
|
62
|
-
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='3' points='
|
63
|
-
|
64
|
-
<line style='fill:none; stroke:black; stroke-linejoin:round; stroke-linecap:round; stroke-width:2;' x1='34.599999999999994' y1='633.6' x2='120.6' y2='633.6'></line>
|
65
|
-
|
66
|
-
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='2' points='55.599999999999994,644.6 34.599999999999994,633.6 55.599999999999994,622.6' />
|
61
|
+
<polyline stroke-linejoin='round' stroke-linecap='round' fill='none' stroke='black' stroke-width='3' points='50.55,273.375 60.8,279.0 50.55,284.625' />
|
67
62
|
</svg>
|
@@ -57,7 +57,8 @@ module RSyntaxTree
|
|
57
57
|
|
58
58
|
def calculate_level
|
59
59
|
@element_list.get_elements.select { |e| e.type == 2 }.each do |e|
|
60
|
-
|
60
|
+
parent = @element_list.get_id(e.parent)
|
61
|
+
e.level = @element_list.get_id(e.parent).level + 1 if parent
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
@@ -41,12 +41,12 @@ module RSyntaxTree
|
|
41
41
|
def svg_data
|
42
42
|
metrics = parse_list
|
43
43
|
|
44
|
+
@width = metrics[:width] + @global[:h_gap_between_nodes] * 2
|
44
45
|
@height = metrics[:height] + @global[:height_connector_to_text] / 2
|
45
|
-
@width = metrics[:width] + @global[:h_gap_between_nodes] / 2
|
46
46
|
|
47
|
-
x1 = 0
|
47
|
+
x1 = 0 - @global[:h_gap_between_nodes]
|
48
48
|
y1 = 0
|
49
|
-
x2 = @width + @global[:h_gap_between_nodes]
|
49
|
+
x2 = @width + @global[:h_gap_between_nodes]
|
50
50
|
y2 = @height + @global[:height_connector_to_text] / 2
|
51
51
|
|
52
52
|
extra_lines = @extra_lines.join("\n")
|
@@ -247,7 +247,6 @@ module RSyntaxTree
|
|
247
247
|
|
248
248
|
if e[:decoration].include?(:box) || e[:decoration].include?(:circle) || e[:decoration].include?(:bar)
|
249
249
|
enc_height = e[:height]
|
250
|
-
# enc_y = this_y - e[:height] * 0.8 + FONT_SCALING
|
251
250
|
enc_y = this_y - e[:height] * 0.8
|
252
251
|
enc_width = e[:width]
|
253
252
|
enc_x = this_x
|
data/lib/rsyntaxtree/version.rb
CHANGED
data/lib/rsyntaxtree.rb
CHANGED
@@ -80,7 +80,7 @@ module RSyntaxTree
|
|
80
80
|
"off"
|
81
81
|
end
|
82
82
|
when :fontsize
|
83
|
-
new_params[key] = value.to_i
|
83
|
+
new_params[key] = value.to_i
|
84
84
|
when :linewidth
|
85
85
|
new_params[key] = value.to_i
|
86
86
|
when :vheight
|
@@ -169,13 +169,20 @@ module RSyntaxTree
|
|
169
169
|
raise RSTError, +"Error: the result syntree is too big"
|
170
170
|
end
|
171
171
|
|
172
|
-
def draw_pdf(
|
172
|
+
def draw_pdf(binary = false)
|
173
|
+
b = StringIO.new
|
173
174
|
svg = draw_svg
|
174
175
|
rsvg = RSVG::Handle.new_from_data(svg)
|
175
176
|
dim = rsvg.dimensions
|
176
|
-
surface = Cairo::PDFSurface.new(
|
177
|
+
surface = Cairo::PDFSurface.new(b, dim.width, dim.height)
|
177
178
|
context = Cairo::Context.new(surface)
|
178
179
|
context.render_rsvg_handle(rsvg)
|
180
|
+
surface.finish
|
181
|
+
if binary
|
182
|
+
b
|
183
|
+
else
|
184
|
+
b.string
|
185
|
+
end
|
179
186
|
rescue Cairo::InvalidSize
|
180
187
|
raise RSTError, +"Error: the result syntree is too big"
|
181
188
|
end
|