rdoc 8.0.0 → 8.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/CONTRIBUTING.md +1 -3
- data/RI.md +75 -75
- data/exe/rdoc +2 -2
- data/lib/rdoc/code_object/alias.rb +71 -69
- data/lib/rdoc/code_object/any_method.rb +305 -303
- data/lib/rdoc/code_object/attr.rb +150 -148
- data/lib/rdoc/code_object/class_module.rb +798 -792
- data/lib/rdoc/code_object/constant.rb +175 -173
- data/lib/rdoc/code_object/context/section.rb +142 -138
- data/lib/rdoc/code_object/context.rb +926 -958
- data/lib/rdoc/code_object/extend.rb +7 -5
- data/lib/rdoc/code_object/include.rb +7 -5
- data/lib/rdoc/code_object/method_attr.rb +326 -319
- data/lib/rdoc/code_object/mixin.rb +97 -95
- data/lib/rdoc/code_object/normal_class.rb +77 -78
- data/lib/rdoc/code_object/normal_module.rb +61 -59
- data/lib/rdoc/code_object/require.rb +23 -39
- data/lib/rdoc/code_object/single_class.rb +21 -19
- data/lib/rdoc/code_object/top_level.rb +212 -219
- data/lib/rdoc/code_object.rb +305 -303
- data/lib/rdoc/comment.rb +275 -273
- data/lib/rdoc/cross_reference.rb +192 -190
- data/lib/rdoc/encoding.rb +105 -103
- data/lib/rdoc/erb_partial.rb +13 -11
- data/lib/rdoc/erbio.rb +29 -27
- data/lib/rdoc/generator/aliki.rb +161 -153
- data/lib/rdoc/generator/darkfish.rb +645 -635
- data/lib/rdoc/generator/json_index.rb +233 -229
- data/lib/rdoc/generator/markup.rb +164 -146
- data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
- data/lib/rdoc/generator/pot/po.rb +52 -51
- data/lib/rdoc/generator/pot/po_entry.rb +138 -132
- data/lib/rdoc/generator/pot.rb +85 -81
- data/lib/rdoc/generator/ri.rb +23 -19
- data/lib/rdoc/generator/template/aliki/DESIGN.md +6 -4
- data/lib/rdoc/generator/template/aliki/_footer.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/_head.rhtml +10 -10
- data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
- data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +4 -4
- data/lib/rdoc/generator/template/aliki/css/rdoc.css +207 -178
- data/lib/rdoc/generator/template/aliki/js/aliki.js +60 -84
- data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
- data/lib/rdoc/generator.rb +48 -46
- data/lib/rdoc/i18n/locale.rb +99 -95
- data/lib/rdoc/i18n/text.rb +109 -105
- data/lib/rdoc/i18n.rb +7 -5
- data/lib/rdoc/markdown/byte_runtime.rb +80 -0
- data/lib/rdoc/markdown.kpeg +15 -11
- data/lib/rdoc/markdown.rb +40 -47
- data/lib/rdoc/markup/block_quote.rb +12 -8
- data/lib/rdoc/markup/document.rb +127 -123
- data/lib/rdoc/markup/formatter.rb +219 -215
- data/lib/rdoc/markup/include.rb +33 -29
- data/lib/rdoc/markup/indented_paragraph.rb +37 -33
- data/lib/rdoc/markup/inline_parser.rb +281 -277
- data/lib/rdoc/markup/list.rb +80 -88
- data/lib/rdoc/markup/list_item.rb +73 -85
- data/lib/rdoc/markup/paragraph.rb +23 -19
- data/lib/rdoc/markup/parser.rb +501 -497
- data/lib/rdoc/markup/pre_process.rb +283 -279
- data/lib/rdoc/markup/raw.rb +2 -2
- data/lib/rdoc/markup/rule.rb +16 -12
- data/lib/rdoc/markup/to_ansi.rb +143 -139
- data/lib/rdoc/markup/to_bs.rb +72 -68
- data/lib/rdoc/markup/to_html.rb +594 -565
- data/lib/rdoc/markup/to_html_crossref.rb +234 -230
- data/lib/rdoc/markup/to_html_snippet.rb +232 -227
- data/lib/rdoc/markup/to_joined_paragraph.rb +36 -32
- data/lib/rdoc/markup/to_label.rb +63 -59
- data/lib/rdoc/markup/to_markdown.rb +212 -208
- data/lib/rdoc/markup/to_rdoc.rb +336 -332
- data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
- data/lib/rdoc/markup/to_test.rb +60 -56
- data/lib/rdoc/markup/to_tt_only.rb +84 -80
- data/lib/rdoc/markup/verbatim.rb +62 -58
- data/lib/rdoc/markup.rb +198 -196
- data/lib/rdoc/options.rb +1063 -1061
- data/lib/rdoc/parser/c.rb +1039 -1037
- data/lib/rdoc/parser/changelog.rb +319 -315
- data/lib/rdoc/parser/markdown.rb +17 -13
- data/lib/rdoc/parser/rbs.rb +239 -235
- data/lib/rdoc/parser/rd.rb +17 -13
- data/lib/rdoc/parser/ruby.rb +1245 -1124
- data/lib/rdoc/parser/ruby_colorizer.rb +263 -213
- data/lib/rdoc/parser/simple.rb +31 -27
- data/lib/rdoc/parser/text.rb +12 -8
- data/lib/rdoc/parser.rb +228 -220
- data/lib/rdoc/rbs_helper.rb +1 -1
- data/lib/rdoc/rd/inline.rb +57 -53
- data/lib/rdoc/rd.rb +90 -88
- data/lib/rdoc/rdoc.rb +500 -491
- data/lib/rdoc/ri/driver.rb +1140 -1135
- data/lib/rdoc/ri/formatter.rb +7 -3
- data/lib/rdoc/ri/paths.rb +140 -136
- data/lib/rdoc/ri/servlet.rb +354 -350
- data/lib/rdoc/ri/store.rb +4 -2
- data/lib/rdoc/ri/task.rb +55 -51
- data/lib/rdoc/ri.rb +14 -12
- data/lib/rdoc/rubygems_hook.rb +183 -181
- data/lib/rdoc/server.rb +349 -347
- data/lib/rdoc/stats/normal.rb +46 -42
- data/lib/rdoc/stats/quiet.rb +39 -35
- data/lib/rdoc/stats/verbose.rb +35 -31
- data/lib/rdoc/stats.rb +365 -363
- data/lib/rdoc/store.rb +888 -902
- data/lib/rdoc/task.rb +260 -256
- data/lib/rdoc/text.rb +135 -133
- data/lib/rdoc/token_stream.rb +101 -93
- data/lib/rdoc/tom_doc.rb +203 -201
- data/lib/rdoc/version.rb +1 -1
- metadata +4 -5
- data/lib/rdoc/markdown/literals.kpeg +0 -21
- data/lib/rdoc/markdown/literals.rb +0 -454
|
@@ -5,280 +5,284 @@ begin
|
|
|
5
5
|
rescue LoadError
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
# @
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
# "
|
|
39
|
-
# ["a", "
|
|
40
|
-
# "
|
|
41
|
-
# ["
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
50
|
-
#
|
|
51
|
-
# +info+ field contains the item's name,
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
#
|
|
55
|
-
#
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
#
|
|
59
|
-
#
|
|
60
|
-
#
|
|
61
|
-
#
|
|
62
|
-
#
|
|
63
|
-
#
|
|
64
|
-
# the
|
|
65
|
-
#
|
|
66
|
-
#
|
|
67
|
-
#
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
#
|
|
72
|
-
#
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
8
|
+
module RDoc
|
|
9
|
+
module Generator
|
|
10
|
+
##
|
|
11
|
+
# The JsonIndex generator is designed to complement an HTML generator and
|
|
12
|
+
# produces a JSON search index. This generator is derived from sdoc by
|
|
13
|
+
# Vladimir Kolesnikov and contains verbatim code written by him.
|
|
14
|
+
#
|
|
15
|
+
# This generator is designed to be used with a regular HTML generator:
|
|
16
|
+
#
|
|
17
|
+
# class RDoc::Generator::Darkfish
|
|
18
|
+
# def initialize options
|
|
19
|
+
# # ...
|
|
20
|
+
# @base_dir = Pathname.pwd.expand_path
|
|
21
|
+
#
|
|
22
|
+
# @json_index = RDoc::Generator::JsonIndex.new self, options
|
|
23
|
+
# end
|
|
24
|
+
#
|
|
25
|
+
# def generate
|
|
26
|
+
# # ...
|
|
27
|
+
# @json_index.generate
|
|
28
|
+
# end
|
|
29
|
+
# end
|
|
30
|
+
#
|
|
31
|
+
# == Index Format
|
|
32
|
+
#
|
|
33
|
+
# The index is output as a JSON file assigned to the global variable
|
|
34
|
+
# +search_data+. The structure is:
|
|
35
|
+
#
|
|
36
|
+
# var search_data = {
|
|
37
|
+
# "index": {
|
|
38
|
+
# "searchIndex":
|
|
39
|
+
# ["a", "b", ...],
|
|
40
|
+
# "longSearchIndex":
|
|
41
|
+
# ["a", "a::b", ...],
|
|
42
|
+
# "info": [
|
|
43
|
+
# ["A", "A", "A.html", "", ""],
|
|
44
|
+
# ["B", "A::B", "A::B.html", "", ""],
|
|
45
|
+
# ...
|
|
46
|
+
# ]
|
|
47
|
+
# }
|
|
48
|
+
# }
|
|
49
|
+
#
|
|
50
|
+
# The same item is described across the +searchIndex+, +longSearchIndex+ and
|
|
51
|
+
# +info+ fields. The +searchIndex+ field contains the item's short name, the
|
|
52
|
+
# +longSearchIndex+ field contains the full_name (when appropriate) and the
|
|
53
|
+
# +info+ field contains the item's name, full_name, path, parameters and a
|
|
54
|
+
# snippet of the item's comment.
|
|
55
|
+
#
|
|
56
|
+
# == LICENSE
|
|
57
|
+
#
|
|
58
|
+
# Copyright (c) 2009 Vladimir Kolesnikov
|
|
59
|
+
#
|
|
60
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
61
|
+
# a copy of this software and associated documentation files (the
|
|
62
|
+
# "Software"), to deal in the Software without restriction, including
|
|
63
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
64
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
65
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
66
|
+
# the following conditions:
|
|
67
|
+
#
|
|
68
|
+
# The above copyright notice and this permission notice shall be
|
|
69
|
+
# included in all copies or substantial portions of the Software.
|
|
70
|
+
#
|
|
71
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
72
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
73
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
74
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
75
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
76
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
77
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
78
|
+
|
|
79
|
+
class JsonIndex
|
|
80
|
+
|
|
81
|
+
include Text
|
|
82
|
+
|
|
83
|
+
##
|
|
84
|
+
# Where the search index lives in the generated output
|
|
85
|
+
|
|
86
|
+
SEARCH_INDEX_FILE = File.join 'js', 'search_index.js'
|
|
87
|
+
|
|
88
|
+
attr_reader :index # :nodoc:
|
|
89
|
+
|
|
90
|
+
##
|
|
91
|
+
# Creates a new generator.
|
|
92
|
+
# +options+ are the same options passed to the parent generator.
|
|
93
|
+
|
|
94
|
+
def initialize(parent_generator, options)
|
|
95
|
+
@parent_generator = parent_generator
|
|
96
|
+
@store = parent_generator.store
|
|
97
|
+
@options = options
|
|
98
|
+
|
|
99
|
+
@template_dir = File.expand_path '../template/json_index', __FILE__
|
|
100
|
+
@base_dir = @parent_generator.base_dir
|
|
101
|
+
|
|
102
|
+
@classes = nil
|
|
103
|
+
@files = nil
|
|
104
|
+
@index = nil
|
|
105
|
+
end
|
|
104
106
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
##
|
|
108
|
+
# Builds the JSON index as a Hash.
|
|
107
109
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
def build_index
|
|
111
|
+
reset @store.all_files.sort, @store.all_classes_and_modules.sort
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
index_classes
|
|
114
|
+
index_methods
|
|
115
|
+
index_pages
|
|
114
116
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
{ :index => @index }
|
|
118
|
+
end
|
|
117
119
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
##
|
|
121
|
+
# Output progress information if debugging is enabled
|
|
120
122
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
def debug_msg(*msg)
|
|
124
|
+
return unless $DEBUG_RDOC
|
|
125
|
+
$stderr.puts(*msg)
|
|
126
|
+
end
|
|
125
127
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
##
|
|
129
|
+
# Writes the JSON index to disk
|
|
128
130
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
def generate
|
|
132
|
+
debug_msg "Generating JSON index"
|
|
131
133
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
debug_msg " writing search index to %s" % SEARCH_INDEX_FILE
|
|
135
|
+
data = build_index
|
|
134
136
|
|
|
135
|
-
|
|
137
|
+
return if @options.dry_run
|
|
136
138
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
out_dir = @base_dir + @options.op_dir
|
|
140
|
+
index_file = out_dir + SEARCH_INDEX_FILE
|
|
139
141
|
|
|
140
|
-
|
|
142
|
+
FileUtils.mkdir_p index_file.dirname, :verbose => $DEBUG_RDOC
|
|
141
143
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
index_file.open 'w', 0644 do |io|
|
|
145
|
+
io.set_encoding ::Encoding::UTF_8
|
|
146
|
+
io.write 'var search_data = '
|
|
145
147
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
JSON.dump data, io
|
|
149
|
+
end
|
|
150
|
+
unless ENV['SOURCE_DATE_EPOCH'].nil?
|
|
151
|
+
index_file.utime index_file.atime, Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).gmtime
|
|
152
|
+
end
|
|
151
153
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
Dir.chdir @template_dir do
|
|
155
|
+
Dir['**/*.js'].each do |source|
|
|
156
|
+
dest = File.join out_dir, source
|
|
155
157
|
|
|
156
|
-
|
|
158
|
+
FileUtils.install source, dest, :mode => 0644, :preserve => true, :verbose => $DEBUG_RDOC
|
|
159
|
+
end
|
|
160
|
+
end
|
|
157
161
|
end
|
|
158
|
-
end
|
|
159
|
-
end
|
|
160
162
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
+
##
|
|
164
|
+
# Compress the search_index.js file using gzip
|
|
163
165
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
+
def generate_gzipped
|
|
167
|
+
return if @options.dry_run or not defined?(Zlib)
|
|
166
168
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
+
debug_msg "Compressing generated JSON index"
|
|
170
|
+
out_dir = @base_dir + @options.op_dir
|
|
169
171
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
search_index_file = out_dir + SEARCH_INDEX_FILE
|
|
173
|
+
outfile = out_dir + "#{search_index_file}.gz"
|
|
172
174
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
+
debug_msg "Reading the JSON index file from %s" % search_index_file
|
|
176
|
+
search_index = search_index_file.read(mode: 'r:utf-8')
|
|
175
177
|
|
|
176
|
-
|
|
178
|
+
debug_msg "Writing gzipped search index to %s" % outfile
|
|
177
179
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
Zlib::GzipWriter.open(outfile) do |gz|
|
|
181
|
+
gz.mtime = File.mtime(search_index_file)
|
|
182
|
+
gz.orig_name = search_index_file.basename.to_s
|
|
183
|
+
gz.write search_index
|
|
184
|
+
gz.close
|
|
185
|
+
end
|
|
184
186
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
# GZip the rest of the js files
|
|
188
|
+
Dir.chdir @template_dir do
|
|
189
|
+
Dir['**/*.js'].each do |source|
|
|
190
|
+
dest = out_dir + source
|
|
191
|
+
outfile = out_dir + "#{dest}.gz"
|
|
190
192
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
debug_msg "Reading the original js file from %s" % dest
|
|
194
|
+
data = dest.read
|
|
193
195
|
|
|
194
|
-
|
|
196
|
+
debug_msg "Writing gzipped file to %s" % outfile
|
|
195
197
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
Zlib::GzipWriter.open(outfile) do |gz|
|
|
199
|
+
gz.mtime = File.mtime(dest)
|
|
200
|
+
gz.orig_name = dest.basename.to_s
|
|
201
|
+
gz.write data
|
|
202
|
+
gz.close
|
|
203
|
+
end
|
|
204
|
+
end
|
|
201
205
|
end
|
|
202
206
|
end
|
|
203
|
-
end
|
|
204
|
-
end
|
|
205
207
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
+
##
|
|
209
|
+
# Adds classes and modules to the index
|
|
208
210
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
+
def index_classes
|
|
212
|
+
debug_msg " generating class search index"
|
|
211
213
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
documented = @classes.uniq.select do |klass|
|
|
215
|
+
klass.document_self_or_methods
|
|
216
|
+
end
|
|
215
217
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
218
|
+
documented.each do |klass|
|
|
219
|
+
debug_msg " #{klass.full_name}"
|
|
220
|
+
record = klass.search_record
|
|
221
|
+
@index[:searchIndex] << search_string(record.shift)
|
|
222
|
+
@index[:longSearchIndex] << search_string(record.shift)
|
|
223
|
+
@index[:info] << record
|
|
224
|
+
end
|
|
225
|
+
end
|
|
224
226
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
+
##
|
|
228
|
+
# Adds methods to the index
|
|
227
229
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
+
def index_methods
|
|
231
|
+
debug_msg " generating method search index"
|
|
230
232
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
233
|
+
list = @classes.uniq.flat_map do |klass|
|
|
234
|
+
klass.method_list
|
|
235
|
+
end.sort_by do |method|
|
|
236
|
+
[method.name, method.parent.full_name]
|
|
237
|
+
end
|
|
236
238
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
239
|
+
list.each do |method|
|
|
240
|
+
debug_msg " #{method.full_name}"
|
|
241
|
+
record = method.search_record
|
|
242
|
+
@index[:searchIndex] << "#{search_string record.shift}()"
|
|
243
|
+
@index[:longSearchIndex] << "#{search_string record.shift}()"
|
|
244
|
+
@index[:info] << record
|
|
245
|
+
end
|
|
246
|
+
end
|
|
245
247
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
+
##
|
|
249
|
+
# Adds pages to the index
|
|
248
250
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
+
def index_pages
|
|
252
|
+
debug_msg " generating pages search index"
|
|
251
253
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
254
|
+
pages = @files.select do |file|
|
|
255
|
+
file.text? && file.full_name != @options.main_page
|
|
256
|
+
end
|
|
255
257
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
258
|
+
pages.each do |page|
|
|
259
|
+
debug_msg " #{page.page_name}"
|
|
260
|
+
record = page.search_record
|
|
261
|
+
@index[:searchIndex] << search_string(record.shift)
|
|
262
|
+
@index[:longSearchIndex] << ''
|
|
263
|
+
record.shift
|
|
264
|
+
@index[:info] << record
|
|
265
|
+
end
|
|
266
|
+
end
|
|
265
267
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
268
|
+
def reset(files, classes) # :nodoc:
|
|
269
|
+
@files = files
|
|
270
|
+
@classes = classes
|
|
269
271
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
272
|
+
@index = {
|
|
273
|
+
:searchIndex => [],
|
|
274
|
+
:longSearchIndex => [],
|
|
275
|
+
:info => []
|
|
276
|
+
}
|
|
277
|
+
end
|
|
276
278
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
+
##
|
|
280
|
+
# Removes whitespace and downcases +string+
|
|
279
281
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
282
|
+
def search_string(string)
|
|
283
|
+
string.downcase.gsub(/\s/, '')
|
|
284
|
+
end
|
|
283
285
|
|
|
286
|
+
end
|
|
287
|
+
end
|
|
284
288
|
end
|