bitclust-core 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/data/bitclust/template.offline/layout +2 -0
- data/lib/bitclust/nameutils.rb +6 -2
- data/lib/bitclust/preprocessor.rb +14 -13
- data/lib/bitclust/rdcompiler.rb +10 -13
- data/lib/bitclust/silent_progress_bar.rb +8 -4
- data/lib/bitclust/subcommand.rb +9 -0
- data/lib/bitclust/subcommands/chm_command.rb +3 -3
- data/lib/bitclust/subcommands/setup_command.rb +1 -1
- data/lib/bitclust/subcommands/statichtml_command.rb +12 -14
- data/lib/bitclust/version.rb +1 -1
- data/test/test_functionreferenceparser.rb +4 -4
- data/test/test_preprocessor.rb +21 -0
- data/test/test_rdcompiler.rb +240 -0
- data/test/test_syntax_highlighter.rb +4 -4
- data/theme/default/style.css +10 -8
- metadata +24 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a07096751a66168972975f5aa732d470cc72e139e0ac59cf94a29d1dbd1a589e
|
4
|
+
data.tar.gz: ab596caaca4be81031f7bc326e9ba05f48c1027046788123bcaf049f4e576e7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 774d173f3ea9e6d0a33beb8e3de32cae7721483b7e7c247680a47f12a22d122379bfddab718eb1ba0d543b2a29d33a72efc945d63ea1ffd83d014cbb590a7db1
|
7
|
+
data.tar.gz: e04a73ccfb8f960e874957530140f0a3e3ca1a6c13178957640c89d9d0adbeb68e4be4ec9ece7b98c22d6101d9b7bb123595ee476d5cb85131e6c4150a5316df
|
@@ -20,6 +20,8 @@
|
|
20
20
|
<a rel="license" href="https://creativecommons.org/licenses/by/3.0/">
|
21
21
|
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/3.0/88x31.png" />
|
22
22
|
</a>
|
23
|
+
|
24
|
+
フィードバックは<a href="https://github.com/rurema/doctree">こちら</a>
|
23
25
|
</div>
|
24
26
|
</body>
|
25
27
|
</html>
|
data/lib/bitclust/nameutils.rb
CHANGED
@@ -120,10 +120,14 @@ module BitClust
|
|
120
120
|
"#{cid}/#{typename2char(t)}.#{encodename_url(name)}.#{libid}"
|
121
121
|
end
|
122
122
|
|
123
|
+
@@split_method_id = {}
|
124
|
+
|
123
125
|
# private module function
|
124
126
|
def split_method_id(id)
|
125
|
-
|
126
|
-
|
127
|
+
@@split_method_id[id] ||= begin
|
128
|
+
c, rest = id.split("/")
|
129
|
+
[c, *rest.split(%r<[/\.]>, 3)]
|
130
|
+
end
|
127
131
|
end
|
128
132
|
|
129
133
|
NAME_TO_MARK = {
|
@@ -149,7 +149,7 @@ module BitClust
|
|
149
149
|
end
|
150
150
|
|
151
151
|
def cond_init
|
152
|
-
@state_stack = [State.new(
|
152
|
+
@state_stack = [State.new(true, :toplevel)]
|
153
153
|
end
|
154
154
|
|
155
155
|
def cond_toplevel?
|
@@ -158,13 +158,13 @@ module BitClust
|
|
158
158
|
|
159
159
|
def cond_push(bool)
|
160
160
|
last = @state_stack.last
|
161
|
-
@state_stack.push(
|
161
|
+
@state_stack.push(last.next(bool, :condition))
|
162
162
|
end
|
163
163
|
|
164
164
|
def cond_invert
|
165
165
|
b = @state_stack.pop.processing?
|
166
166
|
last = @state_stack.last
|
167
|
-
@state_stack.push(
|
167
|
+
@state_stack.push(last.next(!b, :condition))
|
168
168
|
end
|
169
169
|
|
170
170
|
def cond_pop
|
@@ -254,7 +254,7 @@ module BitClust
|
|
254
254
|
|
255
255
|
def samplecode_push(description)
|
256
256
|
last = @state_stack.last
|
257
|
-
@state_stack.push(
|
257
|
+
@state_stack.push(last.next(true, :samplecode))
|
258
258
|
end
|
259
259
|
|
260
260
|
def samplecode_pop
|
@@ -276,24 +276,25 @@ module BitClust
|
|
276
276
|
class State
|
277
277
|
attr_reader :current
|
278
278
|
|
279
|
-
def initialize(
|
280
|
-
@
|
281
|
-
@
|
279
|
+
def initialize(is_processing, label)
|
280
|
+
@is_processing = is_processing
|
281
|
+
@label = label
|
282
|
+
end
|
283
|
+
|
284
|
+
def next(is_processing, label)
|
285
|
+
State.new(@is_processing && is_processing, label)
|
282
286
|
end
|
283
287
|
|
284
288
|
def toplevel?
|
285
|
-
@
|
289
|
+
@label == :toplevel
|
286
290
|
end
|
287
291
|
|
288
292
|
def processing?
|
289
|
-
|
290
|
-
(@current == true && @previous != false) ||
|
291
|
-
(@current == :samplecode && @previous == true) ||
|
292
|
-
(@current == :samplecode && @previous == :toplevel)
|
293
|
+
@is_processing
|
293
294
|
end
|
294
295
|
|
295
296
|
def samplecode?
|
296
|
-
@
|
297
|
+
@label == :samplecode
|
297
298
|
end
|
298
299
|
end
|
299
300
|
end
|
data/lib/bitclust/rdcompiler.rb
CHANGED
@@ -231,9 +231,7 @@ module BitClust
|
|
231
231
|
@f.gets
|
232
232
|
when /\A[ \t\z]/
|
233
233
|
line '<p>'
|
234
|
-
@f.
|
235
|
-
line compile_text(line.strip)
|
236
|
-
end
|
234
|
+
line compile_text(text_node_from_lines(@f.span(/\A[ \t\z]/)))
|
237
235
|
line '</p>'
|
238
236
|
when %r!\A//emlist(?:\[(?:[^\[\]]+?)?\]\[\w+?\])?\{!
|
239
237
|
emlist
|
@@ -250,9 +248,7 @@ module BitClust
|
|
250
248
|
while /\A[ \t]/ =~ @f.peek or %r!\A//emlist(?:\[(?:[^\[\]]+?)?\]\[\w+?\])?\{! =~ @f.peek
|
251
249
|
case @f.peek
|
252
250
|
when /\A[ \t\z]/
|
253
|
-
@f.
|
254
|
-
line compile_text(line.strip)
|
255
|
-
end
|
251
|
+
line compile_text(text_node_from_lines(@f.span(/\A[ \t\z]/)))
|
256
252
|
when %r!\A//emlist(?:\[(?:[^\[\]]+?)?\]\[\w+?\])?\{!
|
257
253
|
emlist
|
258
254
|
end
|
@@ -313,9 +309,7 @@ module BitClust
|
|
313
309
|
|
314
310
|
def paragraph
|
315
311
|
line '<p>'
|
316
|
-
read_paragraph(@f)
|
317
|
-
line compile_text(line.strip)
|
318
|
-
end
|
312
|
+
line compile_text(text_node_from_lines(read_paragraph(@f)))
|
319
313
|
line '</p>'
|
320
314
|
end
|
321
315
|
|
@@ -328,7 +322,7 @@ module BitClust
|
|
328
322
|
cmd = header.slice!(/\A\@\w+/)
|
329
323
|
body = [header] + @f.span(/\A\s+\S/)
|
330
324
|
line '<p>'
|
331
|
-
line '[SEE_ALSO] ' + compile_text(body
|
325
|
+
line '[SEE_ALSO] ' + compile_text(text_node_from_lines(body))
|
332
326
|
line '</p>'
|
333
327
|
end
|
334
328
|
|
@@ -368,9 +362,7 @@ module BitClust
|
|
368
362
|
# FIXME: parse @param, @return, ...
|
369
363
|
def entry_paragraph
|
370
364
|
line '<p>'
|
371
|
-
read_entry_paragraph(@f)
|
372
|
-
line compile_text(line.strip)
|
373
|
-
end
|
365
|
+
line compile_text(text_node_from_lines(read_entry_paragraph(@f)))
|
374
366
|
line '</p>'
|
375
367
|
end
|
376
368
|
|
@@ -591,6 +583,11 @@ module BitClust
|
|
591
583
|
@out.puts
|
592
584
|
end
|
593
585
|
|
586
|
+
def text_node_from_lines(lines)
|
587
|
+
lines.map(&:strip).join("\n").gsub(/(\P{ascii})\n(\P{ascii})/) do
|
588
|
+
"#{::Regexp.last_match(1)}#{::Regexp.last_match(2)}"
|
589
|
+
end
|
590
|
+
end
|
594
591
|
end
|
595
592
|
|
596
593
|
end
|
@@ -3,13 +3,17 @@ module BitClust
|
|
3
3
|
# Null-object version of ProgressBar.
|
4
4
|
class SilentProgressBar
|
5
5
|
|
6
|
-
|
6
|
+
attr_accessor :title
|
7
7
|
|
8
|
-
def
|
9
|
-
|
8
|
+
def self.create(output: $stderr, title:, total:)
|
9
|
+
self.new(output: output, title: title, total: total)
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def initialize(output:, title:, total:)
|
13
|
+
@title, @total, @output = title, total, output
|
14
|
+
end
|
15
|
+
|
16
|
+
def increment
|
13
17
|
end
|
14
18
|
|
15
19
|
def finish
|
data/lib/bitclust/subcommand.rb
CHANGED
@@ -52,6 +52,15 @@ module BitClust
|
|
52
52
|
def srcdir_root
|
53
53
|
Pathname.new(__FILE__).realpath.dirname.parent.parent
|
54
54
|
end
|
55
|
+
|
56
|
+
def align_progress_bar_title(title)
|
57
|
+
size = title.size
|
58
|
+
if size > 14
|
59
|
+
title[0..13]
|
60
|
+
else
|
61
|
+
title + ' ' * (14 - size)
|
62
|
+
end
|
63
|
+
end
|
55
64
|
end
|
56
65
|
end
|
57
66
|
|
@@ -176,7 +176,7 @@ EOS
|
|
176
176
|
end
|
177
177
|
|
178
178
|
entries = db.docs + db.libraries.sort + db.classes.sort + methods.values.sort
|
179
|
-
pb = ProgressBar.
|
179
|
+
pb = ProgressBar.create(title: 'entry', total: entries.size)
|
180
180
|
entries.each do |c|
|
181
181
|
filename = create_html_file(c, manager, @outputdir, db)
|
182
182
|
@html_files << filename
|
@@ -206,8 +206,8 @@ EOS
|
|
206
206
|
Sitemap::Content.new("#{e.klass.name}#{e.typemark}#{name} (#{e.library.name})", filename)
|
207
207
|
end
|
208
208
|
end
|
209
|
-
pb.title
|
210
|
-
pb.
|
209
|
+
pb.title = align_progress_bar_title(e.name)
|
210
|
+
pb.increment
|
211
211
|
end
|
212
212
|
pb.finish
|
213
213
|
end
|
@@ -19,7 +19,7 @@ module BitClust
|
|
19
19
|
@prepare = nil
|
20
20
|
@cleanup = nil
|
21
21
|
@purge = nil
|
22
|
-
@versions = ["2.
|
22
|
+
@versions = ["2.4.0", "2.5.0", "2.6.0"]
|
23
23
|
@update = true
|
24
24
|
@parser.banner = "Usage: #{File.basename($0, '.*')} setup [options]"
|
25
25
|
@parser.on('--prepare', 'Prepare config file and checkout repository. Do not create database.') {
|
@@ -165,7 +165,6 @@ module BitClust
|
|
165
165
|
end
|
166
166
|
|
167
167
|
fdb.transaction do
|
168
|
-
functions = {}
|
169
168
|
create_html_entries("capi", fdb.functions, manager, fdb)
|
170
169
|
end
|
171
170
|
|
@@ -219,34 +218,36 @@ module BitClust
|
|
219
218
|
end
|
220
219
|
|
221
220
|
def create_html_entries(title, entries, manager, db)
|
221
|
+
title = align_progress_bar_title(title)
|
222
222
|
original_title = title.dup
|
223
223
|
if @verbose
|
224
|
-
progressbar = ProgressBar.
|
224
|
+
progressbar = ProgressBar.create(title: title, total: entries.size)
|
225
225
|
else
|
226
|
-
progressbar = SilentProgressBar.
|
226
|
+
progressbar = SilentProgressBar.create(title: title, total: entries.size)
|
227
227
|
end
|
228
228
|
entries.each do |entry|
|
229
229
|
create_html_file(entry, manager, @outputdir, db)
|
230
|
-
progressbar.title
|
231
|
-
progressbar.
|
230
|
+
progressbar.title = align_progress_bar_title([entry].flatten.first.name)
|
231
|
+
progressbar.increment
|
232
232
|
end
|
233
|
-
progressbar.title
|
233
|
+
progressbar.title = original_title
|
234
234
|
progressbar.finish
|
235
235
|
end
|
236
236
|
|
237
237
|
def create_html_methods(title, methods, manager, db)
|
238
|
+
title = align_progress_bar_title(title)
|
238
239
|
original_title = title.dup
|
239
240
|
if @verbose
|
240
|
-
progressbar = ProgressBar.
|
241
|
+
progressbar = ProgressBar.create(title: title, total: methods.size)
|
241
242
|
else
|
242
|
-
progressbar = SilentProgressBar.
|
243
|
+
progressbar = SilentProgressBar.create(title: title, total: methods.size)
|
243
244
|
end
|
244
245
|
methods.each do |method_name, method_entries|
|
245
246
|
create_html_method_file(method_name, method_entries, manager, @outputdir, db)
|
246
|
-
progressbar.title
|
247
|
-
progressbar.
|
247
|
+
progressbar.title = align_progress_bar_title(method_name)
|
248
|
+
progressbar.increment
|
248
249
|
end
|
249
|
-
progressbar.title
|
250
|
+
progressbar.title = original_title
|
250
251
|
progressbar.finish
|
251
252
|
end
|
252
253
|
|
@@ -268,7 +269,6 @@ HERE
|
|
268
269
|
@urlmapper.bitclust_html_base = '..'
|
269
270
|
path = outputdir + e.type_id.to_s + html_filename(encodename_package(e.name), @suffix)
|
270
271
|
create_html_file_p(entry, manager, path, db)
|
271
|
-
path.relative_path_from(outputdir).to_s
|
272
272
|
when :function
|
273
273
|
create_html_function_file(entry, manager, outputdir, db)
|
274
274
|
else
|
@@ -285,7 +285,6 @@ HERE
|
|
285
285
|
path = outputdir + e.type_id.to_s + encodename_package(e.klass.name) +
|
286
286
|
e.typechar + html_filename(encodename_package(name), @suffix)
|
287
287
|
create_html_file_p(entries, manager, path, db)
|
288
|
-
path.relative_path_from(outputdir).to_s
|
289
288
|
end
|
290
289
|
|
291
290
|
def create_html_function_file(entry, manager, outputdir, db)
|
@@ -293,7 +292,6 @@ HERE
|
|
293
292
|
@urlmapper.bitclust_html_base = '..'
|
294
293
|
path = outputdir + entry.type_id.to_s + html_filename(entry.name, @suffix)
|
295
294
|
create_html_file_p(entry, manager, path, db)
|
296
|
-
path.relative_path_from(outputdir).to_s
|
297
295
|
end
|
298
296
|
|
299
297
|
def create_html_file_p(entry, manager, path, db)
|
data/lib/bitclust/version.rb
CHANGED
@@ -33,12 +33,12 @@ HERE
|
|
33
33
|
:version => "1.9.3",
|
34
34
|
:expected => ["some text 2\n"],
|
35
35
|
},
|
36
|
-
"2.
|
37
|
-
:version => "2.
|
36
|
+
"2.5.0" => {
|
37
|
+
:version => "2.5.0",
|
38
38
|
:expected => ["some text 1\n"],
|
39
39
|
},
|
40
|
-
"2.
|
41
|
-
:version => "2.
|
40
|
+
"2.6.0" => {
|
41
|
+
:version => "2.6.0",
|
42
42
|
:expected => ["some text 1\n"],
|
43
43
|
})
|
44
44
|
def test_parse_file(data)
|
data/test/test_preprocessor.rb
CHANGED
@@ -109,6 +109,27 @@ HERE
|
|
109
109
|
assert_equal(expected, ret.join)
|
110
110
|
end
|
111
111
|
|
112
|
+
def test_nested_condition
|
113
|
+
params = { 'version' => '2.4.0' }
|
114
|
+
src = <<~'HERE'
|
115
|
+
#@until 2.4.0
|
116
|
+
#@since 1.8.7
|
117
|
+
#@since 1.9.3
|
118
|
+
#@since 2.0.0
|
119
|
+
Not display here!
|
120
|
+
#@end
|
121
|
+
#@end
|
122
|
+
#@end
|
123
|
+
#@end
|
124
|
+
Display here!
|
125
|
+
HERE
|
126
|
+
expected = <<~HERE
|
127
|
+
Display here!
|
128
|
+
HERE
|
129
|
+
ret = Preprocessor.wrap(StringIO.new(src), params).to_a
|
130
|
+
assert_equal(expected, ret.join)
|
131
|
+
end
|
132
|
+
|
112
133
|
sub_test_case("samplecode") do
|
113
134
|
|
114
135
|
def test_samplecode
|
data/test/test_rdcompiler.rb
CHANGED
@@ -3,6 +3,7 @@ require 'bitclust/database'
|
|
3
3
|
require 'bitclust/methoddatabase'
|
4
4
|
require 'bitclust/screen'
|
5
5
|
require 'test/unit'
|
6
|
+
require 'test/unit/rr'
|
6
7
|
require 'timeout'
|
7
8
|
|
8
9
|
class TestRDCompiler < Test::Unit::TestCase
|
@@ -835,4 +836,243 @@ HERE
|
|
835
836
|
def test_rdoc_link(data)
|
836
837
|
assert_equal(data[:expected], @c.rdoc_link(data[:method_id], data[:version]))
|
837
838
|
end
|
839
|
+
|
840
|
+
def test_paragraph_with_single_line
|
841
|
+
source = <<~SOURCE
|
842
|
+
a
|
843
|
+
SOURCE
|
844
|
+
expected = <<~HTML
|
845
|
+
<p>
|
846
|
+
a
|
847
|
+
</p>
|
848
|
+
HTML
|
849
|
+
assert_equal(
|
850
|
+
expected,
|
851
|
+
@c.compile(source)
|
852
|
+
)
|
853
|
+
end
|
854
|
+
|
855
|
+
def test_paragraph_with_newline_between_ascii_and_ascii
|
856
|
+
source = <<~SOURCE
|
857
|
+
a
|
858
|
+
a
|
859
|
+
SOURCE
|
860
|
+
expected = <<~HTML
|
861
|
+
<p>
|
862
|
+
a
|
863
|
+
a
|
864
|
+
</p>
|
865
|
+
HTML
|
866
|
+
assert_equal(
|
867
|
+
expected,
|
868
|
+
@c.compile(source)
|
869
|
+
)
|
870
|
+
end
|
871
|
+
|
872
|
+
def test_paragraph_with_newline_between_ascii_and_non_ascii
|
873
|
+
source = <<~SOURCE
|
874
|
+
a
|
875
|
+
あ
|
876
|
+
SOURCE
|
877
|
+
expected = <<~HTML
|
878
|
+
<p>
|
879
|
+
a
|
880
|
+
あ
|
881
|
+
</p>
|
882
|
+
HTML
|
883
|
+
assert_equal(
|
884
|
+
expected,
|
885
|
+
@c.compile(source)
|
886
|
+
)
|
887
|
+
end
|
888
|
+
|
889
|
+
def test_paragraph_with_newline_between_non_ascii_and_ascii
|
890
|
+
source = <<~SOURCE
|
891
|
+
あ
|
892
|
+
a
|
893
|
+
SOURCE
|
894
|
+
expected = <<~HTML
|
895
|
+
<p>
|
896
|
+
あ
|
897
|
+
a
|
898
|
+
</p>
|
899
|
+
HTML
|
900
|
+
assert_equal(
|
901
|
+
expected,
|
902
|
+
@c.compile(source)
|
903
|
+
)
|
904
|
+
end
|
905
|
+
|
906
|
+
def test_paragraph_with_newline_between_non_ascii_and_non_ascii
|
907
|
+
source = <<~SOURCE
|
908
|
+
あ
|
909
|
+
あ
|
910
|
+
SOURCE
|
911
|
+
expected = <<~HTML
|
912
|
+
<p>
|
913
|
+
ああ
|
914
|
+
</p>
|
915
|
+
HTML
|
916
|
+
assert_equal(
|
917
|
+
expected,
|
918
|
+
@c.compile(source)
|
919
|
+
)
|
920
|
+
end
|
921
|
+
|
922
|
+
def test_definition_list_with_ascii
|
923
|
+
source = <<~SOURCE
|
924
|
+
: b
|
925
|
+
あ
|
926
|
+
あ
|
927
|
+
SOURCE
|
928
|
+
expected = <<~HTML
|
929
|
+
<dl>
|
930
|
+
<dt>b</dt>
|
931
|
+
<dd>
|
932
|
+
<p>
|
933
|
+
ああ
|
934
|
+
</p>
|
935
|
+
</dd>
|
936
|
+
</dl>
|
937
|
+
HTML
|
938
|
+
assert_equal(
|
939
|
+
expected,
|
940
|
+
@c.compile(source)
|
941
|
+
)
|
942
|
+
end
|
943
|
+
|
944
|
+
def test_definition_list_with_non_ascii
|
945
|
+
source = <<~SOURCE
|
946
|
+
: b
|
947
|
+
a
|
948
|
+
a
|
949
|
+
SOURCE
|
950
|
+
expected = <<~HTML
|
951
|
+
<dl>
|
952
|
+
<dt>b</dt>
|
953
|
+
<dd>
|
954
|
+
<p>
|
955
|
+
a
|
956
|
+
a
|
957
|
+
</p>
|
958
|
+
</dd>
|
959
|
+
</dl>
|
960
|
+
HTML
|
961
|
+
assert_equal(
|
962
|
+
expected,
|
963
|
+
@c.compile(source)
|
964
|
+
)
|
965
|
+
end
|
966
|
+
|
967
|
+
def test_entry_info_with_ascii
|
968
|
+
source = <<~SOURCE
|
969
|
+
--- b
|
970
|
+
|
971
|
+
@param arg あ
|
972
|
+
あ
|
973
|
+
SOURCE
|
974
|
+
expected = <<~HTML
|
975
|
+
<dt class="method-heading" id="dummy"><code>b</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>][<a href="https://docs.ruby-lang.org/en/2.0.0/String.html#method-i-index">rdoc</a>]</span></dt>
|
976
|
+
<dd class="method-description">
|
977
|
+
<dl>
|
978
|
+
<dt class='method-param'>[PARAM] arg:</dt>
|
979
|
+
<dd>
|
980
|
+
ああ
|
981
|
+
</dd>
|
982
|
+
</dl>
|
983
|
+
</dd>
|
984
|
+
HTML
|
985
|
+
assert_compiled_method_source(expected, source)
|
986
|
+
end
|
987
|
+
|
988
|
+
def test_entry_info_with_non_ascii
|
989
|
+
source = <<~SOURCE
|
990
|
+
--- b
|
991
|
+
@param arg a
|
992
|
+
a
|
993
|
+
SOURCE
|
994
|
+
expected = <<~HTML
|
995
|
+
<dt class="method-heading" id="dummy"><code>b</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>][<a href="https://docs.ruby-lang.org/en/2.0.0/String.html#method-i-index">rdoc</a>]</span></dt>
|
996
|
+
<dd class="method-description">
|
997
|
+
<dl>
|
998
|
+
<dt class='method-param'>[PARAM] arg:</dt>
|
999
|
+
<dd>
|
1000
|
+
a
|
1001
|
+
a
|
1002
|
+
</dd>
|
1003
|
+
</dl>
|
1004
|
+
</dd>
|
1005
|
+
HTML
|
1006
|
+
assert_compiled_method_source(expected, source)
|
1007
|
+
end
|
1008
|
+
|
1009
|
+
def test_entry_paragraph_with_ascii
|
1010
|
+
source = <<~SOURCE
|
1011
|
+
--- b
|
1012
|
+
あ
|
1013
|
+
あ
|
1014
|
+
SOURCE
|
1015
|
+
expected = <<~HTML
|
1016
|
+
<dt class="method-heading" id="dummy"><code>b</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>][<a href="https://docs.ruby-lang.org/en/2.0.0/String.html#method-i-index">rdoc</a>]</span></dt>
|
1017
|
+
<dd class="method-description">
|
1018
|
+
<p>
|
1019
|
+
ああ
|
1020
|
+
</p>
|
1021
|
+
</dd>
|
1022
|
+
HTML
|
1023
|
+
assert_compiled_method_source(expected, source)
|
1024
|
+
end
|
1025
|
+
|
1026
|
+
def test_entry_paragraph_with_non_ascii
|
1027
|
+
source = <<~SOURCE
|
1028
|
+
--- b
|
1029
|
+
a
|
1030
|
+
a
|
1031
|
+
SOURCE
|
1032
|
+
expected = <<~HTML
|
1033
|
+
<dt class="method-heading" id="dummy"><code>b</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>][<a href="https://docs.ruby-lang.org/en/2.0.0/String.html#method-i-index">rdoc</a>]</span></dt>
|
1034
|
+
<dd class="method-description">
|
1035
|
+
<p>
|
1036
|
+
a
|
1037
|
+
a
|
1038
|
+
</p>
|
1039
|
+
</dd>
|
1040
|
+
HTML
|
1041
|
+
assert_compiled_method_source(expected, source)
|
1042
|
+
end
|
1043
|
+
|
1044
|
+
def test_entry_see_with_ascii
|
1045
|
+
source = <<~SOURCE
|
1046
|
+
--- b
|
1047
|
+
@see あ
|
1048
|
+
あ
|
1049
|
+
SOURCE
|
1050
|
+
expected = <<~HTML
|
1051
|
+
<dt class="method-heading" id="dummy"><code>b</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>][<a href="https://docs.ruby-lang.org/en/2.0.0/String.html#method-i-index">rdoc</a>]</span></dt>
|
1052
|
+
<dd class="method-description">
|
1053
|
+
<p>
|
1054
|
+
[SEE_ALSO] ああ
|
1055
|
+
</p>
|
1056
|
+
</dd>
|
1057
|
+
HTML
|
1058
|
+
assert_compiled_method_source(expected, source)
|
1059
|
+
end
|
1060
|
+
|
1061
|
+
def test_entry_see_with_non_ascii
|
1062
|
+
source = <<~SOURCE
|
1063
|
+
--- b
|
1064
|
+
@see a
|
1065
|
+
a
|
1066
|
+
SOURCE
|
1067
|
+
expected = <<~HTML
|
1068
|
+
<dt class="method-heading" id="dummy"><code>b</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>][<a href="https://docs.ruby-lang.org/en/2.0.0/String.html#method-i-index">rdoc</a>]</span></dt>
|
1069
|
+
<dd class="method-description">
|
1070
|
+
<p>
|
1071
|
+
[SEE_ALSO] a
|
1072
|
+
a
|
1073
|
+
</p>
|
1074
|
+
</dd>
|
1075
|
+
HTML
|
1076
|
+
assert_compiled_method_source(expected, source)
|
1077
|
+
end
|
838
1078
|
end
|
@@ -7,15 +7,15 @@ class TestSyntaxHighlighter < Test::Unit::TestCase
|
|
7
7
|
|
8
8
|
sub_test_case "syntax error" do
|
9
9
|
test "single line" do
|
10
|
-
src = "
|
11
|
-
assert_raise(BitClust::SyntaxHighlighter::ParseError.new("-", 1,
|
10
|
+
src = "foo(\n"
|
11
|
+
assert_raise(BitClust::SyntaxHighlighter::ParseError.new("-", 1, 5, "syntax error, unexpected end-of-input, expecting ')'")) do
|
12
12
|
highlight(src)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
test "multiple line" do
|
17
|
-
src = "a = 1\n
|
18
|
-
assert_raise(BitClust::SyntaxHighlighter::ParseError.new("-", 2,
|
17
|
+
src = "a = 1\nfoo(\n"
|
18
|
+
assert_raise(BitClust::SyntaxHighlighter::ParseError.new("-", 2, 5, "syntax error, unexpected end-of-input, expecting ')'")) do
|
19
19
|
highlight(src)
|
20
20
|
end
|
21
21
|
end
|
data/theme/default/style.css
CHANGED
@@ -113,17 +113,22 @@ span.compileerror {
|
|
113
113
|
font-weight: bold;
|
114
114
|
}
|
115
115
|
|
116
|
+
code, pre, tt {
|
117
|
+
font-size: 90%;
|
118
|
+
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
|
119
|
+
}
|
120
|
+
|
116
121
|
pre {
|
117
122
|
line-height: 1.1;
|
118
123
|
background-color: #f2f2f2;
|
119
|
-
padding:
|
124
|
+
padding: 1.1em;
|
120
125
|
font-weight: normal;
|
121
126
|
}
|
122
127
|
|
123
128
|
pre.highlight {
|
124
129
|
line-height: 1.1;
|
125
130
|
background-color: #f2f2f2;
|
126
|
-
padding: 0px
|
131
|
+
padding: 0px 1.1em 1.1em 1.1em;
|
127
132
|
font-weight: normal;
|
128
133
|
position: relative;
|
129
134
|
}
|
@@ -215,6 +220,7 @@ td.signature a {
|
|
215
220
|
display: block;
|
216
221
|
padding: 0.3em;
|
217
222
|
height: 100%;
|
223
|
+
box-sizing: border-box;
|
218
224
|
}
|
219
225
|
|
220
226
|
td.description {
|
@@ -230,10 +236,6 @@ td.library {
|
|
230
236
|
border: 3px solid white;
|
231
237
|
}
|
232
238
|
|
233
|
-
code {
|
234
|
-
font-family: monospace;
|
235
|
-
}
|
236
|
-
|
237
239
|
a {
|
238
240
|
font-weight: bold;
|
239
241
|
text-decoration: none;
|
@@ -307,6 +309,6 @@ hr {
|
|
307
309
|
|
308
310
|
#top_search {
|
309
311
|
position: absolute;
|
310
|
-
top: 15px;
|
311
|
-
right: 10px;
|
312
|
+
top: 15px;
|
313
|
+
right: 10px;
|
312
314
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitclust-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- https://github.com/rurema
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|
@@ -70,16 +70,22 @@ dependencies:
|
|
70
70
|
name: progressbar
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.9.0
|
76
|
+
- - "<"
|
74
77
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
78
|
+
version: '2.0'
|
76
79
|
type: :runtime
|
77
80
|
prerelease: false
|
78
81
|
version_requirements: !ruby/object:Gem::Requirement
|
79
82
|
requirements:
|
80
|
-
- -
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.9.0
|
86
|
+
- - "<"
|
81
87
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
88
|
+
version: '2.0'
|
83
89
|
description: |
|
84
90
|
Rurema is a Japanese ruby documentation project, and
|
85
91
|
bitclust is a rurema document processor.
|
@@ -240,25 +246,24 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
240
246
|
- !ruby/object:Gem::Version
|
241
247
|
version: '0'
|
242
248
|
requirements: []
|
243
|
-
|
244
|
-
rubygems_version: 2.7.6
|
249
|
+
rubygems_version: 3.0.3
|
245
250
|
signing_key:
|
246
251
|
specification_version: 4
|
247
252
|
summary: BitClust is a rurema document processor.
|
248
253
|
test_files:
|
249
|
-
- test/test_rdcompiler.rb
|
250
|
-
- test/test_libraryentry.rb
|
251
|
-
- test/test_runner.rb
|
252
254
|
- test/test_syntax_highlighter.rb
|
253
|
-
- test/
|
255
|
+
- test/test_libraryentry.rb
|
254
256
|
- test/test_refsdatabase.rb
|
255
|
-
- test/
|
256
|
-
- test/
|
257
|
-
- test/test_rrdparser.rb
|
257
|
+
- test/test_rdcompiler.rb
|
258
|
+
- test/test_methoddatabase.rb
|
258
259
|
- test/test_simplesearcher.rb
|
259
|
-
- test/
|
260
|
+
- test/test_functionreferenceparser.rb
|
260
261
|
- test/test_entry.rb
|
261
|
-
- test/
|
262
|
-
- test/
|
262
|
+
- test/run_test.rb
|
263
|
+
- test/test_preprocessor.rb
|
263
264
|
- test/test_nameutils.rb
|
264
|
-
- test/
|
265
|
+
- test/test_functiondatabase.rb
|
266
|
+
- test/test_rrdparser.rb
|
267
|
+
- test/test_methodsignature.rb
|
268
|
+
- test/test_runner.rb
|
269
|
+
- test/test_bitclust.rb
|