bitclust-core 1.1.0 → 1.1.1
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 +5 -5
- data/lib/bitclust/rdcompiler.rb +2 -2
- data/lib/bitclust/screen.rb +3 -3
- data/lib/bitclust/syntax_highlighter.rb +19 -1
- data/lib/bitclust/version.rb +1 -1
- data/test/test_preprocessor.rb +44 -41
- data/test/test_rdcompiler.rb +3 -2
- data/theme/default/style.css +8 -1
- data/theme/default/syntax-highlight.css +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6e32c5dfdf60ae79984fb44940fa5125727de9823b97d57f4476ff17381f71fe
|
4
|
+
data.tar.gz: c6e37cad779f2876ae2ad907b7e0d04ad21a2cfd622c68089edcb2995788a723
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fdb5e20b6d1469f314e2abb08e5082169a340e49679f22e5d89195d595b66791e2e2adad946946c56c487fa7491aaacc4b75eeae5394621858011e9f46eaded
|
7
|
+
data.tar.gz: 86042f89cc75d2cca54cef4c6622bcadd05987bb9a3ff0ef7bd2a7a7ec3f3320f41b40ca2c10c9c7e2984684c8afcf1eaa5ef29dff19c1a120077bf84556bd45
|
data/lib/bitclust/rdcompiler.rb
CHANGED
@@ -447,7 +447,7 @@ module BitClust
|
|
447
447
|
rfc_link(arg)
|
448
448
|
when 'ruby-list', 'ruby-dev', 'ruby-ext', 'ruby-talk', 'ruby-core'
|
449
449
|
blade_link(type, arg)
|
450
|
-
when 'feature', 'bug'
|
450
|
+
when 'feature', 'bug', 'misc'
|
451
451
|
bugs_link(type, arg)
|
452
452
|
else
|
453
453
|
"[[#{escape_html(link)}]]"
|
@@ -501,7 +501,7 @@ module BitClust
|
|
501
501
|
%Q(<a class="external" href="#{escape_html(url)}">[#{escape_html("#{ml}:#{num}")}]</a>)
|
502
502
|
end
|
503
503
|
|
504
|
-
RFC_URL = '
|
504
|
+
RFC_URL = 'https://tools.ietf.org/html/rfc%s'
|
505
505
|
|
506
506
|
def rfc_link(num)
|
507
507
|
url = sprintf(RFC_URL, num)
|
data/lib/bitclust/screen.rb
CHANGED
@@ -285,7 +285,7 @@ module BitClust
|
|
285
285
|
|
286
286
|
def google_tag_manager
|
287
287
|
tracking_id = @conf[:gtm_tracking_id]
|
288
|
-
return "
|
288
|
+
return "" unless tracking_id
|
289
289
|
<<-HTML.chomp
|
290
290
|
<!-- Global Site Tag (gtag.js) - Google Analytics -->
|
291
291
|
<script async src="https://www.googletagmanager.com/gtag/js?id=#{tracking_id}"></script>
|
@@ -301,8 +301,8 @@ module BitClust
|
|
301
301
|
|
302
302
|
def meta_robots
|
303
303
|
content = @conf[:meta_robots_content]
|
304
|
-
return "
|
305
|
-
return "
|
304
|
+
return "" unless content
|
305
|
+
return "" if content.empty?
|
306
306
|
%Q(<meta name="robots" content="#{content.join(',')}">)
|
307
307
|
end
|
308
308
|
|
@@ -282,7 +282,11 @@ module BitClust
|
|
282
282
|
end
|
283
283
|
|
284
284
|
def on_tstring_end(token, data)
|
285
|
-
|
285
|
+
case
|
286
|
+
when token == "'"
|
287
|
+
data << "#{token}</span>"
|
288
|
+
when [:qwords, :words].include?(@stack.last)
|
289
|
+
@stack.pop
|
286
290
|
data << "#{token}</span>"
|
287
291
|
else
|
288
292
|
data << "<span class=\"s2\">#{token}</span>"
|
@@ -291,6 +295,20 @@ module BitClust
|
|
291
295
|
data
|
292
296
|
end
|
293
297
|
|
298
|
+
def on_qwords_beg(token, data)
|
299
|
+
@stack.push(:qwords)
|
300
|
+
style = COLORS[:qwords_beg]
|
301
|
+
data << "<span class=\"#{style}\">#{token}"
|
302
|
+
data
|
303
|
+
end
|
304
|
+
|
305
|
+
def on_words_beg(token, data)
|
306
|
+
@stack.push(:words)
|
307
|
+
style = COLORS[:words_beg]
|
308
|
+
data << "<span class=\"#{style}\">#{token}"
|
309
|
+
data
|
310
|
+
end
|
311
|
+
|
294
312
|
def on_heredoc_beg(token, data)
|
295
313
|
@stack.push(:heredoc)
|
296
314
|
on_default(:on_heredoc_beg, token, data)
|
data/lib/bitclust/version.rb
CHANGED
data/test/test_preprocessor.rb
CHANGED
@@ -109,9 +109,11 @@ HERE
|
|
109
109
|
assert_equal(expected, ret.join)
|
110
110
|
end
|
111
111
|
|
112
|
-
|
113
|
-
|
114
|
-
|
112
|
+
sub_test_case("samplecode") do
|
113
|
+
|
114
|
+
def test_samplecode
|
115
|
+
params = { 'version' => '1.9.2' }
|
116
|
+
src = <<HERE
|
115
117
|
--- puts(str) -> String
|
116
118
|
|
117
119
|
xxx
|
@@ -122,7 +124,7 @@ puts("yyy")
|
|
122
124
|
\#@end
|
123
125
|
HERE
|
124
126
|
|
125
|
-
|
127
|
+
expected = <<HERE
|
126
128
|
--- puts(str) -> String
|
127
129
|
|
128
130
|
xxx
|
@@ -132,13 +134,13 @@ puts("xxx")
|
|
132
134
|
puts("yyy")
|
133
135
|
//}
|
134
136
|
HERE
|
135
|
-
|
136
|
-
|
137
|
-
|
137
|
+
ret = Preprocessor.wrap(StringIO.new(src), params).to_a
|
138
|
+
assert_equal(expected, ret.join)
|
139
|
+
end
|
138
140
|
|
139
|
-
|
140
|
-
|
141
|
-
|
141
|
+
def test_samplecode_without_description
|
142
|
+
params = { 'version' => '1.9.2' }
|
143
|
+
src = <<HERE
|
142
144
|
--- puts(str) -> String
|
143
145
|
|
144
146
|
xxx
|
@@ -149,7 +151,7 @@ puts("yyy")
|
|
149
151
|
\#@end
|
150
152
|
HERE
|
151
153
|
|
152
|
-
|
154
|
+
expected = <<HERE
|
153
155
|
--- puts(str) -> String
|
154
156
|
|
155
157
|
xxx
|
@@ -159,13 +161,13 @@ puts("xxx")
|
|
159
161
|
puts("yyy")
|
160
162
|
//}
|
161
163
|
HERE
|
162
|
-
|
163
|
-
|
164
|
-
|
164
|
+
ret = Preprocessor.wrap(StringIO.new(src), params).to_a
|
165
|
+
assert_equal(expected, ret.join)
|
166
|
+
end
|
165
167
|
|
166
|
-
|
167
|
-
|
168
|
-
|
168
|
+
def test_samplecode_with_condition1
|
169
|
+
params = { 'version' => '1.9.2' }
|
170
|
+
src = <<HERE
|
169
171
|
--- puts(str) -> String
|
170
172
|
|
171
173
|
xxx
|
@@ -183,7 +185,7 @@ puts("yyy2")
|
|
183
185
|
\#@end
|
184
186
|
HERE
|
185
187
|
|
186
|
-
|
188
|
+
expected = <<HERE
|
187
189
|
--- puts(str) -> String
|
188
190
|
|
189
191
|
xxx
|
@@ -193,13 +195,13 @@ puts("xxx1")
|
|
193
195
|
puts("yyy1")
|
194
196
|
//}
|
195
197
|
HERE
|
196
|
-
|
197
|
-
|
198
|
-
|
198
|
+
ret = Preprocessor.wrap(StringIO.new(src), params).to_a
|
199
|
+
assert_equal(expected, ret.join)
|
200
|
+
end
|
199
201
|
|
200
|
-
|
201
|
-
|
202
|
-
|
202
|
+
def test_samplecode_with_condition2
|
203
|
+
params = { 'version' => '1.9.2' }
|
204
|
+
src = <<HERE
|
203
205
|
--- puts(str) -> String
|
204
206
|
|
205
207
|
xxx
|
@@ -213,7 +215,7 @@ puts("yyy")
|
|
213
215
|
\#@end
|
214
216
|
HERE
|
215
217
|
|
216
|
-
|
218
|
+
expected = <<HERE
|
217
219
|
--- puts(str) -> String
|
218
220
|
|
219
221
|
xxx
|
@@ -222,13 +224,13 @@ xxx
|
|
222
224
|
puts("xxx")
|
223
225
|
//}
|
224
226
|
HERE
|
225
|
-
|
226
|
-
|
227
|
-
|
227
|
+
ret = Preprocessor.wrap(StringIO.new(src), params).to_a
|
228
|
+
assert_equal(expected, ret.join)
|
229
|
+
end
|
228
230
|
|
229
|
-
|
230
|
-
|
231
|
-
|
231
|
+
def test_samplecode_with_condition3
|
232
|
+
params = { 'version' => '1.9.2' }
|
233
|
+
src = <<HERE
|
232
234
|
--- puts(str) -> String
|
233
235
|
|
234
236
|
xxx
|
@@ -246,7 +248,7 @@ zzz
|
|
246
248
|
\#@end
|
247
249
|
HERE
|
248
250
|
|
249
|
-
|
251
|
+
expected = <<HERE
|
250
252
|
--- puts(str) -> String
|
251
253
|
|
252
254
|
xxx
|
@@ -255,13 +257,13 @@ xxx
|
|
255
257
|
puts("xxx")
|
256
258
|
//}
|
257
259
|
HERE
|
258
|
-
|
259
|
-
|
260
|
-
|
260
|
+
ret = Preprocessor.wrap(StringIO.new(src), params).to_a
|
261
|
+
assert_equal(expected, ret.join)
|
262
|
+
end
|
261
263
|
|
262
|
-
|
263
|
-
|
264
|
-
|
264
|
+
def test_samplecode_with_condition4
|
265
|
+
params = { 'version' => '1.9.2' }
|
266
|
+
src = <<HERE
|
265
267
|
--- puts(str) -> String
|
266
268
|
|
267
269
|
xxx
|
@@ -275,7 +277,7 @@ puts("zzz")
|
|
275
277
|
\#@end
|
276
278
|
HERE
|
277
279
|
|
278
|
-
|
280
|
+
expected = <<HERE
|
279
281
|
--- puts(str) -> String
|
280
282
|
|
281
283
|
xxx
|
@@ -286,7 +288,8 @@ puts("yyy")
|
|
286
288
|
puts("zzz")
|
287
289
|
//}
|
288
290
|
HERE
|
289
|
-
|
290
|
-
|
291
|
+
ret = Preprocessor.wrap(StringIO.new(src), params).to_a
|
292
|
+
assert_equal(expected, ret.join)
|
293
|
+
end
|
291
294
|
end
|
292
295
|
end
|
data/test/test_rdcompiler.rb
CHANGED
@@ -658,7 +658,7 @@ HERE
|
|
658
658
|
"man command" => ['[[man:tr(1)]]', '<a class="external" href="http://www.opengroup.org/onlinepubs/009695399/utilities/tr.html">tr(1)</a>'],
|
659
659
|
"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>'],
|
660
660
|
"man system call" => ['[[man:fopen(3linux)]]', '<a class="external" href="http://man7.org/linux/man-pages/man3/fopen.3.html">fopen(3linux)</a>'],
|
661
|
-
"RFC" => ['[[RFC:2822]]', '<a class="external" href="
|
661
|
+
"RFC" => ['[[RFC:2822]]', '<a class="external" href="https://tools.ietf.org/html/rfc2822">[RFC2822]</a>'],
|
662
662
|
"special var $~" => ['[[m:$~]]', '<a href="dummy/method/Kernel/v/=7e">$~</a>'],
|
663
663
|
"special var $," => ['[[m:$,]]', '<a href="dummy/method/Kernel/v/=2c">$,</a>'],
|
664
664
|
"extra close bracket" => ['[[c:String]]]', '<a href="dummy/class/String">String</a>]'],
|
@@ -667,7 +667,8 @@ HERE
|
|
667
667
|
"url" => ['[[url:http://i.loveruby.net]]', '<a class="external" href="http://i.loveruby.net">http://i.loveruby.net</a>'],
|
668
668
|
"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>'],
|
669
669
|
"bugs.r-l.o feature" => ['[[feature:12345]]', '<a class="external" href="https://bugs.ruby-lang.org/issues/12345">[feature#12345]</a>'],
|
670
|
-
"bugs.r-l.o bug" => ['[[bug:12345]]', '<a class="external" href="https://bugs.ruby-lang.org/issues/12345">[bug#12345]</a>'],
|
670
|
+
"bugs.r-l.o bug" => ['[[bug:12345]]', '<a class="external" href="https://bugs.ruby-lang.org/issues/12345">[bug#12345]</a>'],
|
671
|
+
"bugs.r-l.o misc" => ['[[misc:12345]]', '<a class="external" href="https://bugs.ruby-lang.org/issues/12345">[misc#12345]</a>'])
|
671
672
|
def test_bracket_link(data)
|
672
673
|
target, expected = data
|
673
674
|
assert_equal(expected, @c.send(:compile_text, target), target)
|
data/theme/default/style.css
CHANGED
@@ -115,9 +115,16 @@ span.compileerror {
|
|
115
115
|
|
116
116
|
pre {
|
117
117
|
line-height: 1.1;
|
118
|
-
background-color: #
|
118
|
+
background-color: #f2f2f2;
|
119
119
|
padding: 10px;
|
120
120
|
font-weight: normal;
|
121
|
+
}
|
122
|
+
|
123
|
+
pre.highlight {
|
124
|
+
line-height: 1.1;
|
125
|
+
background-color: #f2f2f2;
|
126
|
+
padding: 0px 10px 10px 10px;
|
127
|
+
font-weight: normal;
|
121
128
|
position: relative;
|
122
129
|
}
|
123
130
|
|
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.1.
|
4
|
+
version: 1.1.1
|
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: 2018-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|
@@ -241,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
241
|
version: '0'
|
242
242
|
requirements: []
|
243
243
|
rubyforge_project: ''
|
244
|
-
rubygems_version: 2.
|
244
|
+
rubygems_version: 2.7.3
|
245
245
|
signing_key:
|
246
246
|
specification_version: 4
|
247
247
|
summary: BitClust is a rurema document processor.
|