bitclust-core 0.5.5 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +7 -0
- data/bitclust.gemspec +2 -0
- data/data/bitclust/catalog/ja_JP.UTF-8 +2 -0
- data/data/bitclust/template.offline/class +22 -2
- data/lib/bitclust/methodentry.rb +5 -0
- data/lib/bitclust/nameutils.rb +2 -2
- data/lib/bitclust/rdcompiler.rb +12 -3
- data/lib/bitclust/refsdatabase.rb +2 -1
- data/lib/bitclust/runner.rb +1 -1
- data/lib/bitclust/subcommands/server_command.rb +1 -1
- data/lib/bitclust/subcommands/setup_command.rb +1 -1
- data/lib/bitclust/version.rb +1 -1
- data/test/test_nameutils.rb +72 -69
- data/test/test_rdcompiler.rb +122 -90
- data/theme/default/style.css +5 -0
- metadata +37 -5
data/ChangeLog
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
2013-04-06 Sho Hashimoto <sho-h@netlab.jp>
|
2
|
+
|
3
|
+
* lib/bitclust/nameutils.rb
|
4
|
+
(BitClust::NameUtils::CLASS_NAME_RE): support main and
|
5
|
+
*::compatible class. (see #8186)
|
6
|
+
(BitClust::NameUtils::CLASS_PATH_RE): ditto.
|
7
|
+
|
1
8
|
2012-10-09 Ippei Obayashi <ohai@kmc.gr.jp>
|
2
9
|
|
3
10
|
* lib/bitclust/subcommands/server_command.rb
|
data/bitclust.gemspec
CHANGED
@@ -27,5 +27,7 @@ EOD
|
|
27
27
|
# s.add_development_dependency "rspec"
|
28
28
|
# s.add_runtime_dependency "rest-client"
|
29
29
|
s.add_development_dependency "test-unit", ">= 2.3.0"
|
30
|
+
s.add_development_dependency "test-unit-notify"
|
31
|
+
s.add_development_dependency "test-unit-rr"
|
30
32
|
s.add_runtime_dependency "rack"
|
31
33
|
end
|
@@ -38,14 +38,34 @@
|
|
38
38
|
|
39
39
|
<%
|
40
40
|
ents = @entry.partitioned_entries(@alevel)
|
41
|
+
items =
|
41
42
|
[[_('Singleton Methods'), ents.singleton_methods ],
|
42
43
|
[_('Instance Methods'), ents.instance_methods ],
|
43
44
|
[_('Private Singleton Methods'), ents.private_singleton_methods ],
|
44
45
|
[_('Private Instance Methods'), ents.private_instance_methods ],
|
45
46
|
[_('Module Functions'), ents.module_functions ],
|
46
47
|
[_('Constants'), ents.constants ],
|
47
|
-
[_('Special Variables'), ents.special_variables ]]
|
48
|
-
|
48
|
+
[_('Special Variables'), ents.special_variables ,'$']] %>
|
49
|
+
<%= headline(_("Index")) %>
|
50
|
+
<dl>
|
51
|
+
<% items.each do |label, entries, prefix| next if entries.empty? %>
|
52
|
+
<dt><%= label %></dt>
|
53
|
+
<dd>
|
54
|
+
<%
|
55
|
+
entries.each do |m|
|
56
|
+
m.names.each do |mname|
|
57
|
+
%>
|
58
|
+
<a href="#<%= m.index_id(mname, false) %>"><%= "#{prefix}#{mname}" %></a>
|
59
|
+
<%
|
60
|
+
end
|
61
|
+
end
|
62
|
+
%>
|
63
|
+
</dd>
|
64
|
+
<% end %>
|
65
|
+
</dl>
|
66
|
+
|
67
|
+
<%
|
68
|
+
items.each do |label, entries|
|
49
69
|
unless entries.empty? %>
|
50
70
|
<%= headline(label) %>
|
51
71
|
<dl>
|
data/lib/bitclust/methodentry.rb
CHANGED
@@ -122,6 +122,11 @@ module BitClust
|
|
122
122
|
"#{t == '#' ? '' : t}#{m}"
|
123
123
|
end
|
124
124
|
|
125
|
+
def index_id(name, remove_prefix = true)
|
126
|
+
name = name.sub(/^\$/, '') if remove_prefix
|
127
|
+
"#{methodid2typechar(@id)}_#{encodename_fs(name).gsub(/=/, '--')}".upcase
|
128
|
+
end
|
129
|
+
|
125
130
|
def labels
|
126
131
|
c, t, m, lib = methodid2specparts(@id)
|
127
132
|
names().map {|name| "#{c}#{t}#{name}" }
|
data/lib/bitclust/nameutils.rb
CHANGED
@@ -18,8 +18,8 @@ module BitClust
|
|
18
18
|
LIBNAME_RE = %r<[\w\-]+(/[\w\-]+)*>
|
19
19
|
CONST_RE = /[A-Z]\w*/
|
20
20
|
CONST_PATH_RE = /#{CONST_RE}(?:::#{CONST_RE})*/
|
21
|
-
CLASS_NAME_RE = /(?:#{CONST_RE}
|
22
|
-
CLASS_PATH_RE = /(?:#{CONST_PATH_RE}
|
21
|
+
CLASS_NAME_RE = /(?:#{CONST_RE}(?:::compatible)?|fatal|ARGF.class|main)/
|
22
|
+
CLASS_PATH_RE = /(?:#{CONST_PATH_RE}(?:::compatible)?|fatal|ARGF.class|main)/
|
23
23
|
METHOD_NAME_RE = /\w+[?!=]?|===|==|=~|<=>|<=|>=|!=|!|!@|!~|\[\]=|\[\]|\*\*|>>|<<|\+@|\-@|[~+\-*\/%&|^<>`]/
|
24
24
|
TYPEMARK_RE = /(?:\.|\#|\.\#|::|\$)/
|
25
25
|
METHOD_SPEC_RE = /#{CLASS_PATH_RE}#{TYPEMARK_RE}#{METHOD_NAME_RE}/
|
data/lib/bitclust/rdcompiler.rb
CHANGED
@@ -93,8 +93,10 @@ module BitClust
|
|
93
93
|
|
94
94
|
def method_entry_chunk
|
95
95
|
@out.puts '<dl>' if @option[:force]
|
96
|
+
first = true
|
96
97
|
@f.while_match(/\A---/) do |line|
|
97
|
-
method_signature
|
98
|
+
method_signature(line, first)
|
99
|
+
first = false
|
98
100
|
end
|
99
101
|
props = {}
|
100
102
|
@f.while_match(/\A:/) do |line|
|
@@ -327,13 +329,20 @@ module BitClust
|
|
327
329
|
f.span(%r<\A(?!---|=|//emlist\{|@[a-z])\S>)
|
328
330
|
end
|
329
331
|
|
330
|
-
def method_signature(sig_line)
|
332
|
+
def method_signature(sig_line, first)
|
331
333
|
# FIXME: check parameters, types, etc.
|
332
334
|
sig = MethodSignature.parse(sig_line)
|
333
|
-
string
|
335
|
+
string %Q(<dt class="method-heading")
|
336
|
+
string %Q( id="#{@method.index_id(sig.name)}") if first
|
337
|
+
string '><code>'
|
334
338
|
string @method.klass.name + @method.typemark if @opt
|
335
339
|
string escape_html(sig.friendly_string)
|
336
340
|
string '</code>'
|
341
|
+
if first
|
342
|
+
string '<span class="permalink">['
|
343
|
+
string a_href(@urlmapper.method_url(methodid2specstring(@method.id)), "permalink")
|
344
|
+
string ']</span>'
|
345
|
+
end
|
337
346
|
if @method and not @method.defined?
|
338
347
|
line %Q( <span class="kindinfo">[#{@method.kind} by #{library_link(@method.library.name)}]</span>)
|
339
348
|
end
|
@@ -20,7 +20,7 @@ module BitClust
|
|
20
20
|
buf.each_line{|l|
|
21
21
|
if /((?:\\,|[^,])+),((?:\\,|[^,])+),((?:\\,|[^,])+),((?:\\,|[^,])+)\n/ =~ l
|
22
22
|
type, id, linkid, desc = [$1, $2, $3, $4].map{|e| e.gsub(/\\(.)/){|s| $1 == ',' ? ',' : s } }
|
23
|
-
refs[type, id, linkid] = desc
|
23
|
+
refs[type, id, linkid] = desc
|
24
24
|
end
|
25
25
|
}
|
26
26
|
refs
|
@@ -51,6 +51,7 @@ module BitClust
|
|
51
51
|
@h.each{|k, v|
|
52
52
|
io.write( [k, v].flatten.map{|e| e.gsub(/,/, '\\,') }.join(',') + "\n" )
|
53
53
|
}
|
54
|
+
io.close
|
54
55
|
end
|
55
56
|
|
56
57
|
def extract(entry)
|
data/lib/bitclust/runner.rb
CHANGED
@@ -56,7 +56,7 @@ Global Options:
|
|
56
56
|
@parser.on('-d', '--database=PATH', 'Database prefix.') {|path|
|
57
57
|
@prefix = path
|
58
58
|
}
|
59
|
-
@parser.on('-t', '--
|
59
|
+
@parser.on('-t', '--target=VERSION', 'Specify Ruby version.') {|v|
|
60
60
|
@version = v
|
61
61
|
}
|
62
62
|
@parser.on('--capi', 'Process C API database.') {
|
@@ -16,7 +16,7 @@ module BitClust::Subcommands
|
|
16
16
|
def initialize
|
17
17
|
@prepare = nil
|
18
18
|
@cleanup = nil
|
19
|
-
@versions = ["1.8.7", "1.9.3"]
|
19
|
+
@versions = ["1.8.7", "1.9.3", "2.0.0"]
|
20
20
|
@parser = OptionParser.new {|opt|
|
21
21
|
opt.banner = "Usage: #{File.basename($0, '.*')} setup [options]"
|
22
22
|
opt.on('--prepare', 'Prepare config file and checkout repository. Do not create database.') {
|
data/lib/bitclust/version.rb
CHANGED
data/test/test_nameutils.rb
CHANGED
@@ -60,6 +60,7 @@ class TestNameUtils < Test::Unit::TestCase
|
|
60
60
|
"Net::HTTP" => [true, "Net::HTTP"],
|
61
61
|
"Test::Unit::TestCase" => [true, "Test::Unit::TestCase"],
|
62
62
|
"ARGF.class" => [true, "ARGF.class"],
|
63
|
+
"Complex::compatible" => [true, "Complex::compatible"],
|
63
64
|
"empty string" => [false, ""],
|
64
65
|
"following space" => [false, "Array "],
|
65
66
|
"leading space" => [false, " Array"],
|
@@ -80,17 +81,19 @@ class TestNameUtils < Test::Unit::TestCase
|
|
80
81
|
"String" => ["String", "String"],
|
81
82
|
"Net::HTTP" => ["Net=HTTP", "Net::HTTP"],
|
82
83
|
"Test::Unit::TestCase" => ["Test=Unit=TestCase", "Test::Unit::TestCase"],
|
83
|
-
"ARGF.class" => ["ARGF.class", "ARGF.class"]
|
84
|
+
"ARGF.class" => ["ARGF.class", "ARGF.class"],
|
85
|
+
"Complex::compatible" => ["Complex=compatible", "Complex::compatible"])
|
84
86
|
def test_classname2id(data)
|
85
87
|
expected, target = data
|
86
88
|
assert_equal(expected, classname2id(target))
|
87
89
|
end
|
88
90
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
data("Array" => ["Array", "Array"],
|
92
|
+
"String" => ["String", "String"],
|
93
|
+
"Net=HTTP" => ["Net::HTTP", "Net=HTTP"],
|
94
|
+
"Test=Unit=TestCase" => ["Test::Unit::TestCase", "Test=Unit=TestCase"],
|
95
|
+
"ARGF.class" => ["ARGF.class", "ARGF.class"],
|
96
|
+
"Complex=compatible" => ["Complex::compatible", "Complex=compatible"])
|
94
97
|
def test_classid2name(data)
|
95
98
|
expected, target = data
|
96
99
|
assert_equal(expected, classid2name(target))
|
@@ -134,10 +137,10 @@ class TestNameUtils < Test::Unit::TestCase
|
|
134
137
|
assert_equal(expected, methodid2classid(target))
|
135
138
|
end
|
136
139
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
140
|
+
data("String/i.index._builtin" => [:instance_method, "String/i.index._builtin"],
|
141
|
+
"CGI/i.accept.cgi" => [:instance_method, "CGI/i.accept.cgi"],
|
142
|
+
"Net=HTTP/i.ca_path.net.http" => [:instance_method, "Net=HTTP/i.ca_path.net.http"],
|
143
|
+
"String/s.new._builtin" => [:singleton_method, "String/s.new._builtin"])
|
141
144
|
def test_methodid2typename(data)
|
142
145
|
expected, target = data
|
143
146
|
assert_equal(expected, methodid2typename(target))
|
@@ -151,61 +154,61 @@ class TestNameUtils < Test::Unit::TestCase
|
|
151
154
|
assert_equal(expected, methodid2mname(target))
|
152
155
|
end
|
153
156
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
157
|
+
data("index" => [true, "index"],
|
158
|
+
"accept" => [true, "accept"],
|
159
|
+
"get" => [true, "get"],
|
160
|
+
"Array" => [true, "Array"],
|
161
|
+
"getIndex" => [true, "getIndex"],
|
162
|
+
"PROXY" => [true, "PROXY"],
|
163
|
+
"HTTP_PROXY" => [true, "HTTP_PROXY"],
|
164
|
+
"gsub!" => [true, "gsub!"],
|
165
|
+
"empty? " => [true, "empty?"],
|
166
|
+
"instance_eval" => [true, "instance_eval"],
|
167
|
+
"__send" => [true, "__send"],
|
168
|
+
"__send__" => [true, "__send__"],
|
169
|
+
"__send!" => [true, "__send!"],
|
170
|
+
"+" => [true, "+"],
|
171
|
+
"-" => [true, "-"],
|
172
|
+
"*" => [true, "*"],
|
173
|
+
"/" => [true, "/"],
|
174
|
+
"&" => [true, "&"],
|
175
|
+
"|" => [true, "|"],
|
176
|
+
"^" => [true, "^"],
|
177
|
+
"`" => [true, "`"],
|
178
|
+
">>" => [true, ">>"],
|
179
|
+
"<<" => [true, "<<"],
|
180
|
+
"+@" => [true, "+@"],
|
181
|
+
"-@" => [true, "-@"],
|
182
|
+
"!" => [true, "!"],
|
183
|
+
"!@" => [true, "!@"],
|
184
|
+
"~" => [true, "~"],
|
185
|
+
"**" => [true, "**"],
|
186
|
+
"<" => [true, "<"],
|
187
|
+
">" => [true, ">"],
|
188
|
+
"<=" => [true, "<="],
|
189
|
+
">=" => [true, ">="],
|
190
|
+
"==" => [true, "=="],
|
191
|
+
"===" => [true, "==="],
|
192
|
+
"=~" => [true, "=~"],
|
193
|
+
"[]" => [true, "[]"],
|
194
|
+
"[]=" => [true, "[]="],
|
195
|
+
"" => [false, ""],
|
196
|
+
"!=" => [true, "!="],
|
197
|
+
"!~" => [true, "!~"],
|
198
|
+
"&&" => [false, "&&"],
|
199
|
+
"||" => [false, "||"],
|
200
|
+
"++" => [false, "++"],
|
201
|
+
">>>" => [false, ">>>"],
|
202
|
+
"***" => [false, "***"],
|
203
|
+
"====" => [false, "===="],
|
204
|
+
"#accept" => [false, "#accept"],
|
205
|
+
".new" => [false, ".new"],
|
206
|
+
".#cp" => [false, ".#cp"],
|
207
|
+
"$gvar" => [false, "$gvar"],
|
208
|
+
"CGI#accept" => [false, "CGI#accept"],
|
209
|
+
"String.new" => [false, "String.new"],
|
210
|
+
"Net::HTTP.get" => [false, "Net::HTTP.get"],
|
211
|
+
"Net::HTTP.new" => [false, "Net::HTTP.new"])
|
209
212
|
def test_methodname?(data)
|
210
213
|
expected, target = data
|
211
214
|
assert_equal(expected, methodname?(target))
|
@@ -344,7 +347,7 @@ class TestNameUtils < Test::Unit::TestCase
|
|
344
347
|
"=2a=2a" => ["=2a=2a", "=2a=2a"],
|
345
348
|
"open=2duri" => ["open=2duri", "open=2duri"],
|
346
349
|
"Net=HTTP" => ["-net=-h-t-t-p", "Net=HTTP"])
|
347
|
-
def test_encodeid
|
350
|
+
def test_encodeid(data)
|
348
351
|
expected, target = data
|
349
352
|
assert_equal(expected, encodeid(target))
|
350
353
|
end
|
@@ -356,7 +359,7 @@ class TestNameUtils < Test::Unit::TestCase
|
|
356
359
|
"=2a=2a" => ["=2a=2a", "=2a=2a"],
|
357
360
|
"open=2duri" => ["open=2duri", "open=2duri"],
|
358
361
|
"-net=-h-t-t-p" => ["Net=HTTP", "-net=-h-t-t-p"])
|
359
|
-
def test_decodeid
|
362
|
+
def test_decodeid(data)
|
360
363
|
expected, target = data
|
361
364
|
assert_equal(expected, decodeid(target))
|
362
365
|
end
|
@@ -368,7 +371,7 @@ class TestNameUtils < Test::Unit::TestCase
|
|
368
371
|
"**" => ["=2a=2a", "**"],
|
369
372
|
"open-uri" => ["open=2duri", "open-uri"],
|
370
373
|
"net.http" => ["net=2ehttp", "net.http"])
|
371
|
-
def test_encodename_fs
|
374
|
+
def test_encodename_fs(data)
|
372
375
|
expected, target = data
|
373
376
|
assert_equal(expected, encodename_fs(target))
|
374
377
|
end
|
@@ -380,7 +383,7 @@ class TestNameUtils < Test::Unit::TestCase
|
|
380
383
|
"=2a=2a" => ["**", "=2a=2a"],
|
381
384
|
"open=2duri" => ["open-uri", "open=2duri"],
|
382
385
|
"net=2ehttp" => ["net.http", "net=2ehttp"])
|
383
|
-
def test_decodename_fs
|
386
|
+
def test_decodename_fs(data)
|
384
387
|
expected, target = data
|
385
388
|
assert_equal(expected, decodename_fs(target))
|
386
389
|
end
|
data/test/test_rdcompiler.rb
CHANGED
@@ -13,8 +13,17 @@ class TestRDCompiler < Test::Unit::TestCase
|
|
13
13
|
@c = BitClust::RDCompiler.new(@u, 1, {:database => BitClust::MethodDatabase.dummy})
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
assert_equal
|
16
|
+
def assert_compiled_source(expected, src)
|
17
|
+
assert_equal(expected, @c.compile(src))
|
18
|
+
end
|
19
|
+
|
20
|
+
def assert_compiled_method_source(expected, src)
|
21
|
+
method_entry = Object.new
|
22
|
+
mock(method_entry).source{ src }
|
23
|
+
mock(method_entry).index_id(anything).any_times{ "dummy" }
|
24
|
+
mock(method_entry).defined?.any_times{ true }
|
25
|
+
mock(method_entry).id.any_times{ "String/i.index._builtin" }
|
26
|
+
assert_equal(expected, @c.compile_method(method_entry))
|
18
27
|
end
|
19
28
|
|
20
29
|
def test_dlist
|
@@ -42,8 +51,10 @@ c2-2
|
|
42
51
|
</dd>
|
43
52
|
</dl>
|
44
53
|
HERE
|
45
|
-
|
54
|
+
assert_compiled_source(expected, src)
|
55
|
+
end
|
46
56
|
|
57
|
+
def test_dlist_with_empty_line
|
47
58
|
src = <<HERE
|
48
59
|
: t1
|
49
60
|
c1
|
@@ -72,8 +83,10 @@ c3
|
|
72
83
|
</dd>
|
73
84
|
</dl>
|
74
85
|
HERE
|
75
|
-
|
86
|
+
assert_compiled_source(expected, src)
|
87
|
+
end
|
76
88
|
|
89
|
+
def test_dlist_with_emlist
|
77
90
|
src = <<HERE
|
78
91
|
: t1
|
79
92
|
c1
|
@@ -102,8 +115,10 @@ c2
|
|
102
115
|
</dd>
|
103
116
|
</dl>
|
104
117
|
HERE
|
105
|
-
|
118
|
+
assert_compiled_source(expected, src)
|
119
|
+
end
|
106
120
|
|
121
|
+
def test_dlist_with_paragraph
|
107
122
|
src = <<HERE
|
108
123
|
: t1
|
109
124
|
c1
|
@@ -128,7 +143,7 @@ c2
|
|
128
143
|
text
|
129
144
|
</p>
|
130
145
|
HERE
|
131
|
-
|
146
|
+
assert_compiled_source(expected, src)
|
132
147
|
end
|
133
148
|
|
134
149
|
def test_pre
|
@@ -146,7 +161,7 @@ hoge
|
|
146
161
|
foo
|
147
162
|
</pre>
|
148
163
|
HERE
|
149
|
-
|
164
|
+
assert_compiled_source(expected, src)
|
150
165
|
|
151
166
|
src = <<'HERE'
|
152
167
|
pretext
|
@@ -160,7 +175,7 @@ pretext
|
|
160
175
|
* hoge1
|
161
176
|
</pre>
|
162
177
|
HERE
|
163
|
-
|
178
|
+
assert_compiled_source(expected, src)
|
164
179
|
end
|
165
180
|
|
166
181
|
def test_method
|
@@ -171,7 +186,7 @@ bar
|
|
171
186
|
text
|
172
187
|
HERE
|
173
188
|
expected = <<'HERE'
|
174
|
-
<dt class="method-heading"><code>hoge</code></dt>
|
189
|
+
<dt class="method-heading" id="dummy"><code>hoge</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>]</span></dt>
|
175
190
|
<dd class="method-description">
|
176
191
|
<p>
|
177
192
|
foo
|
@@ -182,8 +197,10 @@ text
|
|
182
197
|
</pre>
|
183
198
|
</dd>
|
184
199
|
HERE
|
185
|
-
|
200
|
+
assert_compiled_method_source(expected, src)
|
201
|
+
end
|
186
202
|
|
203
|
+
def test_method_with_emlist
|
187
204
|
src = <<'HERE'
|
188
205
|
--- <=>
|
189
206
|
|
@@ -193,7 +210,7 @@ text
|
|
193
210
|
//}
|
194
211
|
HERE
|
195
212
|
expected = <<'HERE'
|
196
|
-
<dt class="method-heading"><code>self <=> </code></dt>
|
213
|
+
<dt class="method-heading" id="dummy"><code>self <=> </code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>]</span></dt>
|
197
214
|
<dd class="method-description">
|
198
215
|
<p>
|
199
216
|
abs
|
@@ -203,8 +220,10 @@ text
|
|
203
220
|
</pre>
|
204
221
|
</dd>
|
205
222
|
HERE
|
206
|
-
|
223
|
+
assert_compiled_method_source(expected, src)
|
224
|
+
end
|
207
225
|
|
226
|
+
def test_method_with_dlist
|
208
227
|
src = <<'HERE'
|
209
228
|
--- method
|
210
229
|
|
@@ -212,7 +231,7 @@ HERE
|
|
212
231
|
dsc
|
213
232
|
HERE
|
214
233
|
expected = <<'HERE'
|
215
|
-
<dt class="method-heading"><code>method</code></dt>
|
234
|
+
<dt class="method-heading" id="dummy"><code>method</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>]</span></dt>
|
216
235
|
<dd class="method-description">
|
217
236
|
<dl>
|
218
237
|
<dt>word1</dt>
|
@@ -224,8 +243,10 @@ dsc
|
|
224
243
|
</dl>
|
225
244
|
</dd>
|
226
245
|
HERE
|
227
|
-
|
246
|
+
assert_compiled_method_source(expected, src)
|
247
|
+
end
|
228
248
|
|
249
|
+
def test_method_with_tags
|
229
250
|
src = <<'HERE'
|
230
251
|
--- method
|
231
252
|
dsc
|
@@ -237,7 +258,7 @@ dsc
|
|
237
258
|
@see hoge
|
238
259
|
HERE
|
239
260
|
expected = <<'HERE'
|
240
|
-
<dt class="method-heading"><code>method</code></dt>
|
261
|
+
<dt class="method-heading" id="dummy"><code>method</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>]</span></dt>
|
241
262
|
<dd class="method-description">
|
242
263
|
<p>
|
243
264
|
dsc
|
@@ -261,8 +282,10 @@ dsc
|
|
261
282
|
</p>
|
262
283
|
</dd>
|
263
284
|
HERE
|
264
|
-
|
285
|
+
assert_compiled_method_source(expected, src)
|
286
|
+
end
|
265
287
|
|
288
|
+
def test_method_with_formatted_text
|
266
289
|
src = <<'HERE'
|
267
290
|
--- method
|
268
291
|
|
@@ -272,7 +295,7 @@ HERE
|
|
272
295
|
dsc3
|
273
296
|
HERE
|
274
297
|
expected = <<'HERE'
|
275
|
-
<dt class="method-heading"><code>method</code></dt>
|
298
|
+
<dt class="method-heading" id="dummy"><code>method</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>]</span></dt>
|
276
299
|
<dd class="method-description">
|
277
300
|
<dl>
|
278
301
|
<dt class='method-param'>[PARAM] arg:</dt>
|
@@ -286,8 +309,10 @@ dsc3
|
|
286
309
|
</pre>
|
287
310
|
</dd>
|
288
311
|
HERE
|
289
|
-
|
312
|
+
assert_compiled_method_source(expected, src)
|
313
|
+
end
|
290
314
|
|
315
|
+
def test_method_with_param_and_emlist
|
291
316
|
src = <<'HERE'
|
292
317
|
--- method
|
293
318
|
|
@@ -298,7 +323,7 @@ dsc3
|
|
298
323
|
//}
|
299
324
|
HERE
|
300
325
|
expected = <<'HERE'
|
301
|
-
<dt class="method-heading"><code>method</code></dt>
|
326
|
+
<dt class="method-heading" id="dummy"><code>method</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>]</span></dt>
|
302
327
|
<dd class="method-description">
|
303
328
|
<dl>
|
304
329
|
<dt class='method-param'>[PARAM] arg:</dt>
|
@@ -312,8 +337,7 @@ dsc3
|
|
312
337
|
</dl>
|
313
338
|
</dd>
|
314
339
|
HERE
|
315
|
-
|
316
|
-
|
340
|
+
assert_compiled_method_source(expected, src)
|
317
341
|
end
|
318
342
|
|
319
343
|
def test_method2
|
@@ -325,7 +349,7 @@ bar
|
|
325
349
|
HERE
|
326
350
|
expected = <<'HERE'
|
327
351
|
<dl>
|
328
|
-
<dt class="method-heading"><code>hoge1</code></dt>
|
352
|
+
<dt class="method-heading" id="dummy"><code>hoge1</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>]</span></dt>
|
329
353
|
<dt class="method-heading"><code>hoge2</code></dt>
|
330
354
|
<dd class="method-description">
|
331
355
|
<p>
|
@@ -334,7 +358,7 @@ bar
|
|
334
358
|
</dd>
|
335
359
|
</dl>
|
336
360
|
HERE
|
337
|
-
|
361
|
+
assert_compiled_method_source(expected, src)
|
338
362
|
end
|
339
363
|
|
340
364
|
def test_ulist
|
@@ -348,7 +372,7 @@ HERE
|
|
348
372
|
<li>hoge2</li>
|
349
373
|
</ul>
|
350
374
|
HERE
|
351
|
-
|
375
|
+
assert_compiled_source(expected, src)
|
352
376
|
|
353
377
|
src = <<'HERE'
|
354
378
|
* hoge1
|
@@ -363,7 +387,7 @@ HERE
|
|
363
387
|
<li>hoge2</li>
|
364
388
|
</ul>
|
365
389
|
HERE
|
366
|
-
|
390
|
+
assert_compiled_source(expected, src)
|
367
391
|
|
368
392
|
src = <<'HERE'
|
369
393
|
* hoge1
|
@@ -377,7 +401,7 @@ bar</li>
|
|
377
401
|
<li>hoge2</li>
|
378
402
|
</ul>
|
379
403
|
HERE
|
380
|
-
|
404
|
+
assert_compiled_source(expected, src)
|
381
405
|
|
382
406
|
end
|
383
407
|
|
@@ -394,7 +418,7 @@ bar</li>
|
|
394
418
|
<li>hoge2</li>
|
395
419
|
</ol>
|
396
420
|
HERE
|
397
|
-
|
421
|
+
assert_compiled_source(expected, src)
|
398
422
|
end
|
399
423
|
|
400
424
|
|
@@ -411,48 +435,43 @@ HERE
|
|
411
435
|
end
|
412
436
|
end
|
413
437
|
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
['[[
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
['[[man:
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
['[[
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
['[[ref:c:Hoge]]', 'compileerror'],
|
452
|
-
['[[ref:ref:hoge/bar#frag]]', 'compileerror'],
|
453
|
-
].each{|src, expected|
|
454
|
-
assert_match /#{expected}/, @c.send(:compile_text, src), src
|
455
|
-
}
|
438
|
+
data("class" => ['[[c:String]]', '<a href="dummy/class/String">String</a>'],
|
439
|
+
"with garbage" => ['[[c:String ]]', '[[c:String ]]'],
|
440
|
+
"missing type" => ['[[String]]', '[[String]]'],
|
441
|
+
"nested class" => ['[[c:File::Stat]]', '<a href="dummy/class/File=Stat">File::Stat</a>'],
|
442
|
+
"singleton method" => ['[[m:String.new]]', '<a href="dummy/method/String/s/new">String.new</a>'],
|
443
|
+
"instance method" => ['[[m:String#dump]]', '<a href="dummy/method/String/i/dump">String#dump</a>'],
|
444
|
+
"indexer" => ['[[m:String#[] ]]', '<a href="dummy/method/String/i/=5b=5d">String#[]</a>'],
|
445
|
+
"C API" => ['[[f:rb_ary_new3]]', '<a href="dummy/function/rb_ary_new3">rb_ary_new3</a>'],
|
446
|
+
"C API root" => ['[[f:/]]', '<a href="dummy/function/">All C API</a>'],
|
447
|
+
"C API index" => ['[[f:_index]]', '<a href="dummy/function/">All C API</a>'],
|
448
|
+
"standard library" => ['[[lib:jcode]]', '<a href="dummy/library/jcode">jcode</a>'],
|
449
|
+
"man command" => ['[[man:tr(1)]]', '<a class="external" href="http://www.opengroup.org/onlinepubs/009695399/utilities/tr.html">tr(1)</a>'],
|
450
|
+
"man header" => ['[[man:sys/socket.h(header)]]', '<a class="external" href="http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html">sys/socket.h(header)</a>'],
|
451
|
+
"man system call" => ['[[man:fopen(3linux)]]', '<a class="external" href="http://man7.org/linux/man-pages/man3/fopen.3.html">fopen(3linux)</a>'],
|
452
|
+
"RFC" => ['[[RFC:2822]]', '<a class="external" href="http://www.ietf.org/rfc/rfc2822.txt">[RFC2822]</a>'],
|
453
|
+
"special var $~" => ['[[m:$~]]', '<a href="dummy/method/Kernel/v/=7e">$~</a>'],
|
454
|
+
"special var $," => ['[[m:$,]]', '<a href="dummy/method/Kernel/v/=2c">$,</a>'],
|
455
|
+
"extra close bracket" => ['[[c:String]]]', '<a href="dummy/class/String">String</a>]'],
|
456
|
+
"continuity" => ['[[c:String]][[c:String]]', '<a href="dummy/class/String">String</a><a href="dummy/class/String">String</a>'],
|
457
|
+
"constant" => ['[[m:File::SEPARATOR]]', '<a href="dummy/method/File/c/SEPARATOR">File::SEPARATOR</a>'],
|
458
|
+
"url" => ['[[url:http://i.loveruby.net]]', '<a class="external" href="http://i.loveruby.net">http://i.loveruby.net</a>'],
|
459
|
+
"ruby-list" => ['[[ruby-list:12345]]', '<a class="external" href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/12345">[ruby-list:12345]</a>'],)
|
460
|
+
def test_bracket_link(data)
|
461
|
+
target, expected = data
|
462
|
+
assert_equal(expected, @c.send(:compile_text, target), target)
|
463
|
+
end
|
464
|
+
|
465
|
+
data("doc" => ['[[d:hoge/bar]]', '<a href="dummy/hoge/bar">.*</a>'],
|
466
|
+
"ref doc" => ['[[ref:d:hoge/bar#frag]]', '<a href="dummy/hoge/bar#frag">.*</a>'],
|
467
|
+
"ref class" => ['[[ref:c:Hoge#frag]]', '<a href="dummy/class/Hoge#frag">.*</a>'],
|
468
|
+
"ref special var" => ['[[ref:m:$~#frag]]', '<a href="dummy/method/Kernel/v/=7e#frag">.*</a>'],
|
469
|
+
"ref library" => ['[[ref:lib:jcode#frag]]', '<a href="dummy/library/jcode#frag">.*</a>'],
|
470
|
+
"ref class" => ['[[ref:c:Hoge]]', 'compileerror'],
|
471
|
+
"ref ref" => ['[[ref:ref:hoge/bar#frag]]', 'compileerror'],)
|
472
|
+
def test_bracket_link_doc(data)
|
473
|
+
target, expected = data
|
474
|
+
assert_match(/#{expected}/, @c.send(:compile_text, target), target)
|
456
475
|
end
|
457
476
|
|
458
477
|
def test_array_join
|
@@ -462,14 +481,14 @@ HERE
|
|
462
481
|
@see [[m:Array#*]], [[m:$,]]
|
463
482
|
HERE
|
464
483
|
expected = <<'HERE'
|
465
|
-
<dt class="method-heading"><code>join(sep = $,) -> String</code></dt>
|
484
|
+
<dt class="method-heading" id="dummy"><code>join(sep = $,) -> String</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>]</span></dt>
|
466
485
|
<dd class="method-description">
|
467
486
|
<p>
|
468
487
|
[SEE_ALSO] <a href="dummy/method/Array/i/=2a">Array#*</a>, <a href="dummy/method/Kernel/v/=2c">$,</a>
|
469
488
|
</p>
|
470
489
|
</dd>
|
471
490
|
HERE
|
472
|
-
|
491
|
+
assert_compiled_method_source(expected, src)
|
473
492
|
end
|
474
493
|
|
475
494
|
def test_todo
|
@@ -480,7 +499,7 @@ HERE
|
|
480
499
|
description
|
481
500
|
HERE
|
482
501
|
expected = <<'HERE'
|
483
|
-
<dt class="method-heading"><code>puts(str) -> String</code></dt>
|
502
|
+
<dt class="method-heading" id="dummy"><code>puts(str) -> String</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>]</span></dt>
|
484
503
|
<dd class="method-description">
|
485
504
|
<p class="todo">
|
486
505
|
[TODO]
|
@@ -490,7 +509,7 @@ description
|
|
490
509
|
</p>
|
491
510
|
</dd>
|
492
511
|
HERE
|
493
|
-
|
512
|
+
assert_compiled_method_source(expected, src)
|
494
513
|
end
|
495
514
|
|
496
515
|
def test_todo_with_comment
|
@@ -501,7 +520,7 @@ HERE
|
|
501
520
|
description
|
502
521
|
HERE
|
503
522
|
expected = <<'HERE'
|
504
|
-
<dt class="method-heading"><code>puts(str) -> String</code></dt>
|
523
|
+
<dt class="method-heading" id="dummy"><code>puts(str) -> String</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>]</span></dt>
|
505
524
|
<dd class="method-description">
|
506
525
|
<p class="todo">
|
507
526
|
[TODO] 1.9.2
|
@@ -511,24 +530,37 @@ description
|
|
511
530
|
</p>
|
512
531
|
</dd>
|
513
532
|
HERE
|
514
|
-
|
533
|
+
assert_compiled_method_source(expected, src)
|
515
534
|
end
|
516
535
|
|
517
|
-
|
536
|
+
|
518
537
|
class BitClust::RDCompiler; public :man_url; end
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
538
|
+
|
539
|
+
data("tr(1)" => {
|
540
|
+
:params => ["1", "tr"],
|
541
|
+
:expected => "http://www.opengroup.org/onlinepubs/009695399/utilities/tr.html"
|
542
|
+
},
|
543
|
+
"fopen(3)" => {
|
544
|
+
:params => ["3", "fopen"],
|
545
|
+
:expected => "http://www.opengroup.org/onlinepubs/009695399/functions/fopen.html"
|
546
|
+
},
|
547
|
+
"sys/socket.h(header)" => {
|
548
|
+
:params => ["header", "sys/socket.h"],
|
549
|
+
:expected => "http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html"
|
550
|
+
},
|
551
|
+
"fopen(3linux)" => {
|
552
|
+
:params => ["3linux", "fopen"],
|
553
|
+
:expected => "http://man7.org/linux/man-pages/man3/fopen.3.html"
|
554
|
+
},
|
555
|
+
"fopen(3freebsd)" => {
|
556
|
+
:params => ["3freebsd", "fopen"],
|
557
|
+
:expected => "http://www.freebsd.org/cgi/man.cgi?query=fopen&sektion=3&manpath=FreeBSD+9.0-RELEASE"
|
558
|
+
},
|
559
|
+
"tr(foo)" => {
|
560
|
+
:params => ["foo", "tr"],
|
561
|
+
:expected => nil
|
562
|
+
})
|
563
|
+
def test_man_url(data)
|
564
|
+
assert_equal(data[:expected], @c.man_url(*data[:params]))
|
533
565
|
end
|
534
566
|
end
|
data/theme/default/style.css
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitclust-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|
@@ -27,6 +27,38 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 2.3.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: test-unit-notify
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: test-unit-rr
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
30
62
|
- !ruby/object:Gem::Dependency
|
31
63
|
name: rack
|
32
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,7 +204,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
204
|
version: '0'
|
173
205
|
segments:
|
174
206
|
- 0
|
175
|
-
hash:
|
207
|
+
hash: 1699377220203508
|
176
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
209
|
none: false
|
178
210
|
requirements:
|
@@ -181,10 +213,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
213
|
version: '0'
|
182
214
|
segments:
|
183
215
|
- 0
|
184
|
-
hash:
|
216
|
+
hash: 1699377220203508
|
185
217
|
requirements: []
|
186
218
|
rubyforge_project: ''
|
187
|
-
rubygems_version: 1.8.
|
219
|
+
rubygems_version: 1.8.23
|
188
220
|
signing_key:
|
189
221
|
specification_version: 3
|
190
222
|
summary: BitClust is a rurema document processor.
|