rsyntaxtree 1.2.12 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Dockerfile +2 -2
- data/README.md +3 -2
- data/Rakefile +1 -1
- data/bin/rsyntaxtree +4 -2
- data/docs/_examples/053.md +41 -0
- data/docs/_layouts/default.html +1 -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/048.png +0 -0
- data/docs/assets/img/049.png +0 -0
- data/docs/assets/img/050.png +0 -0
- data/docs/assets/img/051.png +0 -0
- data/docs/assets/img/052.png +0 -0
- data/docs/assets/img/053.png +0 -0
- data/docs/assets/svg/005.svg +17 -17
- data/docs/assets/svg/011.svg +19 -19
- data/docs/assets/svg/012.svg +17 -17
- data/docs/assets/svg/013.svg +76 -76
- data/docs/assets/svg/026.svg +15 -15
- data/docs/assets/svg/027.svg +46 -46
- data/docs/assets/svg/040.svg +63 -63
- data/docs/assets/svg/053.svg +81 -0
- data/lib/rsyntaxtree/base_graph.rb +1 -1
- data/lib/rsyntaxtree/element.rb +16 -10
- data/lib/rsyntaxtree/elementlist.rb +1 -1
- data/lib/rsyntaxtree/markup_parser.rb +2 -1
- data/lib/rsyntaxtree/string_parser.rb +35 -27
- data/lib/rsyntaxtree/svg_graph.rb +1 -1
- data/lib/rsyntaxtree/utils.rb +1 -1
- data/lib/rsyntaxtree/version.rb +1 -1
- data/lib/rsyntaxtree.rb +1 -3
- data/test/markup_parser_test.rb +7 -0
- metadata +6 -3
data/docs/assets/svg/040.svg
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<?xml version="1.0" standalone="no"?>
|
2
2
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3
|
-
<svg width="
|
3
|
+
<svg width="1519.2" height="1010.25" viewBox="-14.4, 0, 1533.6000000000001, 1021.5" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
4
4
|
<defs>
|
5
5
|
<marker id="arrow" markerUnits="userSpaceOnUse" viewBox="0 0 10 10" refX="10" refY="5" markerWidth="14.4" markerHeight="14.4" orient="auto">
|
6
6
|
<path d="M 0 0 L 10 5 L 0 10" fill="black"/>
|
@@ -24,97 +24,97 @@
|
|
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="-14.4" y="0" width="
|
28
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='
|
29
|
-
<tspan x='
|
30
|
-
<tspan x='
|
31
|
-
<tspan x='
|
27
|
+
<rect x="-14.4" y="0" width="1533.6000000000001" height="1021.5" stroke="none" fill="white" />"
|
28
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='600.3000000000002' y='67.5'><tspan x='780.3000000000002' y='67.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">root</tspan>
|
29
|
+
<tspan x='690.3000000000002' y='112.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">[cons]<tspan style='fill:none;'>■</tspan>[sonor]</tspan>
|
30
|
+
<tspan x='735.3000000000002' y='157.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">stricture</tspan>
|
31
|
+
<tspan x='600.3000000000002' y='202.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">[later]<tspan style='fill:none;'>■</tspan>[strid]<tspan style='fill:none;'>■</tspan>[contin]</tspan>
|
32
32
|
</text>
|
33
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='
|
34
|
-
<tspan x='
|
33
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='315.00000000000006' y='373.5'><tspan x='315.00000000000006' y='373.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">cavity</tspan>
|
34
|
+
<tspan x='333.00000000000006' y='418.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">Oral</tspan>
|
35
35
|
</text>
|
36
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='14.399999999999977' y='
|
37
|
-
<tspan x='
|
36
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='14.399999999999977' y='589.5'><tspan x='14.399999999999977' y='589.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">articulator</tspan>
|
37
|
+
<tspan x='59.39999999999998' y='634.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">Labial</tspan>
|
38
38
|
</text>
|
39
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='
|
40
|
-
<tspan x='
|
41
|
-
<tspan x='
|
39
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='41.40000000000009' y='805.5'><tspan x='41.40000000000009' y='805.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">terminal</tspan>
|
40
|
+
<tspan x='41.40000000000009' y='850.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">features</tspan>
|
41
|
+
<tspan x='50.40000000000009' y='895.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">[round]</tspan>
|
42
42
|
</text>
|
43
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='
|
44
|
-
<tspan x='
|
43
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='270.0000000000001' y='589.5'><tspan x='270.0000000000001' y='589.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">articulator</tspan>
|
44
|
+
<tspan x='306.0000000000001' y='634.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">Coronal</tspan>
|
45
45
|
</text>
|
46
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='
|
47
|
-
<tspan x='
|
48
|
-
<tspan x='
|
49
|
-
<tspan x='
|
46
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='288.0000000000001' y='805.5'><tspan x='297.0000000000001' y='805.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">terminal</tspan>
|
47
|
+
<tspan x='297.0000000000001' y='850.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">features</tspan>
|
48
|
+
<tspan x='306.0000000000001' y='895.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">[anter]</tspan>
|
49
|
+
<tspan x='288.0000000000001' y='940.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">[distrib]</tspan>
|
50
50
|
</text>
|
51
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='
|
52
|
-
<tspan x='
|
51
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='525.6000000000001' y='589.5'><tspan x='525.6000000000001' y='589.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">articulator</tspan>
|
52
|
+
<tspan x='570.6000000000001' y='634.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">Dorsal</tspan>
|
53
53
|
</text>
|
54
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='
|
55
|
-
<tspan x='
|
56
|
-
<tspan x='
|
57
|
-
<tspan x='
|
58
|
-
<tspan x='
|
54
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='552.6000000000001' y='805.5'><tspan x='552.6000000000001' y='805.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">terminal</tspan>
|
55
|
+
<tspan x='552.6000000000001' y='850.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">features</tspan>
|
56
|
+
<tspan x='570.6000000000001' y='895.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">[back]</tspan>
|
57
|
+
<tspan x='570.6000000000001' y='940.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">[high]</tspan>
|
58
|
+
<tspan x='579.6000000000001' y='985.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">[low]</tspan>
|
59
59
|
</text>
|
60
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='
|
61
|
-
<tspan x='
|
60
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='826.2' y='373.5'><tspan x='826.2' y='373.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">cavity</tspan>
|
61
|
+
<tspan x='835.2' y='418.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">Nasal</tspan>
|
62
62
|
</text>
|
63
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='
|
64
|
-
<tspan x='
|
63
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='781.2' y='589.5'><tspan x='781.2' y='589.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">articulator</tspan>
|
64
|
+
<tspan x='781.2' y='634.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">Soft<tspan style='fill:none;'>■</tspan>Palate</tspan>
|
65
65
|
</text>
|
66
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='
|
67
|
-
<tspan x='
|
68
|
-
<tspan x='
|
66
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='808.2' y='805.5'><tspan x='808.2' y='805.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">terminal</tspan>
|
67
|
+
<tspan x='808.2' y='850.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">features</tspan>
|
68
|
+
<tspan x='817.2' y='895.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">[nasal]</tspan>
|
69
69
|
</text>
|
70
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='
|
71
|
-
<tspan x='
|
70
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='1173.6' y='373.5'><tspan x='1209.6' y='373.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">cavity</tspan>
|
71
|
+
<tspan x='1173.6' y='418.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">Pharyngeal</tspan>
|
72
72
|
</text>
|
73
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='
|
74
|
-
<tspan x='
|
73
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='1036.8000000000002' y='589.5'><tspan x='1036.8000000000002' y='589.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">articulator</tspan>
|
74
|
+
<tspan x='1072.8000000000002' y='634.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">Radical</tspan>
|
75
75
|
</text>
|
76
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='
|
77
|
-
<tspan x='
|
78
|
-
<tspan x='
|
79
|
-
<tspan x='
|
76
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='1063.8000000000002' y='805.5'><tspan x='1063.8000000000002' y='805.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">terminal</tspan>
|
77
|
+
<tspan x='1063.8000000000002' y='850.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">features</tspan>
|
78
|
+
<tspan x='1090.8000000000002' y='895.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">[ATR]</tspan>
|
79
|
+
<tspan x='1090.8000000000002' y='940.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">[RTR]</tspan>
|
80
80
|
</text>
|
81
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='
|
82
|
-
<tspan x='
|
81
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='1292.4' y='589.5'><tspan x='1292.4' y='589.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">articulator</tspan>
|
82
|
+
<tspan x='1328.4' y='634.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">Glottal</tspan>
|
83
83
|
</text>
|
84
|
-
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='
|
85
|
-
<tspan x='
|
86
|
-
<tspan x='
|
87
|
-
<tspan x='
|
88
|
-
<tspan x='
|
84
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: black; storoke-width: 0; font-size: 32px;' x='1292.4' y='805.5'><tspan x='1319.4' y='805.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">terminal</tspan>
|
85
|
+
<tspan x='1319.4' y='850.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">features</tspan>
|
86
|
+
<tspan x='1292.4' y='895.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">[spread<tspan style='fill:none;'>■</tspan>gl]</tspan>
|
87
|
+
<tspan x='1292.4' y='940.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">[constr<tspan style='fill:none;'>■</tspan>gl]</tspan>
|
88
|
+
<tspan x='1319.4' y='985.5' style="" text-decoration="" font-family="'Noto Sans Mono SemiCondensed', 'Noto Sans JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', sans-serif">[voiced]</tspan>
|
89
89
|
</text>
|
90
90
|
<polyline style='stroke:black; stroke-width:2; fill:none; stroke-linejoin:round; stroke-linecap:round;'
|
91
|
-
points='
|
91
|
+
points='369.00000000000006 317.25 369.00000000000006 273.9375 816.3000000000001 273.9375 816.3000000000001 230.625' />
|
92
92
|
<polyline style='stroke:black; stroke-width:2; fill:none; stroke-linejoin:round; stroke-linecap:round;'
|
93
|
-
points='
|
93
|
+
points='880.2 317.25 880.2 273.9375 816.3000000000001 273.9375 816.3000000000001 230.625' />
|
94
94
|
<polyline style='stroke:black; stroke-width:2; fill:none; stroke-linejoin:round; stroke-linecap:round;'
|
95
|
-
points='
|
95
|
+
points='1263.6 317.25 1263.6 273.9375 816.3000000000001 273.9375 816.3000000000001 230.625' />
|
96
96
|
<polyline style='stroke:black; stroke-width:2; fill:none; stroke-linejoin:round; stroke-linecap:round;'
|
97
|
-
points='
|
97
|
+
points='113.39999999999998 533.25 113.39999999999998 489.9375 369.00000000000006 489.9375 369.00000000000006 446.625' />
|
98
98
|
<polyline style='stroke:black; stroke-width:2; fill:none; stroke-linejoin:round; stroke-linecap:round;'
|
99
|
-
points='
|
99
|
+
points='369.0000000000001 533.25 369.0000000000001 489.9375 369.00000000000006 489.9375 369.00000000000006 446.625' />
|
100
100
|
<polyline style='stroke:black; stroke-width:2; fill:none; stroke-linejoin:round; stroke-linecap:round;'
|
101
|
-
points='
|
101
|
+
points='624.6000000000001 533.25 624.6000000000001 489.9375 369.00000000000006 489.9375 369.00000000000006 446.625' />
|
102
102
|
<polyline style='stroke:black; stroke-width:2; fill:none; stroke-linejoin:round; stroke-linecap:round;'
|
103
|
-
points='
|
103
|
+
points='113.40000000000009 749.25 113.40000000000009 705.9375 113.39999999999998 705.9375 113.39999999999998 662.625' />
|
104
104
|
<polyline style='stroke:black; stroke-width:2; fill:none; stroke-linejoin:round; stroke-linecap:round;'
|
105
|
-
points='
|
105
|
+
points='369.0000000000001 749.25 369.0000000000001 705.9375 369.0000000000001 705.9375 369.0000000000001 662.625' />
|
106
106
|
<polyline style='stroke:black; stroke-width:2; fill:none; stroke-linejoin:round; stroke-linecap:round;'
|
107
|
-
points='
|
107
|
+
points='624.6000000000001 749.25 624.6000000000001 705.9375 624.6000000000001 705.9375 624.6000000000001 662.625' />
|
108
108
|
<polyline style='stroke:black; stroke-width:2; fill:none; stroke-linejoin:round; stroke-linecap:round;'
|
109
|
-
points='
|
109
|
+
points='880.2 533.25 880.2 489.9375 880.2 489.9375 880.2 446.625' />
|
110
110
|
<polyline style='stroke:black; stroke-width:2; fill:none; stroke-linejoin:round; stroke-linecap:round;'
|
111
|
-
points='
|
111
|
+
points='880.2 749.25 880.2 705.9375 880.2 705.9375 880.2 662.625' />
|
112
112
|
<polyline style='stroke:black; stroke-width:2; fill:none; stroke-linejoin:round; stroke-linecap:round;'
|
113
|
-
points='
|
113
|
+
points='1135.8000000000002 533.25 1135.8000000000002 489.9375 1263.6 489.9375 1263.6 446.625' />
|
114
114
|
<polyline style='stroke:black; stroke-width:2; fill:none; stroke-linejoin:round; stroke-linecap:round;'
|
115
|
-
points='
|
115
|
+
points='1391.4 533.25 1391.4 489.9375 1263.6 489.9375 1263.6 446.625' />
|
116
116
|
<polyline style='stroke:black; stroke-width:2; fill:none; stroke-linejoin:round; stroke-linecap:round;'
|
117
|
-
points='
|
117
|
+
points='1135.8000000000002 749.25 1135.8000000000002 705.9375 1135.8000000000002 705.9375 1135.8000000000002 662.625' />
|
118
118
|
<polyline style='stroke:black; stroke-width:2; fill:none; stroke-linejoin:round; stroke-linecap:round;'
|
119
|
-
points='
|
119
|
+
points='1391.4 749.25 1391.4 705.9375 1391.4 705.9375 1391.4 662.625' />
|
120
120
|
</svg>
|
@@ -0,0 +1,81 @@
|
|
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="847.1999999999999" height="1172.25" viewBox="-16.8, 0, 863.9999999999999, 1183.5" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
4
|
+
<defs>
|
5
|
+
<marker id="arrow" markerUnits="userSpaceOnUse" viewBox="0 0 10 10" refX="10" refY="5" markerWidth="16.8" markerHeight="16.8" orient="auto">
|
6
|
+
<path d="M 0 0 L 10 5 L 0 10" fill="#CC79A7"/>
|
7
|
+
</marker>
|
8
|
+
<marker id="arrowBackward" markerUnits="userSpaceOnUse" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="16.8" markerHeight="16.8" orient="auto">
|
9
|
+
<path d="M 0 0 L 10 5 L 0 10 z" fill="#CC79A7"/>
|
10
|
+
</marker>
|
11
|
+
<marker id="arrowForward" markerUnits="userSpaceOnUse" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="16.8" markerHeight="16.8" orient="auto">
|
12
|
+
<path d="M 10 0 L 0 5 L 10 10 z" fill="#CC79A7"/>
|
13
|
+
</marker>
|
14
|
+
<marker id="arrowBothways" markerUnits="userSpaceOnUse" viewBox="0 0 30 10" refX="15" refY="5" markerWidth="50.400000000000006" markerHeight="16.8" orient="auto">
|
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="#CC79A7"/>
|
16
|
+
</marker>
|
17
|
+
<pattern id="hatchBlack" 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
|
+
<pattern id="hatchForNode" x="10" y="10" width="10" height="10" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
|
21
|
+
<line x1="0" y="0" x2="0" y2="10" stroke="#0072B2" stroke-width="4"></line>
|
22
|
+
</pattern>
|
23
|
+
<pattern id="hatchForLeaf" x="10" y="10" width="10" height="10" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
|
24
|
+
<line x1="0" y="0" x2="0" y2="10" stroke="#009E73" stroke-width="4"></line>
|
25
|
+
</pattern>
|
26
|
+
</defs>
|
27
|
+
<rect x="-16.8" y="0" width="863.9999999999999" height="1183.5" stroke="none" fill="white" />"
|
28
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #0072B2; storoke-width: 0; font-size: 32px;' x='147.275' y='67.5'><tspan x='147.275' y='67.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">expr</tspan>
|
29
|
+
</text>
|
30
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #0072B2; storoke-width: 0; font-size: 32px;' x='16.80000000000001' y='283.5'><tspan x='16.80000000000001' y='283.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">id</tspan>
|
31
|
+
</text>
|
32
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #009E73; storoke-width: 0; font-size: 32px;' x='22.30000000000001' y='499.5'><tspan x='22.30000000000001' y='499.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">x</tspan>
|
33
|
+
</text>
|
34
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #0072B2; storoke-width: 0; font-size: 32px;' x='290.25' y='283.5'><tspan x='290.25' y='283.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">suffix</tspan>
|
35
|
+
</text>
|
36
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #009E73; storoke-width: 0; font-size: 32px;' x='114.0' y='499.5'><tspan x='114.0' y='499.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">[</tspan>
|
37
|
+
</text>
|
38
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #0072B2; storoke-width: 0; font-size: 32px;' x='193.19999999999996' y='499.5'><tspan x='193.19999999999996' y='499.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">id</tspan>
|
39
|
+
</text>
|
40
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #009E73; storoke-width: 0; font-size: 32px;' x='199.19999999999996' y='715.5'><tspan x='199.19999999999996' y='715.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">2</tspan>
|
41
|
+
</text>
|
42
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #009E73; storoke-width: 0; font-size: 32px;' x='290.4' y='499.5'><tspan x='290.4' y='499.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">]</tspan>
|
43
|
+
</text>
|
44
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #0072B2; storoke-width: 0; font-size: 32px;' x='504.0' y='499.5'><tspan x='504.0' y='499.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">suffix</tspan>
|
45
|
+
</text>
|
46
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #009E73; storoke-width: 0; font-size: 32px;' x='369.59999999999997' y='715.5'><tspan x='369.59999999999997' y='715.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">[</tspan>
|
47
|
+
</text>
|
48
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #0072B2; storoke-width: 0; font-size: 32px;' x='448.79999999999995' y='715.5'><tspan x='448.79999999999995' y='715.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">id</tspan>
|
49
|
+
</text>
|
50
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #009E73; storoke-width: 0; font-size: 32px;' x='454.79999999999995' y='931.5'><tspan x='454.79999999999995' y='931.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">3</tspan>
|
51
|
+
</text>
|
52
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #009E73; storoke-width: 0; font-size: 32px;' x='546.0' y='715.5'><tspan x='546.0' y='715.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">]</tspan>
|
53
|
+
</text>
|
54
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #0072B2; storoke-width: 0; font-size: 32px;' x='675.9' y='715.5'><tspan x='675.9' y='715.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">suffix</tspan>
|
55
|
+
</text>
|
56
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #009E73; storoke-width: 0; font-size: 32px;' x='625.1999999999999' y='931.5'><tspan x='625.1999999999999' y='931.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">[</tspan>
|
57
|
+
</text>
|
58
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #0072B2; storoke-width: 0; font-size: 32px;' x='704.4' y='931.5'><tspan x='704.4' y='931.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">id</tspan>
|
59
|
+
</text>
|
60
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #009E73; storoke-width: 0; font-size: 32px;' x='710.4' y='1147.5'><tspan x='710.4' y='1147.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">4</tspan>
|
61
|
+
</text>
|
62
|
+
<text white-space='pre' alignment-baseline='text-top' style='fill: #009E73; storoke-width: 0; font-size: 32px;' x='801.5999999999999' y='931.5'><tspan x='801.5999999999999' y='931.5' style="" text-decoration="" font-family="'Noto Serif', 'Noto Serif JP', OpenMoji, 'OpenMoji Color', 'OpenMoji Black', serif">]</tspan>
|
63
|
+
</text>
|
64
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='31.80000000000001' y1='227.25' x2='182.775' y2='95.625' />
|
65
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='333.75' y1='227.25' x2='182.775' y2='95.625' />
|
66
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='31.80000000000001' y1='443.25' x2='31.80000000000001' y2='311.625' />
|
67
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='120.0' y1='443.25' x2='333.75' y2='311.625' />
|
68
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='208.19999999999996' y1='443.25' x2='333.75' y2='311.625' />
|
69
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='296.4' y1='443.25' x2='333.75' y2='311.625' />
|
70
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='547.5' y1='443.25' x2='333.75' y2='311.625' />
|
71
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='208.19999999999996' y1='659.25' x2='208.19999999999996' y2='527.625' />
|
72
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='375.59999999999997' y1='659.25' x2='547.5' y2='527.625' />
|
73
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='463.79999999999995' y1='659.25' x2='547.5' y2='527.625' />
|
74
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='552.0' y1='659.25' x2='547.5' y2='527.625' />
|
75
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='719.4' y1='659.25' x2='547.5' y2='527.625' />
|
76
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='463.79999999999995' y1='875.25' x2='463.79999999999995' y2='743.625' />
|
77
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='631.1999999999999' y1='875.25' x2='719.4' y2='743.625' />
|
78
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='719.4' y1='875.25' x2='719.4' y2='743.625' />
|
79
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='807.5999999999999' y1='875.25' x2='719.4' y2='743.625' />
|
80
|
+
<line style='fill: none; stroke:black; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;' x1='719.4' y1='1091.25' x2='719.4' y2='959.625' />
|
81
|
+
</svg>
|
data/lib/rsyntaxtree/element.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
#==========================
|
6
6
|
#
|
7
7
|
# Aa class that represents a basic tree element, either node or leaf.
|
8
|
-
# Copyright (c) 2007-
|
8
|
+
# Copyright (c) 2007-2024 Yoichiro Hasebe <yohasebe@gmail.com>
|
9
9
|
|
10
10
|
require_relative "markup_parser"
|
11
11
|
require_relative "utils"
|
@@ -70,7 +70,12 @@ module RSyntaxTree
|
|
70
70
|
elements_height = []
|
71
71
|
content[:elements].each do |e|
|
72
72
|
text = e[:text]
|
73
|
-
|
73
|
+
# エスケープされた角括弧の処理
|
74
|
+
text = text.gsub('\\[', '[')
|
75
|
+
.gsub('\\]', ']')
|
76
|
+
e[:text] = text.gsub(" ", WHITESPACE_BLOCK)
|
77
|
+
.gsub(">", '>')
|
78
|
+
.gsub("<", '<')
|
74
79
|
|
75
80
|
@contains_phrase = true if text.include?(" ")
|
76
81
|
decoration = e[:decoration]
|
@@ -103,10 +108,10 @@ module RSyntaxTree
|
|
103
108
|
seg[:char]
|
104
109
|
end
|
105
110
|
this_font = if seg[:type] == :emoji
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
111
|
+
@fontset[:emoji]
|
112
|
+
else
|
113
|
+
font
|
114
|
+
end
|
110
115
|
metrics = FontMetrics.get_metrics(ch, this_font, fontsize, style, weight)
|
111
116
|
width += metrics.width
|
112
117
|
end
|
@@ -119,13 +124,14 @@ module RSyntaxTree
|
|
119
124
|
width = metrics.width
|
120
125
|
end
|
121
126
|
|
127
|
+
# 以下は変更なし
|
122
128
|
if e[:decoration].include?(:box) || e[:decoration].include?(:circle) || e[:decoration].include?(:bar)
|
123
129
|
e[:content_width] = width
|
124
130
|
width += if e[:text].size == 1
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
131
|
+
height - width
|
132
|
+
else
|
133
|
+
@global[:width_half_x]
|
134
|
+
end
|
129
135
|
end
|
130
136
|
|
131
137
|
if e[:decoration].include?(:whitespace)
|
@@ -5,7 +5,7 @@
|
|
5
5
|
#==========================
|
6
6
|
#
|
7
7
|
# Contains a list of unordered tree elements with a defined parent
|
8
|
-
# Copyright (c) 2007-
|
8
|
+
# Copyright (c) 2007-2024 Yoichiro Hasebe <yohasebe@gmail.com>
|
9
9
|
|
10
10
|
require_relative "element"
|
11
11
|
|
@@ -14,7 +14,8 @@ class MarkupParser < Parslet::Parser
|
|
14
14
|
rule(:triangle) { str('^') }
|
15
15
|
|
16
16
|
rule(:path) { (str('+') >> str('-').maybe >> (str('>') | str('<')).maybe >> match('\d').repeat(1)).as(:path) }
|
17
|
-
rule(:escaped) { str('\\') >> match('[#<>{}\\^+*_=~\|\n\-]').as(:chr) }
|
17
|
+
# rule(:escaped) { str('\\') >> match('[#<>{}\\^+*_=~\|\n\-]').as(:chr) }
|
18
|
+
rule(:escaped) { str('\\') >> match('[#<>{}\\\\^+*_=~\\|\\n\\-\\[\\]]').as(:chr) }
|
18
19
|
rule(:non_escaped) { ((match('[#<>{}\\^+*_=~\|\-]') | str('\\n')).absent? >> any).as(:chr) }
|
19
20
|
rule(:text) { (escaped | non_escaped).repeat(1).as(:text) }
|
20
21
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#
|
7
7
|
# Parses a phrase into leafs and nodes and store the result in an element list
|
8
8
|
# (see element_list.rb)
|
9
|
-
# Copyright (c) 2007-
|
9
|
+
# Copyright (c) 2007-2024 Yoichiro Hasebe <yohasebe@gmail.com>
|
10
10
|
|
11
11
|
require_relative 'elementlist'
|
12
12
|
require_relative 'element'
|
@@ -112,11 +112,11 @@ module RSyntaxTree
|
|
112
112
|
|
113
113
|
escape = false
|
114
114
|
while ((@pos + i) < data.length) && !gottoken
|
115
|
-
ch = data[@pos + i]
|
115
|
+
ch = data[@pos + i]
|
116
116
|
case ch
|
117
117
|
when "["
|
118
118
|
if escape
|
119
|
-
token +=
|
119
|
+
token += '\\[' # エスケープされた角括弧として保持
|
120
120
|
escape = false
|
121
121
|
elsif i.positive?
|
122
122
|
gottoken = true
|
@@ -125,7 +125,7 @@ module RSyntaxTree
|
|
125
125
|
end
|
126
126
|
when "]"
|
127
127
|
if escape
|
128
|
-
token +=
|
128
|
+
token += '\\]' # エスケープされた角括弧として保持
|
129
129
|
escape = false
|
130
130
|
else
|
131
131
|
token += ch if i.zero?
|
@@ -179,33 +179,41 @@ module RSyntaxTree
|
|
179
179
|
token_r = token.split(//)
|
180
180
|
case token_r[0]
|
181
181
|
when "["
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
if spaceat
|
188
|
-
parts[0] = token_r[0, spaceat].join
|
189
|
-
|
190
|
-
tl = token_r.length
|
191
|
-
parts[1] = token_r[spaceat, tl - spaceat].join
|
192
|
-
|
193
|
-
element = Element.new(@id, parent, parts[0], @level, @fontset, @fontsize, @global)
|
182
|
+
# エスケープされた角括弧をチェック
|
183
|
+
if token =~ /\A\\\[/ || token =~ /\A\\\]/
|
184
|
+
# エスケープされた角括弧の場合は通常のテキストとして扱う
|
185
|
+
element = Element.new(@id, parent, token, @level, @fontset, @fontsize, @global)
|
194
186
|
@id += 1
|
195
187
|
@elist.add(element)
|
196
|
-
newparent = element.id
|
197
|
-
|
198
|
-
element = Element.new(@id, @id - 1, parts[1], @level + 1, @fontset, @fontsize, @global)
|
199
|
-
@id += 1
|
200
188
|
else
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
189
|
+
# 以下、既存の処理
|
190
|
+
tl = token_r.length
|
191
|
+
token_r = token_r[1, tl - 1]
|
192
|
+
spaceat = token_r.index(" ")
|
193
|
+
newparent = -1
|
194
|
+
|
195
|
+
if spaceat
|
196
|
+
parts[0] = token_r[0, spaceat].join
|
197
|
+
tl = token_r.length
|
198
|
+
parts[1] = token_r[spaceat, tl - spaceat].join
|
199
|
+
|
200
|
+
element = Element.new(@id, parent, parts[0], @level, @fontset, @fontsize, @global)
|
201
|
+
@id += 1
|
202
|
+
@elist.add(element)
|
203
|
+
newparent = element.id
|
204
|
+
|
205
|
+
element = Element.new(@id, @id - 1, parts[1], @level + 1, @fontset, @fontsize, @global)
|
206
|
+
@id += 1
|
207
|
+
else
|
208
|
+
joined = token_r.join
|
209
|
+
element = Element.new(@id, parent, joined, @level, @fontset, @fontsize, @global)
|
210
|
+
@id += 1
|
211
|
+
newparent = element.id
|
212
|
+
end
|
213
|
+
@elist.add(element)
|
214
|
+
@level += 1
|
215
|
+
make_tree(newparent)
|
205
216
|
end
|
206
|
-
@elist.add(element)
|
207
|
-
@level += 1
|
208
|
-
make_tree(newparent)
|
209
217
|
else
|
210
218
|
if token.strip != ""
|
211
219
|
element = Element.new(@id, parent, token, @level, @fontset, @fontsize, @global)
|
data/lib/rsyntaxtree/utils.rb
CHANGED
data/lib/rsyntaxtree/version.rb
CHANGED
data/lib/rsyntaxtree.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
#
|
7
7
|
# Facade of rsyntaxtree library. When loaded by a driver script, it does all
|
8
8
|
# the necessary 'require' to use the library.
|
9
|
-
# Copyright (c) 2007-
|
9
|
+
# Copyright (c) 2007-2024 Yoichiro Hasebe <yohasebe@gmail.com>
|
10
10
|
|
11
11
|
FONT_DIR = File.expand_path(File.join(__dir__, "/../fonts"))
|
12
12
|
ETYPE_NODE = 1
|
@@ -66,8 +66,6 @@ module RSyntaxTree
|
|
66
66
|
.gsub('-CABRACKET-', '>')
|
67
67
|
.gsub('¥¥', '\¥')
|
68
68
|
.gsub(/(?<!\\)¥/, "\\")
|
69
|
-
.gsub(/\\\[/, "[")
|
70
|
-
.gsub(/\\\]/, "]")
|
71
69
|
new_params[key] = data
|
72
70
|
|
73
71
|
when :symmetrize, :transparent, :polyline, :hide_default_connectors
|
data/test/markup_parser_test.rb
CHANGED
@@ -207,4 +207,11 @@ class MarkupParserTest < Minitest::Test
|
|
207
207
|
Markup.parse text2
|
208
208
|
# {:status=>:error, :text=>"!^#----\\n\\nX_Y_Z+1+>2"}
|
209
209
|
end
|
210
|
+
|
211
|
+
def test_escaped_brackets
|
212
|
+
text = "[expr [id x] [suffix \\[ [id 2] \\] ] ]"
|
213
|
+
@parser = MarkupParser.new
|
214
|
+
@parser.parse(text)
|
215
|
+
assert true
|
216
|
+
end
|
210
217
|
end
|