bitclust-core 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/bitclust/template.offline/class +85 -26
- data/data/bitclust/template.offline/class-index +31 -4
- data/data/bitclust/template.offline/doc +37 -7
- data/data/bitclust/template.offline/function +37 -7
- data/data/bitclust/template.offline/function-index +31 -5
- data/data/bitclust/template.offline/layout +4 -4
- data/data/bitclust/template.offline/library +38 -6
- data/data/bitclust/template.offline/library-index +31 -4
- data/data/bitclust/template.offline/method +52 -10
- data/lib/bitclust/classentry.rb +1 -0
- data/lib/bitclust/completion.rb +1 -0
- data/lib/bitclust/docentry.rb +1 -0
- data/lib/bitclust/libraryentry.rb +3 -1
- data/lib/bitclust/methodentry.rb +5 -4
- data/lib/bitclust/methodid.rb +1 -0
- data/lib/bitclust/nameutils.rb +7 -7
- data/lib/bitclust/preprocessor.rb +2 -2
- data/lib/bitclust/rdcompiler.rb +17 -8
- data/lib/bitclust/requesthandler.rb +3 -3
- data/lib/bitclust/ridatabase.rb +2 -1
- data/lib/bitclust/rrdparser.rb +0 -1
- data/lib/bitclust/screen.rb +30 -2
- data/lib/bitclust/simplesearcher.rb +1 -1
- data/lib/bitclust/subcommands/methods_command.rb +1 -1
- data/lib/bitclust/subcommands/server_command.rb +6 -1
- data/lib/bitclust/subcommands/setup_command.rb +1 -1
- data/lib/bitclust/subcommands/statichtml_command.rb +23 -7
- data/lib/bitclust/syntax_highlighter.rb +4 -3
- data/lib/bitclust/version.rb +1 -1
- data/test/test_bitclust.rb +1 -1
- data/test/test_syntax_highlighter.rb +8 -2
- data/theme/default/rurema.png +0 -0
- data/theme/default/rurema.svg +31 -0
- data/theme/default/script.js +35 -0
- data/theme/default/style.css +65 -0
- metadata +15 -13
@@ -1,16 +1,59 @@
|
|
1
1
|
<%
|
2
2
|
entry = @entries.sort.first
|
3
|
-
@title =
|
3
|
+
@title = entry.label
|
4
4
|
@description = entry.description
|
5
5
|
%>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
<% if @conf[:canonical_base_url] %>
|
7
|
+
<script type="application/ld+json">
|
8
|
+
<%=
|
9
|
+
breadcrumb_json_ld(
|
10
|
+
[
|
11
|
+
{
|
12
|
+
name: manual_home_name,
|
13
|
+
url: absolute_url_to(@urlmapper.document_url('index'))
|
14
|
+
},
|
15
|
+
{
|
16
|
+
name: _('All Libraries'),
|
17
|
+
url: absolute_url_to(library_index_url),
|
18
|
+
},
|
19
|
+
{
|
20
|
+
name: friendly_library_name(entry.library.name),
|
21
|
+
url: absolute_url_to(@urlmapper.library_url(entry.library.name))
|
22
|
+
},
|
23
|
+
{
|
24
|
+
name: _("#{entry.klass.type} %s", entry.klass.name),
|
25
|
+
url: absolute_url_to(@urlmapper.class_url(entry.klass.name))
|
26
|
+
},
|
27
|
+
{
|
28
|
+
name: %Q<#{'$' if entry.typename == :special_variable}#{entry.name}#{" (#{entry.visibility})" unless entry.really_public?}>,
|
29
|
+
url: canonical_url
|
30
|
+
}
|
31
|
+
]
|
32
|
+
)
|
33
|
+
%>
|
34
|
+
</script>
|
35
|
+
<% end %>
|
36
|
+
<header>
|
37
|
+
<nav>
|
38
|
+
<ol class="inline-breadcrumb-list">
|
39
|
+
<li>
|
40
|
+
<%= manual_home_link() %>
|
41
|
+
</li>
|
42
|
+
<li>
|
43
|
+
<a href="<%= library_index_url() %>"><%= _('All Libraries') %></a>
|
44
|
+
</li>
|
45
|
+
<li>
|
46
|
+
<%= friendly_library_link(entry.library.name) %>
|
47
|
+
</li>
|
48
|
+
<li>
|
49
|
+
<%= class_link(entry.klass.name, _(entry.klass.type.to_s + ' %s', entry.klass.name)) %>
|
50
|
+
</li>
|
51
|
+
<li>
|
52
|
+
<% if entry.typename == :special_variable %>$<% end %><%=h entry.name %> <% unless entry.really_public? %>(<%= entry.visibility %>)<% end %>
|
53
|
+
</li>
|
54
|
+
</ol>
|
55
|
+
</nav>
|
56
|
+
</header>
|
14
57
|
|
15
58
|
<% headline_init %>
|
16
59
|
<%= headline("#{entry.type_label} #{entry.label}") %>
|
@@ -25,4 +68,3 @@
|
|
25
68
|
headline_pop
|
26
69
|
%>
|
27
70
|
</dl>
|
28
|
-
|
data/lib/bitclust/classentry.rb
CHANGED
data/lib/bitclust/completion.rb
CHANGED
data/lib/bitclust/docentry.rb
CHANGED
@@ -35,6 +35,7 @@ module BitClust
|
|
35
35
|
@link_checked = false
|
36
36
|
end
|
37
37
|
init_properties
|
38
|
+
@all_classes = nil
|
38
39
|
end
|
39
40
|
|
40
41
|
attr_reader :id, :name
|
@@ -42,6 +43,7 @@ module BitClust
|
|
42
43
|
alias label name
|
43
44
|
|
44
45
|
def ==(other)
|
46
|
+
return false if self.class != other.class
|
45
47
|
@id == other.id
|
46
48
|
end
|
47
49
|
|
@@ -217,5 +219,5 @@ module BitClust
|
|
217
219
|
@db.dirty_library self
|
218
220
|
end
|
219
221
|
end
|
220
|
-
|
222
|
+
end
|
221
223
|
end
|
data/lib/bitclust/methodentry.rb
CHANGED
@@ -29,6 +29,7 @@ module BitClust
|
|
29
29
|
attr_reader :id
|
30
30
|
|
31
31
|
def ==(other)
|
32
|
+
return false if self.class != other.class
|
32
33
|
@id == other.id
|
33
34
|
end
|
34
35
|
|
@@ -101,7 +102,7 @@ module BitClust
|
|
101
102
|
}
|
102
103
|
|
103
104
|
def inspect
|
104
|
-
c, t,
|
105
|
+
c, t, _m, _lib = methodid2specparts(@id)
|
105
106
|
"\#<method #{c}#{t}#{names().join(',')}>"
|
106
107
|
end
|
107
108
|
|
@@ -114,12 +115,12 @@ module BitClust
|
|
114
115
|
end
|
115
116
|
|
116
117
|
def label
|
117
|
-
c, t, m,
|
118
|
+
c, t, m, _lib = methodid2specparts(@id)
|
118
119
|
"#{t == '$' ? '' : c}#{t}#{m}"
|
119
120
|
end
|
120
121
|
|
121
122
|
def short_label
|
122
|
-
|
123
|
+
_c, t, m, _lib = methodid2specparts(@id)
|
123
124
|
"#{t == '#' ? '' : t}#{m}"
|
124
125
|
end
|
125
126
|
|
@@ -128,7 +129,7 @@ module BitClust
|
|
128
129
|
end
|
129
130
|
|
130
131
|
def labels
|
131
|
-
c, t,
|
132
|
+
c, t, _m, _lib = methodid2specparts(@id)
|
132
133
|
names().map {|name| "#{c}#{t}#{name}" }
|
133
134
|
end
|
134
135
|
|
data/lib/bitclust/methodid.rb
CHANGED
data/lib/bitclust/nameutils.rb
CHANGED
@@ -67,7 +67,7 @@ module BitClust
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def methodid2specstring(id)
|
70
|
-
c, t, m,
|
70
|
+
c, t, m, _lib = *split_method_id(id)
|
71
71
|
classid2name(c) + typechar2mark(t) + decodename_url(m)
|
72
72
|
end
|
73
73
|
|
@@ -77,32 +77,32 @@ module BitClust
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def methodid2libid(id)
|
80
|
-
|
80
|
+
_c, _t, _m, lib = *split_method_id(id)
|
81
81
|
lib
|
82
82
|
end
|
83
83
|
|
84
84
|
def methodid2classid(id)
|
85
|
-
c,
|
85
|
+
c, _t, _m, _lib = *split_method_id(id)
|
86
86
|
c
|
87
87
|
end
|
88
88
|
|
89
89
|
def methodid2typechar(id)
|
90
|
-
|
90
|
+
_c, t, _m, _lib = *split_method_id(id)
|
91
91
|
t
|
92
92
|
end
|
93
93
|
|
94
94
|
def methodid2typename(id)
|
95
|
-
|
95
|
+
_c, t, _m, _lib = *split_method_id(id)
|
96
96
|
typechar2name(t)
|
97
97
|
end
|
98
98
|
|
99
99
|
def methodid2typemark(id)
|
100
|
-
|
100
|
+
_c, t, _m, _lib = *split_method_id(id)
|
101
101
|
typechar2mark(t)
|
102
102
|
end
|
103
103
|
|
104
104
|
def methodid2mname(id)
|
105
|
-
|
105
|
+
_c, _t, m, _lib = *split_method_id(id)
|
106
106
|
decodename_url(m)
|
107
107
|
end
|
108
108
|
|
@@ -86,7 +86,7 @@ module BitClust
|
|
86
86
|
file = $1.strip
|
87
87
|
basedir = File.dirname(line.location.file)
|
88
88
|
@buf.concat Preprocessor.process("#{basedir}/#{file}", @params)
|
89
|
-
rescue Errno::ENOENT =>
|
89
|
+
rescue Errno::ENOENT => _err
|
90
90
|
raise WrongInclude, "#{line.location}: \#@include'ed file not exist: #{file}"
|
91
91
|
end
|
92
92
|
when /\A\#@since\b/
|
@@ -321,7 +321,7 @@ module BitClust
|
|
321
321
|
file = $1.strip
|
322
322
|
basedir = File.dirname(line.location.file)
|
323
323
|
@buf.concat LineCollector.process("#{basedir}/#{file}")
|
324
|
-
rescue Errno::ENOENT =>
|
324
|
+
rescue Errno::ENOENT => _err
|
325
325
|
raise WrongInclude, "#{line.location}: \#@include'ed file not exist: #{file}"
|
326
326
|
end
|
327
327
|
else
|
data/lib/bitclust/rdcompiler.rb
CHANGED
@@ -229,9 +229,9 @@ module BitClust
|
|
229
229
|
case @f.peek
|
230
230
|
when /\A$/
|
231
231
|
@f.gets
|
232
|
-
when /\A[ \t
|
232
|
+
when /\A[ \t]/
|
233
233
|
line '<p>'
|
234
|
-
line compile_text(text_node_from_lines(@f.span(/\A[ \t
|
234
|
+
line compile_text(text_node_from_lines(@f.span(/\A[ \t]/)))
|
235
235
|
line '</p>'
|
236
236
|
when %r!\A//emlist(?:\[(?:[^\[\]]+?)?\]\[\w+?\])?\{!
|
237
237
|
emlist
|
@@ -247,8 +247,8 @@ module BitClust
|
|
247
247
|
line '<dd>'
|
248
248
|
while /\A[ \t]/ =~ @f.peek or %r!\A//emlist(?:\[(?:[^\[\]]+?)?\]\[\w+?\])?\{! =~ @f.peek
|
249
249
|
case @f.peek
|
250
|
-
when /\A[ \t
|
251
|
-
line compile_text(text_node_from_lines(@f.span(/\A[ \t
|
250
|
+
when /\A[ \t]/
|
251
|
+
line compile_text(text_node_from_lines(@f.span(/\A[ \t]/)))
|
252
252
|
when %r!\A//emlist(?:\[(?:[^\[\]]+?)?\]\[\w+?\])?\{!
|
253
253
|
emlist
|
254
254
|
end
|
@@ -260,6 +260,11 @@ module BitClust
|
|
260
260
|
"<dt>#{s}</dt>"
|
261
261
|
end
|
262
262
|
|
263
|
+
def stop_on_syntax_error?
|
264
|
+
return true unless @option.key?(:stop_on_syntax_error)
|
265
|
+
@option[:stop_on_syntax_error]
|
266
|
+
end
|
267
|
+
|
263
268
|
def emlist
|
264
269
|
command = @f.gets
|
265
270
|
if %r!\A//emlist\[(?<caption>[^\[\]]+?)?\]\[(?<lang>\w+?)\]! =~ command
|
@@ -276,7 +281,11 @@ module BitClust
|
|
276
281
|
string BitClust::SyntaxHighlighter.new(src, filename).highlight
|
277
282
|
rescue BitClust::SyntaxHighlighter::Error => ex
|
278
283
|
$stderr.puts ex.message
|
279
|
-
|
284
|
+
if stop_on_syntax_error?
|
285
|
+
exit(false)
|
286
|
+
else
|
287
|
+
string src
|
288
|
+
end
|
280
289
|
end
|
281
290
|
else
|
282
291
|
string src
|
@@ -319,7 +328,7 @@ module BitClust
|
|
319
328
|
|
320
329
|
def see
|
321
330
|
header = @f.gets
|
322
|
-
|
331
|
+
header.slice!(/\A\@\w+/)
|
323
332
|
body = [header] + @f.span(/\A\s+\S/)
|
324
333
|
line '<p>'
|
325
334
|
line '[SEE_ALSO] ' + compile_text(text_node_from_lines(body))
|
@@ -328,7 +337,7 @@ module BitClust
|
|
328
337
|
|
329
338
|
def todo
|
330
339
|
header = @f.gets
|
331
|
-
|
340
|
+
header.slice!(/\A\@\w+/)
|
332
341
|
body = header
|
333
342
|
line '<p class="todo">'
|
334
343
|
line '[TODO]' + body
|
@@ -544,7 +553,7 @@ module BitClust
|
|
544
553
|
end
|
545
554
|
|
546
555
|
def rdoc_url(method_id, version)
|
547
|
-
cname, tmark, mname,
|
556
|
+
cname, tmark, mname, _libname = methodid2specparts(method_id)
|
548
557
|
tchar = typemark2char(tmark) == 'i' ? 'i' : 'c'
|
549
558
|
cname = cname.split(".").first
|
550
559
|
cname = cname.gsub('::', '/')
|
@@ -207,7 +207,7 @@ module BitClust
|
|
207
207
|
end
|
208
208
|
|
209
209
|
def defined_type?
|
210
|
-
type,
|
210
|
+
type, _param = parse_path_info()
|
211
211
|
case type
|
212
212
|
when 'library', 'class', 'method', 'function', 'search', 'opensearchdescription'
|
213
213
|
true
|
@@ -217,7 +217,7 @@ module BitClust
|
|
217
217
|
end
|
218
218
|
|
219
219
|
def type_id
|
220
|
-
type,
|
220
|
+
type, _param = parse_path_info()
|
221
221
|
type.intern if type
|
222
222
|
end
|
223
223
|
|
@@ -256,7 +256,7 @@ module BitClust
|
|
256
256
|
private
|
257
257
|
|
258
258
|
def type_param
|
259
|
-
|
259
|
+
_type, param = parse_path_info()
|
260
260
|
return nil unless param
|
261
261
|
return nil if param.empty?
|
262
262
|
param
|
data/lib/bitclust/ridatabase.rb
CHANGED
@@ -71,6 +71,7 @@ class Ent
|
|
71
71
|
attr_reader :entry
|
72
72
|
|
73
73
|
def ==(other)
|
74
|
+
return false if self.class != other.class
|
74
75
|
@name == other.name
|
75
76
|
end
|
76
77
|
|
@@ -121,7 +122,7 @@ class RiMethodEntry < Ent
|
|
121
122
|
end
|
122
123
|
|
123
124
|
def fullname
|
124
|
-
c, t
|
125
|
+
c, t = @entry.fullname.split(/([\.\#])/, 2)
|
125
126
|
"#{c}#{t}#{@name}"
|
126
127
|
end
|
127
128
|
end
|
data/lib/bitclust/rrdparser.rb
CHANGED
data/lib/bitclust/screen.rb
CHANGED
@@ -13,7 +13,9 @@ require 'bitclust/htmlutils'
|
|
13
13
|
require 'bitclust/nameutils'
|
14
14
|
require 'bitclust/messagecatalog'
|
15
15
|
require 'erb'
|
16
|
+
require 'json'
|
16
17
|
require 'stringio'
|
18
|
+
require 'uri'
|
17
19
|
|
18
20
|
module BitClust
|
19
21
|
|
@@ -185,7 +187,7 @@ module BitClust
|
|
185
187
|
private
|
186
188
|
|
187
189
|
def preproc(template)
|
188
|
-
template.gsub(/^\.include ([\w\-]+)/) { load($1
|
190
|
+
template.gsub(/^\.include ([\w\-]+)/) { load($1) }
|
189
191
|
end
|
190
192
|
end
|
191
193
|
|
@@ -415,8 +417,12 @@ module BitClust
|
|
415
417
|
end
|
416
418
|
end
|
417
419
|
|
420
|
+
def manual_home_name
|
421
|
+
_('Ruby %s Reference Manual', ruby_version())
|
422
|
+
end
|
423
|
+
|
418
424
|
def manual_home_link
|
419
|
-
document_link('index',
|
425
|
+
document_link('index', manual_home_name)
|
420
426
|
end
|
421
427
|
|
422
428
|
def friendly_library_link(id)
|
@@ -452,6 +458,28 @@ module BitClust
|
|
452
458
|
yield sigs, body
|
453
459
|
end
|
454
460
|
end
|
461
|
+
|
462
|
+
def breadcrumb_json_ld(items)
|
463
|
+
{
|
464
|
+
'@context': 'http://schema.org',
|
465
|
+
'@type': 'BreadcrumbList',
|
466
|
+
'itemListElement' => items.map.with_index(1) do |item, index|
|
467
|
+
{
|
468
|
+
'@type' => 'ListItem',
|
469
|
+
'item' => item[:url],
|
470
|
+
'name' => item[:name],
|
471
|
+
'position' => index
|
472
|
+
}
|
473
|
+
end
|
474
|
+
}.to_json
|
475
|
+
end
|
476
|
+
|
477
|
+
def absolute_url_to(path)
|
478
|
+
::URI.join(
|
479
|
+
canonical_url,
|
480
|
+
path
|
481
|
+
)
|
482
|
+
end
|
455
483
|
end
|
456
484
|
|
457
485
|
class IndexScreen < TemplateScreen
|
@@ -13,7 +13,7 @@ module BitClust
|
|
13
13
|
pat = to_pattern(pat)
|
14
14
|
return [] if pat.empty? or /\A\s+\z/ =~ pat
|
15
15
|
cname, type, mname = parse_method_spec_pattern(pat)
|
16
|
-
|
16
|
+
cs = ms = []
|
17
17
|
if cname and not cname.empty?
|
18
18
|
if mname
|
19
19
|
ms = find_class_method(db, cname, type, mname)
|
@@ -27,7 +27,12 @@ module BitClust
|
|
27
27
|
@srcdir = @datadir = @themedir = @theme = @templatedir = nil
|
28
28
|
@encoding = 'utf-8' # encoding of view
|
29
29
|
if Object.const_defined?(:Encoding)
|
30
|
-
|
30
|
+
begin
|
31
|
+
verbose, $VERBOSE = $VERBOSE, false
|
32
|
+
Encoding.default_external = @encoding
|
33
|
+
ensure
|
34
|
+
$VERBOSE = verbose
|
35
|
+
end
|
31
36
|
end
|
32
37
|
|
33
38
|
@debugp = false
|