bitclust-core 1.2.1 → 1.2.6

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/data/bitclust/catalog/ja_JP.UTF-8 +4 -0
  3. data/data/bitclust/template.lillia/layout +1 -1
  4. data/data/bitclust/template.offline/class +127 -34
  5. data/data/bitclust/template.offline/class-index +33 -6
  6. data/data/bitclust/template.offline/doc +41 -8
  7. data/data/bitclust/template.offline/function +42 -9
  8. data/data/bitclust/template.offline/function-index +33 -7
  9. data/data/bitclust/template.offline/layout +21 -14
  10. data/data/bitclust/template.offline/library +48 -12
  11. data/data/bitclust/template.offline/library-index +33 -6
  12. data/data/bitclust/template.offline/method +56 -11
  13. data/lib/bitclust/classentry.rb +13 -2
  14. data/lib/bitclust/compat.rb +8 -0
  15. data/lib/bitclust/completion.rb +1 -0
  16. data/lib/bitclust/docentry.rb +4 -2
  17. data/lib/bitclust/entry.rb +3 -0
  18. data/lib/bitclust/functionentry.rb +8 -7
  19. data/lib/bitclust/functionreferenceparser.rb +2 -0
  20. data/lib/bitclust/libraryentry.rb +4 -1
  21. data/lib/bitclust/lineinput.rb +6 -2
  22. data/lib/bitclust/methoddatabase.rb +3 -0
  23. data/lib/bitclust/methodentry.rb +10 -8
  24. data/lib/bitclust/methodid.rb +1 -0
  25. data/lib/bitclust/nameutils.rb +15 -11
  26. data/lib/bitclust/preprocessor.rb +26 -21
  27. data/lib/bitclust/rdcompiler.rb +29 -19
  28. data/lib/bitclust/requesthandler.rb +3 -3
  29. data/lib/bitclust/ridatabase.rb +2 -1
  30. data/lib/bitclust/rrdparser.rb +19 -20
  31. data/lib/bitclust/screen.rb +39 -4
  32. data/lib/bitclust/silent_progress_bar.rb +8 -4
  33. data/lib/bitclust/simplesearcher.rb +1 -1
  34. data/lib/bitclust/subcommand.rb +9 -0
  35. data/lib/bitclust/subcommands/chm_command.rb +3 -3
  36. data/lib/bitclust/subcommands/methods_command.rb +1 -1
  37. data/lib/bitclust/subcommands/server_command.rb +6 -1
  38. data/lib/bitclust/subcommands/setup_command.rb +2 -2
  39. data/lib/bitclust/subcommands/statichtml_command.rb +44 -21
  40. data/lib/bitclust/syntax_highlighter.rb +5 -3
  41. data/lib/bitclust/version.rb +1 -1
  42. data/test/test_bitclust.rb +1 -1
  43. data/test/test_entry.rb +14 -1
  44. data/test/test_functionreferenceparser.rb +4 -4
  45. data/test/test_preprocessor.rb +21 -0
  46. data/test/test_rdcompiler.rb +240 -0
  47. data/test/test_rrdparser.rb +16 -0
  48. data/test/test_syntax_highlighter.rb +22 -4
  49. data/theme/default/rurema.png +0 -0
  50. data/theme/default/rurema.svg +31 -0
  51. data/theme/default/script.js +34 -0
  52. data/theme/default/style.css +112 -8
  53. metadata +32 -19
@@ -1,25 +1,32 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="ja-JP">
3
3
  <head>
4
- <%= google_tag_manager %>
5
- <%= meta_robots %>
6
- <meta http-equiv="Content-Type" content="text/html; charset=<%=h charset() %>">
7
- <meta http-equiv="Content-Language" content="ja-JP">
8
- <link rel="stylesheet" type="text/css" href="<%=h css_url() %>">
9
- <link rel="stylesheet" type="text/css" href="<%=h custom_css_url("syntax-highlight.css") %>">
10
- <link rel="icon" type="image/png" href="<%=h favicon_url() %>">
11
- <% if @conf[:canonical_base_url] %>
12
- <link rel="canonical" href="<%= canonical_url() %>">
13
- <% end %>
14
- <title><%=h @title %> (Ruby <%=h ruby_version %>)</title>
15
- <meta name="description" content="<%=h @description %>">
4
+ <%= google_tag_manager %>
5
+ <%= meta_robots %>
6
+ <meta charset="<%=h charset() %>">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <link rel="stylesheet" href="<%=h css_url() %>">
9
+ <link rel="stylesheet" href="<%=h custom_css_url("syntax-highlight.css") %>">
10
+ <link rel="icon" type="image/png" href="<%=h favicon_url() %>">
11
+ <% if @conf[:canonical_base_url] %>
12
+ <link rel="canonical" href="<%= canonical_url() %>">
13
+ <% end %>
14
+ <title><%=h @title %> (Ruby <%=h ruby_version %> リファレンスマニュアル)</title>
15
+ <meta name="description" content="<%=h @description %>">
16
+ <script src="<%=h custom_js_url('script.js') %>"></script>
16
17
  </head>
17
18
  <body>
18
19
  <%= yield %>
19
- <div id="footer">
20
+ <footer id="footer">
20
21
  <a rel="license" href="https://creativecommons.org/licenses/by/3.0/">
21
22
  <img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/3.0/88x31.png" />
22
23
  </a>
23
- </div>
24
+
25
+ <a href="https://github.com/rurema/doctree/issues/new" id="feedback-link">フィードバックを送る</a>
26
+ <% if defined?(@edit_url) && @edit_url %>
27
+ / <a href="<%= @edit_url %>">このマニュアルを編集する</a>
28
+ <% end %>
29
+ <script>if (window.URLSearchParams) { document.getElementById("feedback-link").search = new URLSearchParams({'body': document.location}); }</script>
30
+ </footer>
24
31
  </body>
25
32
  </html>
@@ -1,17 +1,49 @@
1
1
  <%
2
2
  @title = "library #{@entry.name}"
3
3
  @description = @entry.description
4
+ @edit_url = edit_url(@entry.source_location) if @conf[:edit_base_url] && @entry.source_location
4
5
  %>
5
- <p>
6
- <%= manual_home_link() %>
7
- &gt; <a href="<%= library_index_url() %>"><%= _('All Libraries') %></a>
8
- &gt; <%= friendly_library_name(@entry.name) %>
9
- </p>
10
- <%
11
- headline_init
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.name),
21
+ url: canonical_url
22
+ }
23
+ ]
24
+ )
12
25
  %>
13
- <%= headline(@entry.id == '_builtin' ? _('Builtin Library') : "library #{@entry.name}") %>
26
+ </script>
27
+ <% end %>
28
+ <header>
29
+ <nav>
30
+ <ol class="inline-breadcrumb-list">
31
+ <li>
32
+ <%= manual_home_link() %>
33
+ </li>
34
+ <li>
35
+ <a href="<%= library_index_url() %>"><%= _('All Libraries') %></a>
36
+ </li>
37
+ <li>
38
+ <%= friendly_library_name(@entry.name) %>
39
+ </li>
40
+ </ol>
41
+ </nav>
42
+ <% headline_init %>
43
+ <%= headline(@entry.id == '_builtin' ? _('Builtin Library') : "library #{@entry.name}", edit_url: @edit_url) %>
44
+ </header>
14
45
 
46
+ <main>
15
47
  <%
16
48
  headline_push
17
49
  all_classes = @entry.all_classes
@@ -66,13 +98,17 @@
66
98
  end
67
99
  %>
68
100
  <%
69
- ents = @entry.methods.sort
101
+ ents = @entry.methods.flat_map do |m|
102
+ c, t, n, = methodid2specparts(m.id)
103
+ prefix = (t == '$' ? '' : c) + t
104
+ m.names.map { |name| [prefix + name, c + t + n] }
105
+ end.sort
70
106
  unless ents.empty? %>
71
107
  <%= headline(_("Added/Redefined Methods")) %>
72
108
  <p><code>
73
- <% ents.each do |m| %>
74
- <%= link_to_method(m, true) %>
109
+ <% ents.each do |label, spec| %>
110
+ <%= method_link(spec, label) %>
75
111
  <% end %>
76
112
  </code></p>
77
113
  <% end %>
78
-
114
+ </main>
@@ -2,14 +2,40 @@
2
2
  @title = _('Library Index')
3
3
  @description = _('Library Index')
4
4
  %>
5
- <p>
6
- <%= manual_home_link() %>
7
- &gt; <%= _("All Libraries") %>
8
- </p>
9
- <%
10
- headline_init
5
+ <% if @conf[:canonical_base_url] %>
6
+ <script type="application/ld+json">
7
+ <%=
8
+ breadcrumb_json_ld(
9
+ [
10
+ {
11
+ name: manual_home_name,
12
+ url: absolute_url_to(@urlmapper.document_url('index'))
13
+ },
14
+ {
15
+ name: _('All Libraries'),
16
+ url: canonical_url
17
+ }
18
+ ]
19
+ )
11
20
  %>
21
+ </script>
22
+ <% end %>
23
+ <header>
24
+ <nav>
25
+ <ol class="inline-breadcrumb-list">
26
+ <li>
27
+ <%= manual_home_link() %>
28
+ </li>
29
+ <li>
30
+ <%= _('All Libraries') %>
31
+ </li>
32
+ </ol>
33
+ </nav>
34
+ <% headline_init %>
12
35
  <%= headline(_("Library Index")) %>
36
+ </header>
37
+
38
+ <main>
13
39
  <%
14
40
  headline_push
15
41
  weight = {"Builtin" => "", "" => "\x7f\x7f"}
@@ -48,3 +74,4 @@
48
74
  end
49
75
  headline_pop
50
76
  %>
77
+ </main>
@@ -1,19 +1,64 @@
1
1
  <%
2
2
  entry = @entries.sort.first
3
- @title = "#{entry.type_label} #{entry.label}"
3
+ @title = entry.label
4
4
  @description = entry.description
5
+ @edit_url = edit_url(entry.source_location) if @conf[:edit_base_url] && entry.source_location
5
6
  %>
6
- <p>
7
- <%= manual_home_link() %>
8
- &gt; <a href="<%= library_index_url() %>"><%= _('All Libraries') %></a>
9
- &gt; <%= friendly_library_link(entry.library.name) %>
10
- &gt; <%= class_link(entry.klass.name, _(entry.klass.type.to_s + ' %s', entry.klass.name)) %>
11
- &gt; <% if entry.typename == :special_variable %>$<% end %><%=h entry.name %>
12
- <% unless entry.really_public? %>(<%= entry.visibility %>)<% end %>
13
- </p>
14
-
7
+ <% if @conf[:canonical_base_url] %>
8
+ <script type="application/ld+json">
9
+ <%=
10
+ breadcrumb_json_ld(
11
+ [
12
+ {
13
+ name: manual_home_name,
14
+ url: absolute_url_to(@urlmapper.document_url('index'))
15
+ },
16
+ {
17
+ name: _('All Libraries'),
18
+ url: absolute_url_to(library_index_url),
19
+ },
20
+ {
21
+ name: friendly_library_name(entry.library.name),
22
+ url: absolute_url_to(@urlmapper.library_url(entry.library.name))
23
+ },
24
+ {
25
+ name: _("#{entry.klass.type} %s", entry.klass.name),
26
+ url: absolute_url_to(@urlmapper.class_url(entry.klass.name))
27
+ },
28
+ {
29
+ name: %Q<#{'$' if entry.typename == :special_variable}#{entry.name}#{" (#{entry.visibility})" unless entry.really_public?}>,
30
+ url: canonical_url
31
+ }
32
+ ]
33
+ )
34
+ %>
35
+ </script>
36
+ <% end %>
37
+ <header>
38
+ <nav>
39
+ <ol class="inline-breadcrumb-list">
40
+ <li>
41
+ <%= manual_home_link() %>
42
+ </li>
43
+ <li>
44
+ <a href="<%= library_index_url() %>"><%= _('All Libraries') %></a>
45
+ </li>
46
+ <li>
47
+ <%= friendly_library_link(entry.library.name) %>
48
+ </li>
49
+ <li>
50
+ <%= class_link(entry.klass.name, _(entry.klass.type.to_s + ' %s', entry.klass.name)) %>
51
+ </li>
52
+ <li>
53
+ <% if entry.typename == :special_variable %>$<% end %><%=h entry.name %> <% unless entry.really_public? %>(<%= entry.visibility %>)<% end %>
54
+ </li>
55
+ </ol>
56
+ </nav>
15
57
  <% headline_init %>
16
58
  <%= headline("#{entry.type_label} #{entry.label}") %>
59
+ </header>
60
+
61
+ <main>
17
62
  <dl class="methodlist">
18
63
  <%
19
64
  headline_push
@@ -25,4 +70,4 @@
25
70
  headline_pop
26
71
  %>
27
72
  </dl>
28
-
73
+ </main>
@@ -39,6 +39,7 @@ module BitClust
39
39
  attr_reader :id
40
40
 
41
41
  def ==(other)
42
+ return false if self.class != other.class
42
43
  @id == other.id
43
44
  end
44
45
 
@@ -87,6 +88,7 @@ module BitClust
87
88
  property :aliases, '[ClassEntry]'
88
89
  property :aliasof, 'ClassEntry'
89
90
  property :source, 'String'
91
+ property :source_location, 'Location'
90
92
  }
91
93
 
92
94
  # FIXME: do not use superclass property aliasing (#6826)
@@ -209,8 +211,14 @@ module BitClust
209
211
 
210
212
  def ancestors
211
213
  @ancestors ||=
214
+ if self.object? && superclass()
215
+ myself, *ancestors = superclass().ancestors
216
+ [ myself, included().map {|m| m.ancestors },
217
+ ancestors ].flatten
218
+ else
212
219
  [ self, included().map {|m| m.ancestors },
213
220
  superclass() ? superclass().ancestors : [] ].flatten
221
+ end
214
222
  end
215
223
 
216
224
  def included_modules
@@ -246,7 +254,7 @@ module BitClust
246
254
  :instance_methods, :private_instance_methods,
247
255
  :module_functions,
248
256
  :constants, :special_variables,
249
- :added)
257
+ :added, :undefined)
250
258
 
251
259
  def partitioned_entries(level = 0)
252
260
  s = []; spv = []
@@ -254,6 +262,7 @@ module BitClust
254
262
  mf = []
255
263
  c = []; v = []
256
264
  added = []
265
+ undefined = []
257
266
  entries(level).sort_by(&:name).each do |m|
258
267
  case m.kind
259
268
  when :defined, :redefined
@@ -273,9 +282,11 @@ module BitClust
273
282
  end
274
283
  when :added
275
284
  added.push m
285
+ when :undefined
286
+ undefined.push m
276
287
  end
277
288
  end
278
- Parts.new(s,spv, i,ipv, mf, c, v, added)
289
+ Parts.new(s,spv, i,ipv, mf, c, v, added, undefined)
279
290
  end
280
291
 
281
292
  def singleton_methods(level = 0)
@@ -26,6 +26,14 @@ unless String.method_defined?(:bytesize)
26
26
  end
27
27
  end
28
28
 
29
+ unless String.method_defined?(:match?)
30
+ class String
31
+ def match?(pattern, pos = 0)
32
+ !match(pattern, pos).nil?
33
+ end
34
+ end
35
+ end
36
+
29
37
  def fopen(*args, &block)
30
38
  option = args[1]
31
39
  if option and !Object.const_defined?(:Encoding)
@@ -499,6 +499,7 @@ $cm_comb_m += 1
499
499
  end
500
500
 
501
501
  def ==(other)
502
+ return false if self.class != other.class
502
503
  @idstring == other.idstring
503
504
  end
504
505
 
@@ -28,6 +28,7 @@ module BitClust
28
28
  attr_reader :id
29
29
 
30
30
  def ==(other)
31
+ return false if self.class != other.class
31
32
  @id == other.id
32
33
  end
33
34
 
@@ -56,8 +57,9 @@ module BitClust
56
57
  end
57
58
 
58
59
  persistent_properties {
59
- property :title, 'String'
60
- property :source, 'String'
60
+ property :title, 'String'
61
+ property :source, 'String'
62
+ property :source_location, 'Location'
61
63
  }
62
64
 
63
65
  def inspect
@@ -98,6 +98,7 @@ module BitClust
98
98
  when '[LibraryEntry]' then "[]"
99
99
  when '[ClassEntry]' then "[]"
100
100
  when '[MethodEntry]' then "[]"
101
+ when 'Location' then "nil"
101
102
  else
102
103
  raise "must not happen: @type=#{@type.inspect}"
103
104
  end
@@ -115,6 +116,7 @@ module BitClust
115
116
  when '[LibraryEntry]' then "restore_libraries(h['#{@name}'])"
116
117
  when '[ClassEntry]' then "restore_classes(h['#{@name}'])"
117
118
  when '[MethodEntry]' then "restore_methods(h['#{@name}'])"
119
+ when 'Location' then "h['#{@name}']&.tap { |loc| break if loc.empty?; break Location.new(*loc.split(?:)) }"
118
120
  else
119
121
  raise "must not happen: @type=#{@type.inspect}"
120
122
  end
@@ -132,6 +134,7 @@ module BitClust
132
134
  when '[LibraryEntry]' then "serialize_entries(@#{@name})"
133
135
  when '[ClassEntry]' then "serialize_entries(@#{@name})"
134
136
  when '[MethodEntry]' then "serialize_entries(@#{@name})"
137
+ when 'Location' then "@#@name.to_s"
135
138
  else
136
139
  raise "must not happen: @type=#{@type.inspect}"
137
140
  end
@@ -37,13 +37,14 @@ module BitClust
37
37
  end
38
38
 
39
39
  persistent_properties {
40
- property :filename, 'String'
41
- property :macro, 'bool'
42
- property :private, 'bool'
43
- property :type, 'String'
44
- property :name, 'String'
45
- property :params, 'String'
46
- property :source, 'String'
40
+ property :filename, 'String'
41
+ property :macro, 'bool'
42
+ property :private, 'bool'
43
+ property :type, 'String'
44
+ property :name, 'String'
45
+ property :params, 'String'
46
+ property :source, 'String'
47
+ property :source_location, 'Location'
47
48
  }
48
49
 
49
50
  attr_reader :id
@@ -34,6 +34,7 @@ module BitClust
34
34
 
35
35
  def parse(f, filename, params = {})
36
36
  @filename = filename
37
+ @path = f.path
37
38
  s = Preprocessor.read(f, params)
38
39
  file_entries LineInput.for_string(s)
39
40
  @db.functions
@@ -59,6 +60,7 @@ module BitClust
59
60
  f.name = h.name
60
61
  f.params = h.params
61
62
  f.source = body.join('')
63
+ f.source_location = body[0]&.location&.tap {|loc| break Location.new(@path, loc.line - 1) }
62
64
  }
63
65
  end
64
66
 
@@ -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
 
@@ -71,6 +73,7 @@ module BitClust
71
73
  property :sublibraries, '[LibraryEntry]'
72
74
  property :is_sublibrary, 'bool'
73
75
  property :category, 'String'
76
+ property :source_location, 'Location'
74
77
  }
75
78
 
76
79
  def inspect
@@ -217,5 +220,5 @@ module BitClust
217
220
  @db.dirty_library self
218
221
  end
219
222
  end
220
- end
223
+ end
221
224
  end