bitclust-core 1.0.0 → 1.1.0
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.lillia/class +4 -1
- data/data/bitclust/template.lillia/class-index +4 -1
- data/data/bitclust/template.lillia/doc +4 -1
- data/data/bitclust/template.lillia/layout +2 -0
- data/data/bitclust/template.lillia/library +4 -1
- data/data/bitclust/template.lillia/library-index +4 -1
- data/data/bitclust/template.lillia/method +2 -1
- data/data/bitclust/template.offline/class +4 -1
- data/data/bitclust/template.offline/class-index +4 -1
- data/data/bitclust/template.offline/doc +4 -1
- data/data/bitclust/template.offline/function +1 -0
- data/data/bitclust/template.offline/function-index +4 -1
- data/data/bitclust/template.offline/layout +3 -0
- data/data/bitclust/template.offline/library +4 -1
- data/data/bitclust/template.offline/library-index +4 -1
- data/data/bitclust/template.offline/method +1 -0
- data/data/bitclust/template/class +4 -1
- data/data/bitclust/template/class-index +4 -1
- data/data/bitclust/template/doc +4 -1
- data/data/bitclust/template/function +4 -1
- data/data/bitclust/template/layout +3 -0
- data/data/bitclust/template/library +4 -1
- data/data/bitclust/template/library-index +4 -1
- data/data/bitclust/template/method +1 -0
- data/lib/bitclust/classentry.rb +4 -0
- data/lib/bitclust/docentry.rb +4 -1
- data/lib/bitclust/functionentry.rb +3 -1
- data/lib/bitclust/libraryentry.rb +5 -3
- data/lib/bitclust/methodentry.rb +3 -1
- data/lib/bitclust/preprocessor.rb +74 -14
- data/lib/bitclust/rdcompiler.rb +35 -15
- data/lib/bitclust/screen.rb +12 -1
- data/lib/bitclust/subcommands/preproc_command.rb +1 -1
- data/lib/bitclust/subcommands/statichtml_command.rb +12 -1
- data/lib/bitclust/syntax_highlighter.rb +318 -0
- data/lib/bitclust/version.rb +1 -1
- data/test/test_preprocessor.rb +209 -1
- data/test/test_rdcompiler.rb +79 -0
- data/theme/default/style.css +12 -0
- data/theme/default/syntax-highlight.css +209 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65bc872cdee2bcbfa401dd333e2da96d4baf89b0
|
4
|
+
data.tar.gz: 6eba8bfb09fdb1cabff3c622cf80ef89e090bfb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e5df249ca6c12c2523615ed9f5eb2a6105961eeba64427e3040b0ebf203994f3c9c0eecfd2123704a7dad4fed624122491bf1f049a13a3806cc4ec8848a209e
|
7
|
+
data.tar.gz: 32ae4f1ee90a470735707c86bda648e810ff7d4cce10253ad02c54924b6b45845f8b15da35cc6c65cf6b5e79d469bd80a26db52e958a4f77c6a23357ab2e3492
|
@@ -2,12 +2,14 @@
|
|
2
2
|
<html lang="ja-JP">
|
3
3
|
<head>
|
4
4
|
<%= google_tag_manager %>
|
5
|
+
<%= meta_robots %>
|
5
6
|
<meta http-equiv="Content-Type" content="text/html; charset=<%=h charset() %>">
|
6
7
|
<meta http-equiv="Content-Language" content="ja-JP">
|
7
8
|
<link rel="stylesheet" type="text/css" href="<%=h css_url() %>">
|
8
9
|
<script type="text/javascript" src="<%=h js_url() %>"></script>
|
9
10
|
<link rel="icon" type="image/png" href="<%=h favicon_url() %>">
|
10
11
|
<title><%=h @title %> (Ruby <%=h ruby_version %>)</title>
|
12
|
+
<meta name="description" content="<%=h @description %>">
|
11
13
|
</head>
|
12
14
|
<body>
|
13
15
|
<%= yield %>
|
@@ -1,7 +1,8 @@
|
|
1
1
|
<%
|
2
2
|
entry = @entries.sort.first
|
3
|
+
@title = "#{entry.type_label} #{entry.label}"
|
4
|
+
@description = entry.description
|
3
5
|
%>
|
4
|
-
<% @title = "#{entry.type_label} #{entry.label}" %>
|
5
6
|
<p>
|
6
7
|
<%= manual_home_link() %>
|
7
8
|
> <a href="<%= library_index_url() %>"><%= _('All Libraries') %></a>
|
@@ -2,14 +2,17 @@
|
|
2
2
|
<html lang="ja-JP">
|
3
3
|
<head>
|
4
4
|
<%= google_tag_manager %>
|
5
|
+
<%= meta_robots %>
|
5
6
|
<meta http-equiv="Content-Type" content="text/html; charset=<%=h charset() %>">
|
6
7
|
<meta http-equiv="Content-Language" content="ja-JP">
|
7
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") %>">
|
8
10
|
<link rel="icon" type="image/png" href="<%=h favicon_url() %>">
|
9
11
|
<% if @conf[:canonical_base_url] %>
|
10
12
|
<link rel="canonical" href="<%= canonical_url() %>">
|
11
13
|
<% end %>
|
12
14
|
<title><%=h @title %> (Ruby <%=h ruby_version %>)</title>
|
15
|
+
<meta name="description" content="<%=h @description %>">
|
13
16
|
</head>
|
14
17
|
<body>
|
15
18
|
<%= yield %>
|
data/data/bitclust/template/doc
CHANGED
@@ -2,11 +2,14 @@
|
|
2
2
|
<html lang="ja-JP">
|
3
3
|
<head>
|
4
4
|
<%= google_tag_manager %>
|
5
|
+
<%= meta_robots %>
|
5
6
|
<meta http-equiv="Content-Type" content="text/html; charset=<%=h charset() %>">
|
6
7
|
<meta http-equiv="Content-Language" content="ja-JP">
|
7
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") %>">
|
8
10
|
<link rel="icon" type="image/png" href="<%=h favicon_url() %>">
|
9
11
|
<title><%=h @title %> (Ruby <%=h ruby_version %>)</title>
|
12
|
+
<meta name="description" content="<%=h @description %>">
|
10
13
|
<link rel="search" type="application/opensearchdescription+xml" title="<%= _('Ruby %s Reference Manual', ruby_version()) %>" href="<%=h opensearchdescription_url() %>">
|
11
14
|
</head>
|
12
15
|
<body>
|
data/lib/bitclust/classentry.rb
CHANGED
data/lib/bitclust/docentry.rb
CHANGED
@@ -77,6 +77,10 @@ module BitClust
|
|
77
77
|
"#<library #{@id}>"
|
78
78
|
end
|
79
79
|
|
80
|
+
def description
|
81
|
+
source.split(/\n\n+/, 2)[0]
|
82
|
+
end
|
83
|
+
|
80
84
|
def check_link(path = [])
|
81
85
|
return if @link_checked
|
82
86
|
if path.include?(name())
|
@@ -213,7 +217,5 @@ module BitClust
|
|
213
217
|
@db.dirty_library self
|
214
218
|
end
|
215
219
|
end
|
216
|
-
|
217
|
-
end
|
218
|
-
|
220
|
+
end
|
219
221
|
end
|
data/lib/bitclust/methodentry.rb
CHANGED
@@ -79,9 +79,9 @@ module BitClust
|
|
79
79
|
when /\A\#@\#/ # preprocessor comment
|
80
80
|
;
|
81
81
|
when /\A\#@todo/i
|
82
|
-
@buf.push line.gsub(/\A
|
82
|
+
@buf.push line.gsub(/\A\#/, '') if current_cond.processing?
|
83
83
|
when /\A\#@include\s*\((.*?)\)/
|
84
|
-
next unless current_cond
|
84
|
+
next unless current_cond.processing?
|
85
85
|
begin
|
86
86
|
file = $1.strip
|
87
87
|
basedir = File.dirname(line.location.file)
|
@@ -93,18 +93,24 @@ module BitClust
|
|
93
93
|
cond_stmt_begin line, build_cond_by_value(line, 'version >=')
|
94
94
|
when /\A\#@until\b/
|
95
95
|
cond_stmt_begin line, build_cond_by_value(line, 'version <')
|
96
|
+
when /\A\#@samplecode\b/
|
97
|
+
samplecode_begin(line, samplecode_description_by_value(line))
|
96
98
|
when /\A\#@if\b/
|
97
99
|
cond_stmt_begin line, line.sub(/\A\#@if/, '').strip
|
98
100
|
when /\A\#@else\s*\z/
|
99
|
-
parse_error "no matching
|
101
|
+
parse_error "no matching \#@if", line if cond_toplevel?
|
100
102
|
cond_invert
|
101
103
|
when /\A\#@end\s*\z/
|
102
|
-
|
103
|
-
|
104
|
+
if samplecode_processing?
|
105
|
+
samplecode_end
|
106
|
+
else
|
107
|
+
parse_error "no matching \#@if", line if cond_toplevel?
|
108
|
+
cond_pop
|
109
|
+
end
|
104
110
|
when /\A\#@/
|
105
111
|
parse_error "unknown preprocessor directive", line
|
106
112
|
else
|
107
|
-
if current_cond
|
113
|
+
if current_cond.processing?
|
108
114
|
@buf.push line
|
109
115
|
break
|
110
116
|
end
|
@@ -139,28 +145,30 @@ module BitClust
|
|
139
145
|
end
|
140
146
|
|
141
147
|
def current_cond
|
142
|
-
@
|
148
|
+
@state_stack.last
|
143
149
|
end
|
144
150
|
|
145
151
|
def cond_init
|
146
|
-
@
|
152
|
+
@state_stack = [State.new(nil, :toplevel)]
|
147
153
|
end
|
148
154
|
|
149
155
|
def cond_toplevel?
|
150
|
-
@
|
156
|
+
@state_stack.size == 1
|
151
157
|
end
|
152
158
|
|
153
159
|
def cond_push(bool)
|
154
|
-
@
|
160
|
+
last = @state_stack.last
|
161
|
+
@state_stack.push(State.new(last.current, bool))
|
155
162
|
end
|
156
163
|
|
157
164
|
def cond_invert
|
158
|
-
b = @
|
159
|
-
|
165
|
+
b = @state_stack.pop.processing?
|
166
|
+
last = @state_stack.last
|
167
|
+
@state_stack.push(State.new(last.current, !b))
|
160
168
|
end
|
161
169
|
|
162
170
|
def cond_pop
|
163
|
-
@
|
171
|
+
@state_stack.pop
|
164
172
|
end
|
165
173
|
|
166
174
|
def eval_cond(str)
|
@@ -231,12 +239,64 @@ module BitClust
|
|
231
239
|
end
|
232
240
|
end
|
233
241
|
|
242
|
+
def samplecode_begin(line, description)
|
243
|
+
description = description.strip
|
244
|
+
samplecode_push(description)
|
245
|
+
return unless current_cond.processing?
|
246
|
+
@buf.push("//emlist[#{description}][ruby]{\n")
|
247
|
+
end
|
248
|
+
|
249
|
+
def samplecode_end
|
250
|
+
samplecode_pop
|
251
|
+
return unless current_cond.processing?
|
252
|
+
@buf.push("//}\n")
|
253
|
+
end
|
254
|
+
|
255
|
+
def samplecode_push(description)
|
256
|
+
last = @state_stack.last
|
257
|
+
@state_stack.push(State.new(last.current, :samplecode))
|
258
|
+
end
|
259
|
+
|
260
|
+
def samplecode_pop
|
261
|
+
@state_stack.pop
|
262
|
+
end
|
263
|
+
|
264
|
+
def samplecode_processing?
|
265
|
+
@state_stack.last.samplecode?
|
266
|
+
end
|
267
|
+
|
268
|
+
def samplecode_description_by_value(line)
|
269
|
+
line.sub(/\A\#@samplecode/, "")
|
270
|
+
end
|
271
|
+
|
234
272
|
def scan_error(msg)
|
235
273
|
raise ScanError, msg
|
236
274
|
end
|
237
275
|
|
238
|
-
|
276
|
+
class State
|
277
|
+
attr_reader :current
|
278
|
+
|
279
|
+
def initialize(previous, current)
|
280
|
+
@previous = previous
|
281
|
+
@current = current
|
282
|
+
end
|
283
|
+
|
284
|
+
def toplevel?
|
285
|
+
@current == :toplevel
|
286
|
+
end
|
239
287
|
|
288
|
+
def processing?
|
289
|
+
toplevel? ||
|
290
|
+
(@current == true && @previous != false) ||
|
291
|
+
(@current == :samplecode && @previous == true) ||
|
292
|
+
(@current == :samplecode && @previous == :toplevel)
|
293
|
+
end
|
294
|
+
|
295
|
+
def samplecode?
|
296
|
+
@current == :samplecode
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
240
300
|
|
241
301
|
# Used by tools/stattodo.rb
|
242
302
|
class LineCollector < LineFilter
|