rsyntaxtree 0.9.3 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.tags +203 -0
- data/Gemfile +2 -0
- data/README.md +0 -1
- data/Rakefile +7 -0
- data/bin/rsyntaxtree +38 -31
- data/fonts/OpenMoji-Black.ttf +0 -0
- data/fonts/OpenMoji-Color.ttf +0 -0
- data/lib/rsyntaxtree/base_graph.rb +262 -0
- data/lib/rsyntaxtree/element.rb +155 -25
- data/lib/rsyntaxtree/elementlist.rb +16 -13
- data/lib/rsyntaxtree/markup_parser.rb +208 -0
- data/lib/rsyntaxtree/string_parser.rb +190 -204
- data/lib/rsyntaxtree/svg_graph.rb +445 -299
- data/lib/rsyntaxtree/utils.rb +49 -6
- data/lib/rsyntaxtree/version.rb +1 -1
- data/lib/rsyntaxtree.rb +143 -161
- data/rsyntaxtree.gemspec +2 -0
- data/test/markup_parser_test.rb +207 -0
- metadata +37 -11
- data/fonts/latinmodern-math.otf +0 -0
- data/fonts/lmroman10-bold.otf +0 -0
- data/fonts/lmroman10-bolditalic.otf +0 -0
- data/fonts/lmroman10-italic.otf +0 -0
- data/fonts/lmroman10-regular.otf +0 -0
- data/lib/rsyntaxtree/error_message.rb +0 -68
- data/lib/rsyntaxtree/graph.rb +0 -312
- data/lib/rsyntaxtree/tree_graph.rb +0 -327
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 367738898f18593ef463368c3203863952240e77c1fc892c9dd6260c7cfcbde2
|
4
|
+
data.tar.gz: 86e4f14055f98284df6833e4d6034d3e335402233bf7ac8e000a13366ec75415
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99f61da825f4c0bac2aca4c2fbe5a18771385d3b9195b1fd764b88fedd361f75fca4723e945a1f8c81f0f91bdb4f7e140936874d724917a8c9edacddbc6b1d81
|
7
|
+
data.tar.gz: e180768322aae5e6aa7f66b746091b8c7c60c635ef9930a17dd275b218c99e592aba01b4b4d565623df281ef5043cb74e4da80c0473506a16f03251da0174a75
|
data/.gitignore
CHANGED
data/.tags
ADDED
@@ -0,0 +1,203 @@
|
|
1
|
+
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
|
2
|
+
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
|
3
|
+
!_TAG_OUTPUT_EXCMD mixed /number, pattern, mixed, or combineV2/
|
4
|
+
!_TAG_OUTPUT_FILESEP slash /slash or backslash/
|
5
|
+
!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/
|
6
|
+
!_TAG_PATTERN_LENGTH_LIMIT 96 /0 for no limit/
|
7
|
+
!_TAG_PROC_CWD /Users/yohasebe/Dropbox/code/rsyntaxtree/ //
|
8
|
+
!_TAG_PROGRAM_AUTHOR Universal Ctags Team //
|
9
|
+
!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/
|
10
|
+
!_TAG_PROGRAM_URL https://ctags.io/ /official site/
|
11
|
+
!_TAG_PROGRAM_VERSION 5.9.0 /60650fac/
|
12
|
+
Author README.md /^### Author$/;" S chapter:🌲 RSyntaxTree: yet another syntax tree generator in Ruby
|
13
|
+
BaseGraph lib/rsyntaxtree/base_graph.rb /^ class BaseGraph$/;" c class:RSyntaxTree
|
14
|
+
BaseGraph lib/rsyntaxtree/base_graph.rb /^ class BaseGraph$/;" c module:RSyntaxTree
|
15
|
+
Development README.md /^### Development$/;" S chapter:🌲 RSyntaxTree: yet another syntax tree generator in Ruby
|
16
|
+
ETYPE_LEAF lib/rsyntaxtree.rb /^ ETYPE_LEAF = 2$/;" C module:RSyntaxTree
|
17
|
+
ETYPE_NODE lib/rsyntaxtree.rb /^ ETYPE_NODE = 1$/;" C module:RSyntaxTree
|
18
|
+
Element lib/rsyntaxtree/element.rb /^ class Element$/;" c class:RSyntaxTree
|
19
|
+
Element lib/rsyntaxtree/element.rb /^ class Element$/;" c module:RSyntaxTree
|
20
|
+
ElementList lib/rsyntaxtree/elementlist.rb /^ class ElementList$/;" c class:RSyntaxTree
|
21
|
+
ElementList lib/rsyntaxtree/elementlist.rb /^ class ElementList$/;" c module:RSyntaxTree
|
22
|
+
Example README.md /^### Example$/;" S chapter:🌲 RSyntaxTree: yet another syntax tree generator in Ruby
|
23
|
+
FONT_DIR lib/rsyntaxtree.rb /^ FONT_DIR = File.expand_path(File.dirname(__FILE__) + "\/..\/fonts")$/;" C module:RSyntaxTree
|
24
|
+
FONT_SCALING lib/rsyntaxtree.rb /^ FONT_SCALING = 2$/;" C module:RSyntaxTree
|
25
|
+
FontMetrics lib/rsyntaxtree/utils.rb /^module FontMetrics$/;" m
|
26
|
+
HEIGHT_CONNECTOR_TO_TEXT lib/rsyntaxtree.rb /^ HEIGHT_CONNECTOR_TO_TEXT = 15$/;" C module:RSyntaxTree
|
27
|
+
Installation README.md /^### Installation$/;" S chapter:🌲 RSyntaxTree: yet another syntax tree generator in Ruby
|
28
|
+
License README.md /^### License$/;" S chapter:🌲 RSyntaxTree: yet another syntax tree generator in Ruby
|
29
|
+
Markup lib/rsyntaxtree/markup_parser.rb /^module Markup$/;" m
|
30
|
+
MarkupParser lib/rsyntaxtree/markup_parser.rb /^class MarkupParser < Parslet::Parser$/;" c
|
31
|
+
MarkupParserTest test/markup_parser_test.rb /^class MarkupParserTest < Minitest::Test$/;" c
|
32
|
+
RSGenerator lib/rsyntaxtree.rb /^ class RSGenerator$/;" c class:RSyntaxTree
|
33
|
+
RSGenerator lib/rsyntaxtree.rb /^ class RSGenerator$/;" c module:RSyntaxTree
|
34
|
+
RSTError lib/rsyntaxtree.rb /^ class RSTError < StandardError$/;" c class:RSyntaxTree
|
35
|
+
RSTError lib/rsyntaxtree.rb /^class RSTError < StandardError$/;" c
|
36
|
+
RSTError lib/rsyntaxtree/string_parser.rb /^ class RSTError < StandardError$/;" c class:RSyntaxTree
|
37
|
+
RSTError lib/rsyntaxtree/string_parser.rb /^class RSTError < StandardError$/;" c
|
38
|
+
RSTError lib/rsyntaxtree/utils.rb /^class RSTError < StandardError$/;" c
|
39
|
+
RSyntaxTree lib/rsyntaxtree.rb /^module RSyntaxTree$/;" m
|
40
|
+
RSyntaxTree lib/rsyntaxtree/base_graph.rb /^module RSyntaxTree$/;" m
|
41
|
+
RSyntaxTree lib/rsyntaxtree/element.rb /^module RSyntaxTree$/;" m
|
42
|
+
RSyntaxTree lib/rsyntaxtree/elementlist.rb /^module RSyntaxTree$/;" m
|
43
|
+
RSyntaxTree lib/rsyntaxtree/string_parser.rb /^module RSyntaxTree$/;" m
|
44
|
+
RSyntaxTree lib/rsyntaxtree/svg_graph.rb /^module RSyntaxTree$/;" m
|
45
|
+
RSyntaxTree lib/rsyntaxtree/version.rb /^module RSyntaxTree$/;" m
|
46
|
+
SUBSCRIPT_CONST lib/rsyntaxtree.rb /^ SUBSCRIPT_CONST = 0.6$/;" C module:RSyntaxTree
|
47
|
+
SVGGraph lib/rsyntaxtree/svg_graph.rb /^ class SVGGraph < BaseGraph$/;" c class:RSyntaxTree
|
48
|
+
SVGGraph lib/rsyntaxtree/svg_graph.rb /^ class SVGGraph < BaseGraph$/;" c module:RSyntaxTree
|
49
|
+
String lib/rsyntaxtree/utils.rb /^class String$/;" c
|
50
|
+
StringParser lib/rsyntaxtree/string_parser.rb /^ class StringParser$/;" c class:RSyntaxTree
|
51
|
+
StringParser lib/rsyntaxtree/string_parser.rb /^ class StringParser$/;" c module:RSyntaxTree
|
52
|
+
Tips README.md /^### Tips$/;" S chapter:🌲 RSyntaxTree: yet another syntax tree generator in Ruby
|
53
|
+
Usage README.md /^### Usage$/;" S chapter:🌲 RSyntaxTree: yet another syntax tree generator in Ruby
|
54
|
+
VERSION lib/rsyntaxtree/version.rb /^ VERSION = "1.0.1"$/;" C module:RSyntaxTree
|
55
|
+
Web Interface README.md /^### Web Interface$/;" S chapter:🌲 RSyntaxTree: yet another syntax tree generator in Ruby
|
56
|
+
add lib/rsyntaxtree/elementlist.rb /^ def add(element)$/;" f class:RSyntaxTree.ElementList
|
57
|
+
add_child lib/rsyntaxtree/element.rb /^ def add_child(child_id)$/;" f class:RSyntaxTree
|
58
|
+
add_child lib/rsyntaxtree/element.rb /^ def add_child(child_id)$/;" f class:RSyntaxTree.Element
|
59
|
+
all_emoji? lib/rsyntaxtree/utils.rb /^ def all_emoji?$/;" f class:String
|
60
|
+
calculate_height lib/rsyntaxtree/base_graph.rb /^ def calculate_height(id = 1)$/;" f class:RSyntaxTree.BaseGraph
|
61
|
+
calculate_indent lib/rsyntaxtree/base_graph.rb /^ def calculate_indent$/;" f class:RSyntaxTree.BaseGraph
|
62
|
+
calculate_level lib/rsyntaxtree/base_graph.rb /^ def calculate_level$/;" f class:RSyntaxTree.BaseGraph
|
63
|
+
calculate_width lib/rsyntaxtree/base_graph.rb /^ def calculate_width(id = 1)$/;" f class:RSyntaxTree.BaseGraph
|
64
|
+
check_data lib/rsyntaxtree.rb /^ def self.check_data(text)$/;" F class:RSyntaxTree.RSGenerator
|
65
|
+
check_data lib/rsyntaxtree.rb /^ def self.check_data(text)$/;" S class:RSyntaxTree.RSGenerator
|
66
|
+
contains_cjk? lib/rsyntaxtree/utils.rb /^ def contains_cjk?$/;" f class:String
|
67
|
+
contains_emoji? lib/rsyntaxtree/utils.rb /^ def contains_emoji?$/;" f class:String
|
68
|
+
data lib/rsyntaxtree/string_parser.rb /^ attr_accessor :data, :elist, :pos, :id, :level$/;" A class:RSyntaxTree.StringParser
|
69
|
+
data= lib/rsyntaxtree/string_parser.rb /^ attr_accessor :data, :elist, :pos, :id, :level$/;" A class:RSyntaxTree.StringParser
|
70
|
+
draw_a_path lib/rsyntaxtree/svg_graph.rb /^ def draw_a_path(s_x, s_y, t_x, t_y, target_arrow = :none)$/;" f class:RSyntaxTree.SVGGraph
|
71
|
+
draw_connector lib/rsyntaxtree/base_graph.rb /^ def draw_connector(id = 1)$/;" f class:RSyntaxTree.BaseGraph
|
72
|
+
draw_element lib/rsyntaxtree/svg_graph.rb /^ def draw_element(element)$/;" f class:RSyntaxTree.SVGGraph
|
73
|
+
draw_elements lib/rsyntaxtree/base_graph.rb /^ def draw_elements$/;" f class:RSyntaxTree.BaseGraph
|
74
|
+
draw_paths lib/rsyntaxtree/svg_graph.rb /^ def draw_paths$/;" f class:RSyntaxTree
|
75
|
+
draw_paths lib/rsyntaxtree/svg_graph.rb /^ def draw_paths$/;" f class:RSyntaxTree.SVGGraph
|
76
|
+
draw_paths lib/rsyntaxtree/svg_graph.rb /^ def draw_paths$/;" f class:RSyntaxTree.SVGGraph.draw_element
|
77
|
+
draw_paths lib/rsyntaxtree/svg_graph.rb /^ def draw_paths$/;" f class:RSyntaxTree.SVGGraph.set_tspan
|
78
|
+
draw_png lib/rsyntaxtree.rb /^ def draw_png(binary = false)$/;" f class:RSyntaxTree.RSGenerator
|
79
|
+
draw_svg lib/rsyntaxtree.rb /^ def draw_svg$/;" f class:RSyntaxTree.RSGenerator
|
80
|
+
draw_tree lib/rsyntaxtree.rb /^ def draw_tree$/;" f class:RSyntaxTree.RSGenerator
|
81
|
+
elements lib/rsyntaxtree/elementlist.rb /^ attr_accessor :elements, :iterator $/;" A class:RSyntaxTree.ElementList
|
82
|
+
elements= lib/rsyntaxtree/elementlist.rb /^ attr_accessor :elements, :iterator $/;" A class:RSyntaxTree.ElementList
|
83
|
+
elist lib/rsyntaxtree/string_parser.rb /^ attr_accessor :data, :elist, :pos, :id, :level$/;" A class:RSyntaxTree.StringParser
|
84
|
+
elist= lib/rsyntaxtree/string_parser.rb /^ attr_accessor :data, :elist, :pos, :id, :level$/;" A class:RSyntaxTree.StringParser
|
85
|
+
generate_line lib/rsyntaxtree/svg_graph.rb /^ def generate_line(x1, y1, x2, y2, col, dashed = false, arrow = false)$/;" f class:RSyntaxTree
|
86
|
+
generate_line lib/rsyntaxtree/svg_graph.rb /^ def generate_line(x1, y1, x2, y2, col, dashed = false, arrow = false)$/;" f class:RSyntaxTree.SVGGraph
|
87
|
+
generate_line lib/rsyntaxtree/svg_graph.rb /^ def generate_line(x1, y1, x2, y2, col, dashed = false, arrow = false)$/;" f class:RSyntaxTree.SVGGraph.draw_element
|
88
|
+
generate_line lib/rsyntaxtree/svg_graph.rb /^ def generate_line(x1, y1, x2, y2, col, dashed = false, arrow = false)$/;" f class:RSyntaxTree.SVGGraph.set_tspan
|
89
|
+
generate_line lib/rsyntaxtree/svg_graph.rb /^ def generate_line(x1, y1, x2, y2, col, dashed = false, arrow = false, stroke_width = 1)$/;" f class:RSyntaxTree.SVGGraph
|
90
|
+
generate_line lib/rsyntaxtree/svg_graph.rb /^ def generate_line(x1, y1, x2, y2, col, dashed = false, arrow = false, stroke_width = 2)$/;" f class:RSyntaxTree.SVGGraph
|
91
|
+
get_child_count lib/rsyntaxtree/elementlist.rb /^ def get_child_count(id)$/;" f class:RSyntaxTree.ElementList
|
92
|
+
get_children lib/rsyntaxtree/elementlist.rb /^ def get_children(id)$/;" f class:RSyntaxTree.ElementList
|
93
|
+
get_element_width lib/rsyntaxtree/elementlist.rb /^ def get_element_width(id)$/;" f class:RSyntaxTree.ElementList
|
94
|
+
get_elementlist lib/rsyntaxtree/string_parser.rb /^ def get_elementlist$/;" f class:RSyntaxTree.StringParser
|
95
|
+
get_elementlist lib/rsyntaxtree/string_parser.rb /^ def get_elementlist$/;" f class:RSyntaxTree.StringParser.initialize
|
96
|
+
get_elements lib/rsyntaxtree/elementlist.rb /^ def get_elements$/;" f class:RSyntaxTree.ElementList
|
97
|
+
get_first lib/rsyntaxtree/elementlist.rb /^ def get_first$/;" f class:RSyntaxTree.ElementList
|
98
|
+
get_id lib/rsyntaxtree/elementlist.rb /^ def get_id(id)$/;" f class:RSyntaxTree.ElementList
|
99
|
+
get_indent lib/rsyntaxtree/elementlist.rb /^ def get_indent(id)$/;" f class:RSyntaxTree.ElementList
|
100
|
+
get_leftmost lib/rsyntaxtree/base_graph.rb /^ def get_leftmost(id = 1)$/;" f class:RSyntaxTree.BaseGraph
|
101
|
+
get_level_height lib/rsyntaxtree/elementlist.rb /^ def get_level_height$/;" f class:RSyntaxTree.ElementList
|
102
|
+
get_metrics lib/rsyntaxtree/utils.rb /^ def get_metrics(text, font, fontsize, font_style, font_weight)$/;" f class:FontMetrics
|
103
|
+
get_metrics lib/rsyntaxtree/utils.rb /^ def get_metrics(text, font, fontsize, font_style, font_weight)$/;" f module:FontMetrics
|
104
|
+
get_next lib/rsyntaxtree/elementlist.rb /^ def get_next$/;" f class:RSyntaxTree.ElementList
|
105
|
+
get_next_token lib/rsyntaxtree/string_parser.rb /^ def get_next_token$/;" f class:RSyntaxTree.StringParser
|
106
|
+
get_next_token lib/rsyntaxtree/string_parser.rb /^ def get_next_token$/;" f class:RSyntaxTree.StringParser.initialize
|
107
|
+
get_rightmost lib/rsyntaxtree/base_graph.rb /^ def get_rightmost(id = 1)$/;" f class:RSyntaxTree.BaseGraph
|
108
|
+
height lib/rsyntaxtree/svg_graph.rb /^ attr_accessor :width, :height$/;" A class:RSyntaxTree.SVGGraph
|
109
|
+
height= lib/rsyntaxtree/svg_graph.rb /^ attr_accessor :width, :height$/;" A class:RSyntaxTree.SVGGraph
|
110
|
+
id lib/rsyntaxtree/element.rb /^ attr_accessor :id,$/;" A class:RSyntaxTree.Element
|
111
|
+
id lib/rsyntaxtree/string_parser.rb /^ attr_accessor :data, :elist, :pos, :id, :level$/;" A class:RSyntaxTree.StringParser
|
112
|
+
id= lib/rsyntaxtree/element.rb /^ attr_accessor :id,$/;" A class:RSyntaxTree.Element
|
113
|
+
id= lib/rsyntaxtree/string_parser.rb /^ attr_accessor :data, :elist, :pos, :id, :level$/;" A class:RSyntaxTree.StringParser
|
114
|
+
initialize lib/rsyntaxtree.rb /^ def initialize(msg="Error: something unexpected occurred")$/;" f class:RSyntaxTree.RSTError
|
115
|
+
initialize lib/rsyntaxtree.rb /^ def initialize(params = {})$/;" f class:RSyntaxTree.RSGenerator
|
116
|
+
initialize lib/rsyntaxtree.rb /^ def initialize(msg="Error: something unexpected occurred")$/;" f class:RSTError
|
117
|
+
initialize lib/rsyntaxtree/base_graph.rb /^ def initialize(element_list, params)$/;" f class:RSyntaxTree.BaseGraph
|
118
|
+
initialize lib/rsyntaxtree/element.rb /^ def initialize(id, parent, content, level, fontset, fontsize)$/;" f class:RSyntaxTree.Element
|
119
|
+
initialize lib/rsyntaxtree/elementlist.rb /^ def initialize$/;" f class:RSyntaxTree.ElementList
|
120
|
+
initialize lib/rsyntaxtree/string_parser.rb /^ def initialize(msg="Error: something unexpected occurred")$/;" f class:RSyntaxTree.RSTError
|
121
|
+
initialize lib/rsyntaxtree/string_parser.rb /^ def initialize(str, fontset, fontsize)$/;" f class:RSyntaxTree.StringParser
|
122
|
+
initialize lib/rsyntaxtree/string_parser.rb /^ def initialize(msg="Error: something unexpected occurred")$/;" f class:RSTError
|
123
|
+
initialize lib/rsyntaxtree/string_parser.rb /^ def initialize(msg="Error: something unexpected occurred")$/;" f class:RSyntaxTree.RSTError
|
124
|
+
initialize lib/rsyntaxtree/svg_graph.rb /^ def initialize(element_list, params)$/;" f class:RSyntaxTree.SVGGraph
|
125
|
+
initialize lib/rsyntaxtree/utils.rb /^ def initialize(msg="Error: something unexpected occurred")$/;" f class:RSTError
|
126
|
+
iterator lib/rsyntaxtree/elementlist.rb /^ attr_accessor :elements, :iterator $/;" A class:RSyntaxTree.ElementList
|
127
|
+
iterator= lib/rsyntaxtree/elementlist.rb /^ attr_accessor :elements, :iterator $/;" A class:RSyntaxTree.ElementList
|
128
|
+
level lib/rsyntaxtree/string_parser.rb /^ attr_accessor :data, :elist, :pos, :id, :level$/;" A class:RSyntaxTree.StringParser
|
129
|
+
level= lib/rsyntaxtree/string_parser.rb /^ attr_accessor :data, :elist, :pos, :id, :level$/;" A class:RSyntaxTree.StringParser
|
130
|
+
line_to_parent lib/rsyntaxtree/svg_graph.rb /^ def line_to_parent(parent, child)$/;" f class:RSyntaxTree
|
131
|
+
line_to_parent lib/rsyntaxtree/svg_graph.rb /^ def line_to_parent(parent, child)$/;" f class:RSyntaxTree.SVGGraph
|
132
|
+
line_to_parent lib/rsyntaxtree/svg_graph.rb /^ def line_to_parent(parent, child)$/;" f class:RSyntaxTree.SVGGraph.draw_element
|
133
|
+
line_to_parent lib/rsyntaxtree/svg_graph.rb /^ def line_to_parent(parent, child)$/;" f class:RSyntaxTree.SVGGraph.set_tspan
|
134
|
+
make_balance lib/rsyntaxtree/base_graph.rb /^ def make_balance(id = 1)$/;" f class:RSyntaxTree.BaseGraph
|
135
|
+
make_tree lib/rsyntaxtree/string_parser.rb /^ def make_tree(parent)$/;" f class:RSyntaxTree.StringParser
|
136
|
+
make_tree lib/rsyntaxtree/string_parser.rb /^ def make_tree(parent)$/;" f class:RSyntaxTree.StringParser.initialize
|
137
|
+
node_centering lib/rsyntaxtree/base_graph.rb /^ def node_centering$/;" f class:RSyntaxTree.BaseGraph
|
138
|
+
parse lib/rsyntaxtree/markup_parser.rb /^ def parse(txt)$/;" f class:Markup
|
139
|
+
parse lib/rsyntaxtree/markup_parser.rb /^ def parse(txt)$/;" f module:Markup
|
140
|
+
parse lib/rsyntaxtree/string_parser.rb /^ def parse$/;" f class:RSyntaxTree.StringParser
|
141
|
+
parse lib/rsyntaxtree/string_parser.rb /^ def parse$/;" f class:RSyntaxTree.StringParser.initialize
|
142
|
+
parse_list lib/rsyntaxtree/base_graph.rb /^ def parse_list$/;" f class:RSyntaxTree.BaseGraph
|
143
|
+
pos lib/rsyntaxtree/string_parser.rb /^ attr_accessor :data, :elist, :pos, :id, :level$/;" A class:RSyntaxTree.StringParser
|
144
|
+
pos= lib/rsyntaxtree/string_parser.rb /^ attr_accessor :data, :elist, :pos, :id, :level$/;" A class:RSyntaxTree.StringParser
|
145
|
+
rsyntaxtree rsyntaxtree.gemspec /^ s.name = "rsyntaxtree"$/;" g
|
146
|
+
set_element_width lib/rsyntaxtree/elementlist.rb /^ def set_element_width(id, width)$/;" f class:RSyntaxTree.ElementList
|
147
|
+
set_hierarchy lib/rsyntaxtree/elementlist.rb /^ def set_hierarchy$/;" f class:RSyntaxTree.ElementList
|
148
|
+
set_indent lib/rsyntaxtree/elementlist.rb /^ def set_indent(id, indent)$/;" f class:RSyntaxTree.ElementList
|
149
|
+
set_tspan lib/rsyntaxtree/svg_graph.rb /^ def set_tspan$/;" f class:RSyntaxTree.SVGGraph
|
150
|
+
set_tspan lib/rsyntaxtree/svg_graph.rb /^ def set_tspan(this_x, this_y, style, decoration, fontstyle, text)$/;" f class:RSyntaxTree.SVGGraph
|
151
|
+
set_tspan lib/rsyntaxtree/svg_graph.rb /^ def set_tspan(x, y, style, decoration, fontstyle, text)$/;" f class:RSyntaxTree.SVGGraph
|
152
|
+
setup lib/rsyntaxtree/element.rb /^ def setup$/;" f class:RSyntaxTree.Element
|
153
|
+
setup test/markup_parser_test.rb /^ def setup$/;" f class:MarkupParserTest
|
154
|
+
split_by_emoji lib/rsyntaxtree/utils.rb /^ def split_by_emoji$/;" f class:String
|
155
|
+
svg_data lib/rsyntaxtree/svg_graph.rb /^ def svg_data$/;" f class:RSyntaxTree.SVGGraph
|
156
|
+
test_evaluator test/markup_parser_test.rb /^ def test_evaluator$/;" f
|
157
|
+
test_evaluator test/markup_parser_test.rb /^ def test_evaluator$/;" f class:MarkupParserTest
|
158
|
+
test_rule_blankline test/markup_parser_test.rb /^ def test_rule_blankline$/;" f class:MarkupParserTest
|
159
|
+
test_rule_bold test/markup_parser_test.rb /^ def test_rule_bold$/;" f
|
160
|
+
test_rule_bold test/markup_parser_test.rb /^ def test_rule_bold$/;" f class:MarkupParserTest
|
161
|
+
test_rule_bolditalic test/markup_parser_test.rb /^ def test_rule_bolditalic$/;" f
|
162
|
+
test_rule_bolditalic test/markup_parser_test.rb /^ def test_rule_bolditalic$/;" f class:MarkupParserTest
|
163
|
+
test_rule_border test/markup_parser_test.rb /^ def test_rule_border$/;" f
|
164
|
+
test_rule_border test/markup_parser_test.rb /^ def test_rule_border$/;" f class:MarkupParserTest
|
165
|
+
test_rule_box test/markup_parser_test.rb /^ def test_rule_box$/;" f
|
166
|
+
test_rule_box test/markup_parser_test.rb /^ def test_rule_box$/;" f class:MarkupParserTest
|
167
|
+
test_rule_brackets test/markup_parser_test.rb /^ def test_rule_brackets$/;" f class:MarkupParserTest
|
168
|
+
test_rule_cr test/markup_parser_test.rb /^ def test_rule_cr$/;" f class:MarkupParserTest
|
169
|
+
test_rule_escaped test/markup_parser_test.rb /^ def test_rule_escaped$/;" f class:MarkupParserTest
|
170
|
+
test_rule_italic test/markup_parser_test.rb /^ def test_rule_italic$/;" f
|
171
|
+
test_rule_italic test/markup_parser_test.rb /^ def test_rule_italic$/;" f class:MarkupParserTest
|
172
|
+
test_rule_line test/markup_parser_test.rb /^ def test_rule_line$/;" f
|
173
|
+
test_rule_line test/markup_parser_test.rb /^ def test_rule_line$/;" f class:MarkupParserTest
|
174
|
+
test_rule_lines test/markup_parser_test.rb /^ def test_rule_lines$/;" f
|
175
|
+
test_rule_lines test/markup_parser_test.rb /^ def test_rule_lines$/;" f class:MarkupParserTest
|
176
|
+
test_rule_linethrough test/markup_parser_test.rb /^ def test_rule_linethrough$/;" f
|
177
|
+
test_rule_linethrough test/markup_parser_test.rb /^ def test_rule_linethrough$/;" f class:MarkupParserTest
|
178
|
+
test_rule_markup test/markup_parser_test.rb /^ def test_rule_markup$/;" f
|
179
|
+
test_rule_markup test/markup_parser_test.rb /^ def test_rule_markup$/;" f class:MarkupParserTest
|
180
|
+
test_rule_non_escaped test/markup_parser_test.rb /^ def test_rule_non_escaped$/;" f
|
181
|
+
test_rule_non_escaped test/markup_parser_test.rb /^ def test_rule_non_escaped$/;" f class:MarkupParserTest
|
182
|
+
test_rule_overline test/markup_parser_test.rb /^ def test_rule_overline$/;" f
|
183
|
+
test_rule_overline test/markup_parser_test.rb /^ def test_rule_overline$/;" f class:MarkupParserTest
|
184
|
+
test_rule_path test/markup_parser_test.rb /^ def test_rule_path$/;" f class:MarkupParserTest
|
185
|
+
test_rule_subscript test/markup_parser_test.rb /^ def test_rule_subscript$/;" f
|
186
|
+
test_rule_subscript test/markup_parser_test.rb /^ def test_rule_subscript$/;" f class:MarkupParserTest
|
187
|
+
test_rule_superscript test/markup_parser_test.rb /^ def test_rule_superscript$/;" f
|
188
|
+
test_rule_superscript test/markup_parser_test.rb /^ def test_rule_superscript$/;" f class:MarkupParserTest
|
189
|
+
test_rule_text test/markup_parser_test.rb /^ def test_rule_text$/;" f
|
190
|
+
test_rule_text test/markup_parser_test.rb /^ def test_rule_text$/;" f class:MarkupParserTest
|
191
|
+
test_rule_triangle test/markup_parser_test.rb /^ def test_rule_triangle$/;" f class:MarkupParserTest
|
192
|
+
test_rule_underline test/markup_parser_test.rb /^ def test_rule_underline$/;" f
|
193
|
+
test_rule_underline test/markup_parser_test.rb /^ def test_rule_underline$/;" f class:MarkupParserTest
|
194
|
+
triangle_to_parent lib/rsyntaxtree/svg_graph.rb /^ def triangle_to_parent(parent, child)$/;" f class:RSyntaxTree
|
195
|
+
triangle_to_parent lib/rsyntaxtree/svg_graph.rb /^ def triangle_to_parent(parent, child)$/;" f class:RSyntaxTree.SVGGraph
|
196
|
+
triangle_to_parent lib/rsyntaxtree/svg_graph.rb /^ def triangle_to_parent(parent, child)$/;" f class:RSyntaxTree.SVGGraph.draw_element
|
197
|
+
triangle_to_parent lib/rsyntaxtree/svg_graph.rb /^ def triangle_to_parent(parent, child)$/;" f class:RSyntaxTree.SVGGraph.set_tspan
|
198
|
+
valid lib/rsyntaxtree/string_parser.rb /^ def self.valid?(data)$/;" F class:RSyntaxTree.StringParser
|
199
|
+
valid lib/rsyntaxtree/string_parser.rb /^ def self.valid?(data)$/;" F class:RSyntaxTree.StringParser.initialize
|
200
|
+
valid? lib/rsyntaxtree/string_parser.rb /^ def self.valid?(data)$/;" S class:RSyntaxTree.StringParser
|
201
|
+
width lib/rsyntaxtree/svg_graph.rb /^ attr_accessor :width, :height$/;" A class:RSyntaxTree.SVGGraph
|
202
|
+
width= lib/rsyntaxtree/svg_graph.rb /^ attr_accessor :width, :height$/;" A class:RSyntaxTree.SVGGraph
|
203
|
+
🌲 RSyntaxTree: yet another syntax tree generator in Ruby README.md /^# 🌲 RSyntaxTree: yet another syntax tree generator in Ruby$/;" c
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -30,7 +30,6 @@ where [options] are:
|
|
30
30
|
-s, --fontsize=<i> Size: 8-26 (default: 16)
|
31
31
|
-c, --color=<s> Color text and bars: on or off (default: on)
|
32
32
|
-y, --symmetrize=<s> Generate symmetrical, balanced tree: on or off (default: on)
|
33
|
-
-a, --autosub=<s> Put subscript numbers to nodes: on or off (default: off)
|
34
33
|
-m, --margin=<i> Margin: 0-120 (default: 0)
|
35
34
|
-v, --vheight=<f> Connector Height: 0.5-2.0 (default: 1.0)
|
36
35
|
-e, --version Print version and exit
|
data/Rakefile
CHANGED
data/bin/rsyntaxtree
CHANGED
@@ -5,6 +5,7 @@ $LOAD_PATH << File.join( File.dirname(__FILE__), '../lib')
|
|
5
5
|
|
6
6
|
require 'rsyntaxtree'
|
7
7
|
require 'optimist'
|
8
|
+
require 'utils'
|
8
9
|
|
9
10
|
opts = Optimist::options do
|
10
11
|
version "RSyntaxTree #{RSyntaxTree::VERSION} (c) 2021 Yoichiro Hasebe"
|
@@ -22,20 +23,18 @@ EOS
|
|
22
23
|
:default => "png"
|
23
24
|
opt :leafstyle, "visual style of tree leaves: auto, triangle, bar, or nothing",
|
24
25
|
:default => "auto"
|
25
|
-
opt :fontstyle, "Font style (available when ttf font is specified): sans, serif, cjk
|
26
|
+
opt :fontstyle, "Font style (available when ttf font is specified): sans, serif, cjk",
|
26
27
|
:default => "sans"
|
27
28
|
opt :font, "Path to a ttf font used to generate tree (optional)", :type => String
|
28
29
|
opt :fontsize, "Size: 8-26",
|
29
30
|
:default => 16
|
30
|
-
opt :margin, "Margin:
|
31
|
+
opt :margin, "Margin: 0-10",
|
31
32
|
:default => 1
|
32
33
|
opt :vheight, "Connector Height: 0.5-5.0",
|
33
|
-
:default =>
|
34
|
+
:default => 2.0
|
34
35
|
opt :color, "Color text and bars: on or off",
|
35
36
|
:default => "on"
|
36
|
-
opt :symmetrize, "Generate symmetrical, balanced tree: on or off",
|
37
|
-
:default => "on"
|
38
|
-
opt :autosub, "Put subscript numbers to nodes: on or off",
|
37
|
+
opt :symmetrize, "Generate radically symmetrical, balanced tree: on or off",
|
39
38
|
:default => "off"
|
40
39
|
opt :transparent, "Make background transparent: on or off",
|
41
40
|
:default => "off"
|
@@ -44,15 +43,14 @@ end
|
|
44
43
|
Optimist::die :outdir, "must be an exsting directory path" unless FileTest::directory?(opts[:outdir])
|
45
44
|
Optimist::die :format, "must be png, jpg, gif, or svg" unless /\A(png|jpg|gif|pdf|svg)\z/ =~ opts[:format]
|
46
45
|
Optimist::die :leafstyle, "must be auto, triangle, bar, or nothing" unless /\A(auto|triangle|bar|nothing)\z/ =~ opts[:leafstyle]
|
47
|
-
Optimist::die :fontstyle, "must be sans, serif, cjk
|
46
|
+
Optimist::die :fontstyle, "must be sans, serif, cjk" unless /\A(sans|serif|cjk)\z/ =~ opts[:fontstyle]
|
48
47
|
Optimist::die :font, "must be path to an existing ttf font" if opts[:font] && !File::exists?(opts[:font])
|
49
48
|
Optimist::die :fontsize, "must be in the range of 8-26" unless opts[:fontsize] >= 8 && opts[:fontsize] <= 26
|
50
|
-
Optimist::die :color, "must be either on or off" unless /\A(on|off)\z/ =~ opts[:color]
|
51
|
-
Optimist::die :symmetrize, "must be either on or off" unless /\A(on|off)\z/ =~ opts[:symmetrize]
|
52
|
-
Optimist::die :
|
53
|
-
Optimist::die :margin, "must be in the range of 0-5" if opts[:margin] < 1 || opts[:margin] > 5
|
49
|
+
Optimist::die :color, "must be either on or off" unless /\A(on|off|true|false)\z/ =~ opts[:color]
|
50
|
+
Optimist::die :symmetrize, "must be either on or off" unless /\A(on|off|true|false)\z/ =~ opts[:symmetrize]
|
51
|
+
Optimist::die :margin, "must be in the range of 0-10" if opts[:margin] < 0 || opts[:margin] > 10
|
54
52
|
Optimist::die :vheight, "must be in the range of 0.5-5.0" if opts[:vheight] < 0.5 || opts[:vheight] > 5.0
|
55
|
-
Optimist::die :transparent, "must be either on or off" unless /\A(on|off)\z/ =~ opts[:transparent]
|
53
|
+
Optimist::die :transparent, "must be either on or off" unless /\A(on|off|true|false)\z/ =~ opts[:transparent]
|
56
54
|
|
57
55
|
string_opts = {}
|
58
56
|
opts.each do |key, value|
|
@@ -61,26 +59,35 @@ end
|
|
61
59
|
|
62
60
|
data = ARGV[0]
|
63
61
|
|
64
|
-
|
65
|
-
|
62
|
+
begin
|
63
|
+
RSyntaxTree::RSGenerator.check_data(data)
|
64
|
+
rescue RSTError => e
|
65
|
+
puts e
|
66
66
|
exit
|
67
67
|
end
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
rsg = RSGenerator.new(string_opts)
|
72
|
-
ext = string_opts[:format]
|
73
|
-
|
74
|
-
case ext
|
75
|
-
when "
|
76
|
-
|
77
|
-
when "
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
69
|
+
begin
|
70
|
+
string_opts[:data] = data
|
71
|
+
rsg = RSyntaxTree::RSGenerator.new(string_opts)
|
72
|
+
ext = string_opts[:format]
|
73
|
+
filepath = File.expand_path(string_opts[:outdir]) + "/syntree." + ext
|
74
|
+
case ext
|
75
|
+
when "jpg", "gif", "pdf"
|
76
|
+
rsg.draw_tree.write(filepath)
|
77
|
+
when "png"
|
78
|
+
outfile = File.new(filepath, "wb")
|
79
|
+
# outfile.write rsg.draw_png
|
80
|
+
outfile.write rsg.draw_tree
|
81
|
+
outfile.close
|
82
|
+
when "svg"
|
83
|
+
outfile = File.new(filepath, "wb")
|
84
|
+
outfile.write rsg.draw_svg
|
85
|
+
outfile.close
|
86
|
+
end
|
87
|
+
rescue RSTError => e
|
88
|
+
puts e
|
89
|
+
exit
|
90
|
+
rescue => e
|
91
|
+
puts "Error: something unexpected occurred"
|
92
|
+
exit
|
85
93
|
end
|
86
|
-
outfile.close
|
Binary file
|
Binary file
|
@@ -0,0 +1,262 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
#==========================
|
5
|
+
# graph.rb
|
6
|
+
#==========================
|
7
|
+
#
|
8
|
+
# Image utility functions to inspect text font metrics
|
9
|
+
# Copyright (c) 2007-2021 Yoichiro Hasebe <yohasebe@gmail.com>
|
10
|
+
|
11
|
+
require 'utils'
|
12
|
+
|
13
|
+
module RSyntaxTree
|
14
|
+
class BaseGraph
|
15
|
+
|
16
|
+
def initialize(element_list, params)
|
17
|
+
|
18
|
+
@element_list = element_list
|
19
|
+
@symmetrize = params[:symmetrize]
|
20
|
+
|
21
|
+
if params[:color]
|
22
|
+
@col_node = "blue"
|
23
|
+
@col_leaf = "green"
|
24
|
+
@col_path = "purple"
|
25
|
+
else
|
26
|
+
@col_node = "black"
|
27
|
+
@col_leaf = "black"
|
28
|
+
@col_path = "black"
|
29
|
+
end
|
30
|
+
|
31
|
+
@col_bg = "none"
|
32
|
+
@col_fg = "black"
|
33
|
+
@col_line = "black"
|
34
|
+
|
35
|
+
@leafstyle = params[:leafstyle]
|
36
|
+
@fontset = params[:fontset]
|
37
|
+
@fontsize = params[:fontsize]
|
38
|
+
end
|
39
|
+
|
40
|
+
def calculate_level
|
41
|
+
@element_list.get_elements.select{|e| e.type == 2}.each do |e|
|
42
|
+
e.level = @element_list.get_id(e.parent).level + 1
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def calculate_width(id = 1)
|
47
|
+
target = @element_list.get_id(id)
|
48
|
+
if target.children.empty?
|
49
|
+
target.width = target.content_width + $h_gap_between_nodes * 4
|
50
|
+
|
51
|
+
parent = @element_list.get_id(target.parent)
|
52
|
+
while parent && parent.children.size == 1
|
53
|
+
w = parent.content_width
|
54
|
+
target.width = w + $h_gap_between_nodes * 4 if w > target.content_width
|
55
|
+
parent = @element_list.get_id(parent.parent)
|
56
|
+
end
|
57
|
+
return target.width
|
58
|
+
else
|
59
|
+
if target.width != 0
|
60
|
+
return target.width
|
61
|
+
else
|
62
|
+
accum_array = []
|
63
|
+
target.children.each do |c|
|
64
|
+
accum_array << calculate_width(c)
|
65
|
+
end
|
66
|
+
if @symmetrize
|
67
|
+
accum_width = accum_array.max * target.children.size
|
68
|
+
else
|
69
|
+
accum_width = accum_array.sum
|
70
|
+
end
|
71
|
+
|
72
|
+
target.width = [accum_width, target.content_width].max
|
73
|
+
end
|
74
|
+
|
75
|
+
return target.width
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def calculate_height(id = 1)
|
80
|
+
target = @element_list.get_id(id)
|
81
|
+
if id == 1
|
82
|
+
target.vertical_indent = 0
|
83
|
+
else
|
84
|
+
parent = @element_list.get_id(target.parent)
|
85
|
+
|
86
|
+
if !target.triangle && @leafstyle == "nothing" && ETYPE_LEAF == target.type && parent.children.size == 1
|
87
|
+
vertical_indent = parent.vertical_indent + parent.content_height
|
88
|
+
else
|
89
|
+
vertical_indent = parent.vertical_indent + parent.content_height + $height_connector
|
90
|
+
end
|
91
|
+
|
92
|
+
target.vertical_indent = vertical_indent
|
93
|
+
end
|
94
|
+
|
95
|
+
if target.children.empty?
|
96
|
+
target.height = target.content_height
|
97
|
+
vertical_end = target.vertical_indent + target.content_height
|
98
|
+
else
|
99
|
+
accum_array = []
|
100
|
+
target.children.each do |c|
|
101
|
+
accum_array << calculate_height(c)
|
102
|
+
end
|
103
|
+
target.height = accum_array.max - target.vertical_indent
|
104
|
+
vertical_end = accum_array.max
|
105
|
+
end
|
106
|
+
return vertical_end
|
107
|
+
end
|
108
|
+
|
109
|
+
def make_balance(id = 1)
|
110
|
+
target = @element_list.get_id(id)
|
111
|
+
if target.children.empty?
|
112
|
+
parent = @element_list.get_id(target.parent)
|
113
|
+
accum_array = []
|
114
|
+
parent.children.each do |c|
|
115
|
+
accum_array << @element_list.get_id(c).width
|
116
|
+
end
|
117
|
+
max = accum_array.max
|
118
|
+
parent.children.each do |c|
|
119
|
+
@element_list.get_id(c).width = max
|
120
|
+
end
|
121
|
+
return max
|
122
|
+
else
|
123
|
+
accum_array = []
|
124
|
+
target.children.each do |c|
|
125
|
+
accum_array << make_balance(c)
|
126
|
+
end
|
127
|
+
accum_width = accum_array.max
|
128
|
+
max = [accum_width, target.content_width].max
|
129
|
+
target.children.each do |c|
|
130
|
+
@element_list.get_id(c).width = max
|
131
|
+
end
|
132
|
+
return target.width
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def calculate_indent
|
137
|
+
node_groups = @element_list.get_elements.group_by {|e| e.parent}
|
138
|
+
node_groups.each do |k, v|
|
139
|
+
next if k == 0
|
140
|
+
parent = @element_list.get_id(k)
|
141
|
+
if @symmetrize
|
142
|
+
num_leaves = v.size
|
143
|
+
partition_width = parent.width / num_leaves
|
144
|
+
left_offset = parent.horizontal_indent + parent.content_width / 2.0 - parent.width / 2.0
|
145
|
+
v.each do |e|
|
146
|
+
indent = left_offset + (partition_width - e.content_width) / 2.0
|
147
|
+
e.horizontal_indent = indent
|
148
|
+
left_offset += partition_width
|
149
|
+
end
|
150
|
+
else
|
151
|
+
left_offset = parent.horizontal_indent + parent.content_width / 2.0 - parent.width / 2.0
|
152
|
+
v.each do |e|
|
153
|
+
indent = left_offset + (e.width - e.content_width) / 2.0
|
154
|
+
e.horizontal_indent = indent
|
155
|
+
left_offset += e.width
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def draw_elements
|
162
|
+
@element_list.get_elements.each do |element|
|
163
|
+
draw_element(element)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def draw_connector(id = 1)
|
168
|
+
parent = @element_list.get_id(id)
|
169
|
+
children = parent.children.map{|c| @element_list.get_id(c)}
|
170
|
+
|
171
|
+
if children.empty?
|
172
|
+
;
|
173
|
+
elsif children.size == 1
|
174
|
+
child = children[0]
|
175
|
+
if (@leafstyle == "auto")
|
176
|
+
if child.contains_phrase || child.triangle
|
177
|
+
triangle_to_parent(parent, child)
|
178
|
+
else
|
179
|
+
line_to_parent(parent, child)
|
180
|
+
end
|
181
|
+
elsif(@leafstyle == "bar")
|
182
|
+
if child.triangle
|
183
|
+
triangle_to_parent(parent, child)
|
184
|
+
else
|
185
|
+
line_to_parent(parent, child)
|
186
|
+
end
|
187
|
+
elsif(@leafstyle == "nothing")
|
188
|
+
if child.triangle
|
189
|
+
triangle_to_parent(parent, child)
|
190
|
+
elsif ETYPE_LEAF == child.type
|
191
|
+
child.vertical_indent = parent.vertical_indent + parent.content_height + $height_connector / 2
|
192
|
+
end
|
193
|
+
end
|
194
|
+
else
|
195
|
+
children.each do |child|
|
196
|
+
line_to_parent(parent, child)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
parent.children.each do |c|
|
201
|
+
draw_connector(c)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
def get_leftmost(id = 1)
|
206
|
+
target = @element_list.get_id(id)
|
207
|
+
target_indent = target.horizontal_indent
|
208
|
+
children_indent = target.children.map{|c| get_leftmost(c)}
|
209
|
+
(children_indent << target_indent).min
|
210
|
+
end
|
211
|
+
|
212
|
+
def get_rightmost(id = 1)
|
213
|
+
target = @element_list.get_id(id)
|
214
|
+
target_right_end = target.horizontal_indent + target.content_width
|
215
|
+
children_right_end = target.children.map{|c| get_rightmost(c)}
|
216
|
+
(children_right_end << target_right_end).max
|
217
|
+
end
|
218
|
+
|
219
|
+
def node_centering
|
220
|
+
node_groups = @element_list.get_elements.group_by {|e| e.parent}
|
221
|
+
node_groups.sort_by{|k, v| -k}.each do |k, v|
|
222
|
+
next if k == 0
|
223
|
+
parent = @element_list.get_id(k)
|
224
|
+
child_positions =v.map {|child| child.horizontal_indent + child.content_width / 2 }
|
225
|
+
parent.horizontal_indent = child_positions.min + (child_positions.max - child_positions.min - parent.content_width) / 2
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
def parse_list
|
230
|
+
calculate_level
|
231
|
+
calculate_width
|
232
|
+
make_balance if @symmetrize
|
233
|
+
calculate_indent
|
234
|
+
node_centering
|
235
|
+
|
236
|
+
top = @element_list.get_id(1)
|
237
|
+
diff = top.horizontal_indent
|
238
|
+
@element_list.get_elements.each do |e|
|
239
|
+
e.horizontal_indent -= diff
|
240
|
+
end
|
241
|
+
|
242
|
+
offset_l = (top.horizontal_indent - get_leftmost) + $h_gap_between_nodes
|
243
|
+
offset_r = top.width / 2 - offset_l - $h_gap_between_nodes
|
244
|
+
|
245
|
+
@element_list.get_elements.each do |e|
|
246
|
+
e.horizontal_indent += offset_l
|
247
|
+
end
|
248
|
+
|
249
|
+
calculate_height
|
250
|
+
draw_elements
|
251
|
+
draw_connector
|
252
|
+
num_paths = draw_paths
|
253
|
+
|
254
|
+
# width = get_rightmost - get_leftmost + $h_gap_between_nodes * 2
|
255
|
+
width = get_rightmost - get_leftmost + $h_gap_between_nodes
|
256
|
+
height = @element_list.get_id(1).height
|
257
|
+
height = @height if @height > height
|
258
|
+
|
259
|
+
return {height: height, width: width}
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|