rsyntaxtree 1.2.4 → 1.2.5
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/Rakefile +1 -79
- data/devel/generate_examples.rb +91 -0
- data/docs/_examples/000.md +1 -0
- data/docs/_examples/001.md +1 -0
- data/docs/_examples/002.md +1 -0
- data/docs/_examples/003.md +1 -0
- data/docs/_examples/004.md +1 -0
- data/docs/_examples/005.md +1 -0
- data/docs/_examples/006.md +1 -0
- data/docs/_examples/007.md +1 -0
- data/docs/_examples/008.md +1 -0
- data/docs/_examples/009.md +1 -0
- data/docs/_examples/010.md +1 -0
- data/docs/_examples/011.md +1 -0
- data/docs/_examples/012.md +1 -0
- data/docs/_examples/013.md +1 -0
- data/docs/_examples/014.md +1 -0
- data/docs/_examples/015.md +1 -0
- data/docs/_examples/016.md +1 -0
- data/docs/_examples/017.md +1 -0
- data/docs/_examples/018.md +1 -0
- data/docs/_examples/019.md +1 -0
- data/docs/_examples/020.md +1 -0
- data/docs/_examples/021.md +1 -0
- data/docs/_examples/022.md +1 -0
- data/docs/_examples/023.md +1 -0
- data/docs/_examples/024.md +1 -0
- data/docs/_examples/025.md +1 -0
- data/docs/_examples/026.md +1 -0
- data/docs/_examples/027.md +1 -0
- data/docs/_examples/028.md +1 -0
- data/docs/_examples/029.md +1 -0
- data/docs/_examples/030.md +1 -0
- data/docs/_examples/031.md +1 -0
- data/docs/_examples/032.md +1 -0
- data/docs/_examples/033.md +1 -0
- data/docs/_examples/034.md +1 -0
- data/docs/_examples/035.md +1 -0
- data/docs/_examples/036.md +1 -0
- data/docs/_examples/037.md +8 -6
- data/docs/_examples/038.md +1 -0
- data/docs/_examples/039.md +1 -0
- data/docs/_examples/040.md +1 -0
- data/docs/_examples/041.md +1 -0
- data/docs/_examples/042.md +22 -0
- data/docs/_examples/043.md +40 -0
- data/docs/_examples/044.md +16 -0
- data/docs/_examples/045.md +48 -0
- 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/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/svg/000.svg +29 -29
- data/docs/assets/svg/001.svg +14 -14
- data/docs/assets/svg/002.svg +32 -32
- data/docs/assets/svg/003.svg +24 -24
- data/docs/assets/svg/004.svg +35 -35
- data/docs/assets/svg/005.svg +15 -15
- data/docs/assets/svg/006.svg +20 -20
- data/docs/assets/svg/007.svg +26 -26
- data/docs/assets/svg/008.svg +30 -30
- data/docs/assets/svg/009.svg +29 -29
- data/docs/assets/svg/010.svg +47 -47
- data/docs/assets/svg/011.svg +24 -24
- data/docs/assets/svg/012.svg +29 -29
- data/docs/assets/svg/013.svg +92 -92
- data/docs/assets/svg/014.svg +65 -65
- data/docs/assets/svg/015.svg +28 -28
- data/docs/assets/svg/016.svg +249 -249
- data/docs/assets/svg/017.svg +30 -30
- data/docs/assets/svg/018.svg +32 -32
- data/docs/assets/svg/019.svg +91 -91
- data/docs/assets/svg/020.svg +57 -57
- data/docs/assets/svg/021.svg +37 -37
- data/docs/assets/svg/022.svg +63 -63
- data/docs/assets/svg/023.svg +37 -37
- data/docs/assets/svg/024.svg +18 -18
- data/docs/assets/svg/025.svg +86 -86
- data/docs/assets/svg/026.svg +14 -14
- data/docs/assets/svg/027.svg +44 -44
- data/docs/assets/svg/028.svg +16 -16
- data/docs/assets/svg/029.svg +61 -61
- data/docs/assets/svg/030.svg +29 -29
- data/docs/assets/svg/031.svg +10 -10
- data/docs/assets/svg/032.svg +33 -33
- data/docs/assets/svg/033.svg +32 -32
- data/docs/assets/svg/034.svg +34 -34
- data/docs/assets/svg/035.svg +31 -31
- data/docs/assets/svg/036.svg +11 -11
- data/docs/assets/svg/037.svg +26 -45
- data/docs/assets/svg/038.svg +33 -33
- data/docs/assets/svg/039.svg +2 -2
- data/docs/assets/svg/040.svg +59 -59
- data/docs/assets/svg/041.svg +43 -43
- data/docs/assets/svg/042.svg +42 -0
- data/docs/assets/svg/043.svg +304 -0
- data/docs/assets/svg/044.svg +32 -0
- data/docs/assets/svg/045.svg +107 -0
- data/docs/documentation.md +2 -3
- data/docs/documentation_ja.md +4 -4
- data/fonts/NotoEmoji-Bold.ttf +0 -0
- data/fonts/NotoEmoji-Regular.ttf +0 -0
- data/fonts/OpenMoji-black-glyf.ttf +0 -0
- data/lib/rsyntaxtree/element.rb +7 -8
- data/lib/rsyntaxtree/svg_graph.rb +13 -12
- data/lib/rsyntaxtree/version.rb +1 -1
- data/lib/rsyntaxtree.rb +5 -5
- data/test/example_verify_test.rb +2 -0
- metadata +20 -5
- data/fonts/OpenMoji-Black.ttf +0 -0
- data/fonts/OpenMoji-Color.ttf +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7d8a6a2b95e179e690b36b344723c8af7ddddb060360f17fe80abb58c6299c9
|
4
|
+
data.tar.gz: 01c7911e376559dad3024ec6c31f74fb2736e89273c5ab9932b21d16e2b8444b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b53fd31965002dce84d3ae9442eb0dc1b321ce59f812db5b7ad6d2efab64368deb6cbef91c15e6545116dd96c038a39e02c7cc7c22bbd9f3dde2bbc177092107
|
7
|
+
data.tar.gz: 6a6171f941a771fcea893fbf0b150e3cc9fec6877bcac44080c5ba39547b14016d70e1f1055022f68e8bd257b7cffbb21f127a7a53659174d54a1e66a74f85f0
|
data/.tags
CHANGED
@@ -856,6 +856,7 @@ draw_elements lib/rsyntaxtree/base_graph.rb /^ def draw_elements$/;" f
|
|
856
856
|
draw_elements lib/rsyntaxtree/base_graph.rb /^ def draw_elements$/;" f class:RSyntaxTree.BaseGraph
|
857
857
|
draw_paths lib/rsyntaxtree/svg_graph.rb /^ def draw_paths$/;" f
|
858
858
|
draw_paths lib/rsyntaxtree/svg_graph.rb /^ def draw_paths$/;" f class:RSyntaxTree.SVGGraph
|
859
|
+
draw_png lib/rsyntaxtree.rb /^ def draw_png$/;" f class:RSyntaxTree
|
859
860
|
draw_png lib/rsyntaxtree.rb /^ def draw_png(binary = false)$/;" f class:RSyntaxTree
|
860
861
|
draw_png lib/rsyntaxtree.rb /^ def draw_png(binary = false)$/;" f module:RSyntaxTree
|
861
862
|
draw_rect lib/rsyntaxtree/svg_graph.rb /^ def draw_rect$/;" f
|
data/Rakefile
CHANGED
@@ -15,83 +15,5 @@ end
|
|
15
15
|
|
16
16
|
desc "Generate SVG and PNG example images"
|
17
17
|
task :generate do
|
18
|
-
|
19
|
-
svg_dir = File.expand_path(File.join(__dir__, "docs", "assets", "svg"))
|
20
|
-
png_dir = File.expand_path(File.join(__dir__, "docs", "assets", "img"))
|
21
|
-
Dir.glob("*.md", base: examples_dir).map do |md|
|
22
|
-
md = File.join(examples_dir, md)
|
23
|
-
config = YAML.load_file(md)
|
24
|
-
rst = File.read(md).scan(/```([^`]+)```/m).last.first
|
25
|
-
|
26
|
-
opts = {
|
27
|
-
format: "png",
|
28
|
-
leafstyle: "auto",
|
29
|
-
fontstyle: "sans",
|
30
|
-
fontsize: 16,
|
31
|
-
linewidth: 1,
|
32
|
-
margin: 1,
|
33
|
-
vheight: 2.0,
|
34
|
-
color: "modern",
|
35
|
-
symmetrize: "on",
|
36
|
-
transparent: "off",
|
37
|
-
polyline: "off",
|
38
|
-
hide_default_connectors: "off"
|
39
|
-
}
|
40
|
-
name = nil
|
41
|
-
config.each do |key, value|
|
42
|
-
next if value.to_s == ""
|
43
|
-
|
44
|
-
case key
|
45
|
-
when "name"
|
46
|
-
name = value
|
47
|
-
opts[:name] = name
|
48
|
-
when "color"
|
49
|
-
opts[:color] = case value
|
50
|
-
when "modern", "on", "true"
|
51
|
-
"modern"
|
52
|
-
when "traditional"
|
53
|
-
"traditional"
|
54
|
-
else
|
55
|
-
"off"
|
56
|
-
end
|
57
|
-
when "linewidth", "line_width"
|
58
|
-
opts[:linewidth] = value
|
59
|
-
when "polyline"
|
60
|
-
opts[:polyline] = value
|
61
|
-
when "hide_default_connectors"
|
62
|
-
opts[:hide_default_connectors] = value
|
63
|
-
when "symmetrization"
|
64
|
-
opts[:symmetrize] = value
|
65
|
-
when "connector"
|
66
|
-
opts[:leafstyle] = value
|
67
|
-
when "font"
|
68
|
-
opts[:fontstyle] = case value
|
69
|
-
when /mono/i
|
70
|
-
"mono"
|
71
|
-
when /sans/i
|
72
|
-
"sans"
|
73
|
-
when /serif/i
|
74
|
-
"serif"
|
75
|
-
when /wqy/i
|
76
|
-
"cjk"
|
77
|
-
else
|
78
|
-
"sans"
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
opts[:data] = rst
|
83
|
-
rsg = RSyntaxTree::RSGenerator.new(opts)
|
84
|
-
|
85
|
-
File.open(File.join(svg_dir, "#{name}.svg"), "w") do |f|
|
86
|
-
puts "Creating svg file: #{name}.svg"
|
87
|
-
svg = rsg.draw_svg
|
88
|
-
f.write(svg)
|
89
|
-
end
|
90
|
-
|
91
|
-
File.open(File.join(png_dir, "#{name}.png"), "w") do |f|
|
92
|
-
puts "Creating png file: #{name}.png"
|
93
|
-
png = rsg.draw_png
|
94
|
-
f.write(png)
|
95
|
-
end
|
96
|
-
end
|
18
|
+
require_relative "devel/generate_examples"
|
97
19
|
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
examples_dir = File.expand_path(File.join(__dir__, "..", "docs", "_examples"))
|
5
|
+
svg_dir = File.expand_path(File.join(__dir__, "..", "docs", "assets", "svg"))
|
6
|
+
png_dir = File.expand_path(File.join(__dir__, "..", "docs", "assets", "img"))
|
7
|
+
Dir.glob("*.md", base: examples_dir).map do |md|
|
8
|
+
md = File.join(examples_dir, md)
|
9
|
+
config = YAML.load_file(md)
|
10
|
+
rst = File.read(md).scan(/```([^`]+)```/m).last.first
|
11
|
+
begin
|
12
|
+
RSyntaxTree::RSGenerator.check_data(rst)
|
13
|
+
rescue StandardError => e
|
14
|
+
puts "Error detected in #{md}"
|
15
|
+
pp e
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
|
19
|
+
opts = {
|
20
|
+
format: "png",
|
21
|
+
leafstyle: "auto",
|
22
|
+
fontstyle: "sans",
|
23
|
+
fontsize: 16,
|
24
|
+
linewidth: 1,
|
25
|
+
margin: 1,
|
26
|
+
vheight: 2.0,
|
27
|
+
color: "modern",
|
28
|
+
symmetrize: "on",
|
29
|
+
transparent: "off",
|
30
|
+
polyline: "off",
|
31
|
+
hide_default_connectors: "off"
|
32
|
+
}
|
33
|
+
name = nil
|
34
|
+
config.each do |key, value|
|
35
|
+
next if value.to_s == ""
|
36
|
+
|
37
|
+
case key
|
38
|
+
when "name"
|
39
|
+
name = value
|
40
|
+
opts[:name] = name
|
41
|
+
when "color"
|
42
|
+
opts[:color] = case value
|
43
|
+
when "modern", "on", "true"
|
44
|
+
"modern"
|
45
|
+
when "traditional"
|
46
|
+
"traditional"
|
47
|
+
else
|
48
|
+
"off"
|
49
|
+
end
|
50
|
+
when "linewidth", "line_width"
|
51
|
+
opts[:linewidth] = value
|
52
|
+
when "polyline"
|
53
|
+
opts[:polyline] = value
|
54
|
+
when "hide_default_connectors"
|
55
|
+
opts[:hide_default_connectors] = value
|
56
|
+
when "connector_height"
|
57
|
+
opts[:vheight] = value
|
58
|
+
when "symmetrization"
|
59
|
+
opts[:symmetrize] = value
|
60
|
+
when "connector"
|
61
|
+
opts[:leafstyle] = value
|
62
|
+
when "font"
|
63
|
+
opts[:fontstyle] = case value
|
64
|
+
when /mono/i
|
65
|
+
"mono"
|
66
|
+
when /sans/i
|
67
|
+
"sans"
|
68
|
+
when /serif/i
|
69
|
+
"serif"
|
70
|
+
when /wqy/i
|
71
|
+
"cjk"
|
72
|
+
else
|
73
|
+
"sans"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
opts[:data] = rst
|
78
|
+
rsg = RSyntaxTree::RSGenerator.new(opts)
|
79
|
+
|
80
|
+
File.open(File.join(svg_dir, "#{name}.svg"), "w") do |f|
|
81
|
+
puts "Creating svg file: #{name}.svg"
|
82
|
+
svg = rsg.draw_svg
|
83
|
+
f.write(svg)
|
84
|
+
end
|
85
|
+
|
86
|
+
File.open(File.join(png_dir, "#{name}.png"), "w") do |f|
|
87
|
+
puts "Creating png file: #{name}.png"
|
88
|
+
png = rsg.draw_png
|
89
|
+
f.write(png)
|
90
|
+
end
|
91
|
+
end
|
data/docs/_examples/000.md
CHANGED
data/docs/_examples/001.md
CHANGED
data/docs/_examples/002.md
CHANGED
data/docs/_examples/003.md
CHANGED
data/docs/_examples/004.md
CHANGED
data/docs/_examples/005.md
CHANGED
data/docs/_examples/006.md
CHANGED
data/docs/_examples/007.md
CHANGED
data/docs/_examples/008.md
CHANGED
data/docs/_examples/009.md
CHANGED
data/docs/_examples/010.md
CHANGED
data/docs/_examples/011.md
CHANGED
data/docs/_examples/012.md
CHANGED
data/docs/_examples/013.md
CHANGED
data/docs/_examples/014.md
CHANGED
data/docs/_examples/015.md
CHANGED
data/docs/_examples/016.md
CHANGED
data/docs/_examples/017.md
CHANGED
data/docs/_examples/018.md
CHANGED
data/docs/_examples/019.md
CHANGED
data/docs/_examples/020.md
CHANGED
data/docs/_examples/021.md
CHANGED
data/docs/_examples/022.md
CHANGED
data/docs/_examples/023.md
CHANGED
data/docs/_examples/024.md
CHANGED
data/docs/_examples/025.md
CHANGED
data/docs/_examples/026.md
CHANGED
data/docs/_examples/027.md
CHANGED
data/docs/_examples/028.md
CHANGED
data/docs/_examples/029.md
CHANGED
data/docs/_examples/030.md
CHANGED
data/docs/_examples/031.md
CHANGED
data/docs/_examples/032.md
CHANGED
data/docs/_examples/033.md
CHANGED
data/docs/_examples/034.md
CHANGED
data/docs/_examples/035.md
CHANGED
data/docs/_examples/036.md
CHANGED
data/docs/_examples/037.md
CHANGED
@@ -1,19 +1,21 @@
|
|
1
1
|
---
|
2
2
|
name: "037"
|
3
|
+
caption: "Action chain"
|
3
4
|
color: "modern"
|
4
|
-
category: "
|
5
|
+
category: "Cognitive Grammar"
|
5
6
|
polyline: "off"
|
6
7
|
symmetrization: "on"
|
7
8
|
connector: "auto"
|
8
|
-
|
9
|
+
connector_height: "1"
|
10
|
+
linewidth: "3"
|
9
11
|
hide_default_connectors: "on"
|
10
12
|
font: "Noto Serif"
|
11
|
-
reference:
|
12
13
|
---
|
13
14
|
```
|
14
|
-
[###
|
15
|
+
[###John<>opened<>the<>door<>with<>the<>key\
|
15
16
|
<>\
|
16
|
-
{
|
17
|
+
{}->{}->{}->\
|
17
18
|
<>\
|
18
|
-
|
19
|
+
AGT<>\><>INST<>\><>PAT
|
20
|
+
]
|
19
21
|
```
|
data/docs/_examples/038.md
CHANGED
data/docs/_examples/039.md
CHANGED
data/docs/_examples/040.md
CHANGED
data/docs/_examples/041.md
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
name: "042"
|
3
|
+
caption: "Merge"
|
4
|
+
color: "none"
|
5
|
+
category: "Generative Grammar"
|
6
|
+
polyline: "off"
|
7
|
+
symmetrization: "off"
|
8
|
+
connector: "none"
|
9
|
+
connector_height: "0.5"
|
10
|
+
linewidth: "1"
|
11
|
+
hide_default_connectors: "off"
|
12
|
+
font: "Noto Serif"
|
13
|
+
---
|
14
|
+
```
|
15
|
+
[γ
|
16
|
+
γ
|
17
|
+
[α
|
18
|
+
[α]
|
19
|
+
[β]
|
20
|
+
]
|
21
|
+
]
|
22
|
+
```
|