bitclust-core 1.2.3 → 1.2.4
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/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
@@ -25,7 +25,7 @@ module BitClust
|
|
25
25
|
@parser.on('--prepare', 'Prepare config file and checkout repository. Do not create database.') {
|
26
26
|
@prepare = true
|
27
27
|
}
|
28
|
-
@parser.on('--cleanup', 'Cleanup
|
28
|
+
@parser.on('--cleanup', 'Cleanup database before create database.') {
|
29
29
|
@cleanup = true
|
30
30
|
}
|
31
31
|
@parser.on('--purge', 'Purge all downloaded and generated files and exit.') {
|
@@ -67,6 +67,10 @@ module BitClust
|
|
67
67
|
@bitclust_html_base + "/" + filename
|
68
68
|
end
|
69
69
|
|
70
|
+
def custom_js_url(filename)
|
71
|
+
@bitclust_html_base + "/" + filename
|
72
|
+
end
|
73
|
+
|
70
74
|
def favicon_url
|
71
75
|
@bitclust_html_base + "/" + @favicon_url
|
72
76
|
end
|
@@ -94,7 +98,12 @@ module BitClust
|
|
94
98
|
|
95
99
|
def initialize
|
96
100
|
if Object.const_defined?(:Encoding)
|
97
|
-
|
101
|
+
begin
|
102
|
+
verbose, $VERBOSE = $VERBOSE, false
|
103
|
+
Encoding.default_external = 'utf-8'
|
104
|
+
ensure
|
105
|
+
$VERBOSE = verbose
|
106
|
+
end
|
98
107
|
end
|
99
108
|
super
|
100
109
|
@verbose = true
|
@@ -104,6 +113,7 @@ module BitClust
|
|
104
113
|
@suffix = ".html"
|
105
114
|
@gtm_tracking_id = nil
|
106
115
|
@meta_robots_content = ["noindex"]
|
116
|
+
@stop_on_syntax_error = true
|
107
117
|
@parser.banner = "Usage: #{File.basename($0, '.*')} statichtml [options]"
|
108
118
|
@parser.on('-o', '--outputdir=PATH', 'Output directory') do |path|
|
109
119
|
begin
|
@@ -137,6 +147,9 @@ module BitClust
|
|
137
147
|
@parser.on('--meta-robots-content=VALUE1,VALUE2,...', Array, 'HTML <meta> element: <meta name="robots" content="VALUE1,VALUE2..."') do |values|
|
138
148
|
@meta_robots_content = values
|
139
149
|
end
|
150
|
+
@parser.on('--no-stop-on-syntax-error', 'Do not stop on syntax error') do |boolean|
|
151
|
+
@stop_on_syntax_error = boolean
|
152
|
+
end
|
140
153
|
@parser.on('--[no-]quiet', 'Be quiet') do |quiet|
|
141
154
|
@verbose = !quiet
|
142
155
|
end
|
@@ -180,19 +193,21 @@ module BitClust
|
|
180
193
|
:verbose => @verbose)
|
181
194
|
create_index_html(@outputdir)
|
182
195
|
FileUtils.cp(@manager_config[:themedir] + @manager_config[:css_url],
|
183
|
-
@outputdir.to_s,
|
196
|
+
@outputdir.to_s, :verbose => @verbose, :preserve => true)
|
184
197
|
FileUtils.cp(@manager_config[:themedir] + "syntax-highlight.css",
|
185
|
-
@outputdir.to_s,
|
198
|
+
@outputdir.to_s, :verbose => @verbose, :preserve => true)
|
199
|
+
FileUtils.cp(@manager_config[:themedir] + "script.js",
|
200
|
+
@outputdir.to_s, :verbose => @verbose, :preserve => true)
|
186
201
|
FileUtils.cp(@manager_config[:themedir] + @manager_config[:favicon_url],
|
187
|
-
@outputdir.to_s,
|
202
|
+
@outputdir.to_s, :verbose => @verbose, :preserve => true)
|
188
203
|
Dir.mktmpdir do |tmpdir|
|
189
204
|
FileUtils.cp_r(@manager_config[:themedir] + 'images', tmpdir,
|
190
|
-
|
205
|
+
:verbose => @verbose, :preserve => true)
|
191
206
|
Dir.glob(File.join(tmpdir, 'images', '/**/.svn')).each do |d|
|
192
|
-
FileUtils.rm_r(d,
|
207
|
+
FileUtils.rm_r(d, :verbose => @verbose)
|
193
208
|
end
|
194
209
|
FileUtils.cp_r(File.join(tmpdir, 'images'), @outputdir.to_s,
|
195
|
-
|
210
|
+
:verbose => @verbose, :preserve => true)
|
196
211
|
end
|
197
212
|
end
|
198
213
|
|
@@ -212,6 +227,7 @@ module BitClust
|
|
212
227
|
:canonical_base_url => @canonical_base_url,
|
213
228
|
:gtm_tracking_id => @gtm_tracking_id,
|
214
229
|
:meta_robots_content => @meta_robots_content,
|
230
|
+
:stop_on_syntax_error => @stop_on_syntax_error,
|
215
231
|
}
|
216
232
|
@manager_config[:urlmapper] = URLMapperEx.new(@manager_config)
|
217
233
|
@urlmapper = @manager_config[:urlmapper]
|
@@ -122,17 +122,18 @@ module BitClust
|
|
122
122
|
@stack = []
|
123
123
|
@name_buffer = []
|
124
124
|
@__lexer.define_singleton_method(:on_parse_error) do |message|
|
125
|
-
raise ParseError.new(filename, self.lineno, self.column, message)
|
125
|
+
raise ParseError.new(filename, self.lineno, self.column, "#{message}\n#{src}")
|
126
126
|
end
|
127
127
|
@__lexer.define_singleton_method(:compile_error) do |message|
|
128
|
-
raise CompileError.new(filename, self.lineno, self.column, message)
|
128
|
+
raise CompileError.new(filename, self.lineno, self.column, "#{message}\n#{src}")
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
132
|
def on_default(event, token, data)
|
133
133
|
event_name = event.to_s.sub(/\Aon_/, "") # :on_event --> "event"
|
134
134
|
style = COLORS[event_name.to_sym]
|
135
|
-
|
135
|
+
escaped_token = escape_html(token)
|
136
|
+
data << (style ? "<span class=\"#{style}\">#{escaped_token}</span>" : escaped_token)
|
136
137
|
data
|
137
138
|
end
|
138
139
|
|
data/lib/bitclust/version.rb
CHANGED
data/test/test_bitclust.rb
CHANGED
@@ -8,14 +8,14 @@ class TestSyntaxHighlighter < Test::Unit::TestCase
|
|
8
8
|
sub_test_case "syntax error" do
|
9
9
|
test "single line" do
|
10
10
|
src = "foo(\n"
|
11
|
-
assert_raise(BitClust::SyntaxHighlighter::ParseError.new("-", 1, 5, "syntax error, unexpected end-of-input, expecting ')'")) do
|
11
|
+
assert_raise(BitClust::SyntaxHighlighter::ParseError.new("-", 1, 5, "syntax error, unexpected end-of-input, expecting ')'\n#{src}")) do
|
12
12
|
highlight(src)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
test "multiple line" do
|
17
17
|
src = "a = 1\nfoo(\n"
|
18
|
-
assert_raise(BitClust::SyntaxHighlighter::ParseError.new("-", 2, 5, "syntax error, unexpected end-of-input, expecting ')'")) do
|
18
|
+
assert_raise(BitClust::SyntaxHighlighter::ParseError.new("-", 2, 5, "syntax error, unexpected end-of-input, expecting ')'\n#{src}")) do
|
19
19
|
highlight(src)
|
20
20
|
end
|
21
21
|
end
|
@@ -64,4 +64,10 @@ class TestSyntaxHighlighter < Test::Unit::TestCase
|
|
64
64
|
assert_equal(expected, highlight(source))
|
65
65
|
end
|
66
66
|
end
|
67
|
+
|
68
|
+
test 'htmlescape' do
|
69
|
+
source = 'puts /<a>/'
|
70
|
+
expected = '<span class="nb">puts</span> <span class="sr">/<a>/</span>'
|
71
|
+
assert_equal(expected, highlight(source))
|
72
|
+
end
|
67
73
|
end
|
data/theme/default/rurema.png
CHANGED
Binary file
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<svg width="16" height="16" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
3
|
+
<rect x="2" y="1" width="12" height="12" fill="#33a"/>
|
4
|
+
|
5
|
+
<rect x="4" y="2" width="8" height="10" fill="#f00"/>
|
6
|
+
<rect x="3" y="3" width="1" height="8" fill="#000"/>
|
7
|
+
<rect x="5" y="1" width="6" height="1" fill="#000"/>
|
8
|
+
<rect x="12" y="3" width="1" height="8" fill="#000"/>
|
9
|
+
<rect x="5" y="12" width="6" height="1" fill="#000"/>
|
10
|
+
|
11
|
+
<rect x="4" y="2" width="1" height="1" fill="#300"/>
|
12
|
+
<rect x="11" y="2" width="1" height="1" fill="#300"/>
|
13
|
+
<rect x="4" y="11" width="1" height="1" fill="#300"/>
|
14
|
+
<rect x="11" y="11" width="1" height="1" fill="#300"/>
|
15
|
+
|
16
|
+
<rect x="5" y="3" width="1" height="1" fill="#600"/>
|
17
|
+
<rect x="10" y="3" width="1" height="1" fill="#600"/>
|
18
|
+
<rect x="5" y="10" width="1" height="1" fill="#600"/>
|
19
|
+
<rect x="10" y="10" width="1" height="1" fill="#600"/>
|
20
|
+
|
21
|
+
<rect x="6" y="4" width="4" height="6" fill="#000"/>
|
22
|
+
<rect x="7" y="5" width="2" height="4" fill="#f00"/>
|
23
|
+
|
24
|
+
<rect x="2" y="0" width="12" height="1" fill="#000"/>
|
25
|
+
<rect x="14" y="0" width="1" height="14" fill="#000"/>
|
26
|
+
<rect x="2" y="13" width="12" height="1" fill="#000"/>
|
27
|
+
<rect x="1" y="1" width="1" height="14" fill="#000"/>
|
28
|
+
<rect x="2" y="14" width="11" height="1" fill="#ccc"/>
|
29
|
+
<rect x="13" y="14" width="1" height="1" fill="#000"/>
|
30
|
+
<rect x="2" y="15" width="13" height="1" fill="#000"/>
|
31
|
+
</svg>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
(function() {
|
2
|
+
window.onload = function() {
|
3
|
+
const elems = document.getElementsByClassName('highlight')
|
4
|
+
|
5
|
+
let tempDiv = document.createElement('div')
|
6
|
+
|
7
|
+
Array.prototype.forEach.call(elems,
|
8
|
+
function(elem) {
|
9
|
+
// sample code without caption
|
10
|
+
tempDiv.innerHTML = elem.innerHTML
|
11
|
+
const caption = tempDiv.getElementsByClassName("caption")[0]
|
12
|
+
if (caption) tempDiv.removeChild(caption)
|
13
|
+
|
14
|
+
// textarea for preserving the copy text
|
15
|
+
const copyText = document.createElement('textarea')
|
16
|
+
copyText.setAttribute('class', 'highlight__copy-text')
|
17
|
+
copyText.innerHTML = tempDiv.textContent.replace(/^\n+/, "").replace(/\n{2,}$/, "\n")
|
18
|
+
elem.appendChild(copyText)
|
19
|
+
|
20
|
+
// COPY button
|
21
|
+
const btn = document.createElement('div')
|
22
|
+
btn.setAttribute('class', 'highlight__copy-button')
|
23
|
+
// btn.textContent = "COPY"
|
24
|
+
elem.insertBefore(btn, elem.firstChild)
|
25
|
+
|
26
|
+
btn.onclick = function(){
|
27
|
+
copyText.select()
|
28
|
+
document.execCommand("copy")
|
29
|
+
btn.classList.add("copied")
|
30
|
+
window.setTimeout(function() { btn.classList.remove("copied") }, 1000)
|
31
|
+
}
|
32
|
+
}
|
33
|
+
)
|
34
|
+
}
|
35
|
+
})()
|
data/theme/default/style.css
CHANGED
@@ -134,6 +134,34 @@ pre.highlight {
|
|
134
134
|
position: relative;
|
135
135
|
}
|
136
136
|
|
137
|
+
/* for COPY */
|
138
|
+
.highlight__copy-button {
|
139
|
+
float: right;
|
140
|
+
margin: 0 -1.1em 0.25em 0.5em;
|
141
|
+
padding: 0.25em 0.5em;
|
142
|
+
background: #DDD;
|
143
|
+
opacity: 0.75;
|
144
|
+
cursor: pointer;
|
145
|
+
}
|
146
|
+
.highlight__copy-button:hover {
|
147
|
+
background: #EE8;
|
148
|
+
opacity: 1;
|
149
|
+
}
|
150
|
+
.highlight__copy-button::after {
|
151
|
+
content: "COPY"
|
152
|
+
}
|
153
|
+
.highlight__copy-button.copied {
|
154
|
+
background: #070;
|
155
|
+
color: white;
|
156
|
+
}
|
157
|
+
.highlight__copy-button.copied::after {
|
158
|
+
content: "COPIED"
|
159
|
+
}
|
160
|
+
.highlight__copy-text {
|
161
|
+
position: fixed;
|
162
|
+
left: -1000px;
|
163
|
+
}
|
164
|
+
|
137
165
|
pre .caption {
|
138
166
|
position: absolute;
|
139
167
|
top: 0;
|
@@ -285,6 +313,43 @@ hr {
|
|
285
313
|
height: 1px;
|
286
314
|
}
|
287
315
|
|
316
|
+
.inline-breadcrumb-list {
|
317
|
+
display: inline-block;
|
318
|
+
list-style-type: none;
|
319
|
+
margin-bottom: 0;
|
320
|
+
margin-top: 0;
|
321
|
+
padding-left: 0;
|
322
|
+
}
|
323
|
+
|
324
|
+
.inline-breadcrumb-list li {
|
325
|
+
display: inline-block;
|
326
|
+
margin-bottom: 0;
|
327
|
+
}
|
328
|
+
|
329
|
+
.inline-breadcrumb-list li + li::before {
|
330
|
+
content: ">";
|
331
|
+
padding-left: 0.1rem;
|
332
|
+
padding-right: 0.1rem;
|
333
|
+
}
|
334
|
+
|
335
|
+
.inline-ancestors-list {
|
336
|
+
display: inline-flex;
|
337
|
+
flex-direction: row-reverse;
|
338
|
+
list-style-type: none;
|
339
|
+
margin-bottom: 0;
|
340
|
+
margin-top: 0;
|
341
|
+
padding-left: 0;
|
342
|
+
}
|
343
|
+
|
344
|
+
.inline-ancestors-list li {
|
345
|
+
margin-bottom: 0;
|
346
|
+
}
|
347
|
+
|
348
|
+
.inline-ancestors-list li + li::after {
|
349
|
+
content: "<";
|
350
|
+
padding-right: 0.3rem;
|
351
|
+
}
|
352
|
+
|
288
353
|
@media print {
|
289
354
|
body {
|
290
355
|
font-family: osaka,'MS Mincho',serif;
|
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.4
|
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: 2020-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|
@@ -222,6 +222,8 @@ files:
|
|
222
222
|
- test/test_syntax_highlighter.rb
|
223
223
|
- theme/default/images/external.png
|
224
224
|
- theme/default/rurema.png
|
225
|
+
- theme/default/rurema.svg
|
226
|
+
- theme/default/script.js
|
225
227
|
- theme/default/style.css
|
226
228
|
- theme/default/syntax-highlight.css
|
227
229
|
- theme/default/test.css
|
@@ -251,19 +253,19 @@ signing_key:
|
|
251
253
|
specification_version: 4
|
252
254
|
summary: BitClust is a rurema document processor.
|
253
255
|
test_files:
|
254
|
-
- test/test_nameutils.rb
|
255
256
|
- test/run_test.rb
|
256
|
-
- test/
|
257
|
-
- test/
|
258
|
-
- test/
|
259
|
-
- test/
|
260
|
-
- test/test_rdcompiler.rb
|
257
|
+
- test/test_nameutils.rb
|
258
|
+
- test/test_functiondatabase.rb
|
259
|
+
- test/test_bitclust.rb
|
260
|
+
- test/test_simplesearcher.rb
|
261
261
|
- test/test_functionreferenceparser.rb
|
262
262
|
- test/test_runner.rb
|
263
|
-
- test/
|
264
|
-
- test/
|
265
|
-
- test/
|
263
|
+
- test/test_refsdatabase.rb
|
264
|
+
- test/test_methodsignature.rb
|
265
|
+
- test/test_libraryentry.rb
|
266
|
+
- test/test_rrdparser.rb
|
267
|
+
- test/test_preprocessor.rb
|
266
268
|
- test/test_entry.rb
|
267
269
|
- test/test_methoddatabase.rb
|
268
|
-
- test/
|
269
|
-
- test/
|
270
|
+
- test/test_rdcompiler.rb
|
271
|
+
- test/test_syntax_highlighter.rb
|