rdoc 6.13.0 → 6.14.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/README.rdoc +3 -1
- data/lib/rdoc/code_object/any_method.rb +4 -4
- data/lib/rdoc/code_object/attr.rb +3 -3
- data/lib/rdoc/code_object/class_module.rb +18 -16
- data/lib/rdoc/code_object/constant.rb +5 -5
- data/lib/rdoc/code_object/context/section.rb +7 -7
- data/lib/rdoc/code_object/context.rb +19 -19
- data/lib/rdoc/code_object/method_attr.rb +6 -6
- data/lib/rdoc/code_object/mixin.rb +3 -3
- data/lib/rdoc/code_object/normal_class.rb +1 -1
- data/lib/rdoc/code_object/normal_module.rb +1 -1
- data/lib/rdoc/code_object/single_class.rb +1 -1
- data/lib/rdoc/code_object/top_level.rb +10 -8
- data/lib/rdoc/code_object.rb +3 -3
- data/lib/rdoc/comment.rb +6 -6
- data/lib/rdoc/cross_reference.rb +3 -3
- data/lib/rdoc/encoding.rb +4 -4
- data/lib/rdoc/erb_partial.rb +1 -1
- data/lib/rdoc/erbio.rb +2 -2
- data/lib/rdoc/generator/darkfish.rb +15 -15
- data/lib/rdoc/generator/json_index.rb +3 -3
- data/lib/rdoc/generator/markup.rb +12 -0
- data/lib/rdoc/generator/pot/message_extractor.rb +4 -4
- data/lib/rdoc/generator/pot/po.rb +1 -1
- data/lib/rdoc/generator/pot/po_entry.rb +7 -7
- data/lib/rdoc/generator/pot.rb +1 -1
- data/lib/rdoc/generator/ri.rb +1 -1
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +5 -0
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +2 -0
- data/lib/rdoc/markup/attribute_manager.rb +5 -5
- data/lib/rdoc/markup/attributes.rb +3 -3
- data/lib/rdoc/markup/blank_line.rb +2 -2
- data/lib/rdoc/markup/block_quote.rb +1 -1
- data/lib/rdoc/markup/document.rb +8 -8
- data/lib/rdoc/markup/formatter.rb +12 -12
- data/lib/rdoc/markup/hard_break.rb +3 -3
- data/lib/rdoc/markup/heading.rb +4 -4
- data/lib/rdoc/markup/include.rb +3 -3
- data/lib/rdoc/markup/indented_paragraph.rb +3 -3
- data/lib/rdoc/markup/list.rb +4 -4
- data/lib/rdoc/markup/list_item.rb +4 -4
- data/lib/rdoc/markup/paragraph.rb +2 -2
- data/lib/rdoc/markup/parser.rb +11 -11
- data/lib/rdoc/markup/pre_process.rb +6 -6
- data/lib/rdoc/markup/raw.rb +5 -5
- data/lib/rdoc/markup/rule.rb +2 -2
- data/lib/rdoc/markup/table.rb +4 -4
- data/lib/rdoc/markup/to_ansi.rb +3 -3
- data/lib/rdoc/markup/to_bs.rb +6 -6
- data/lib/rdoc/markup/to_html.rb +21 -16
- data/lib/rdoc/markup/to_html_crossref.rb +5 -5
- data/lib/rdoc/markup/to_html_snippet.rb +17 -17
- data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
- data/lib/rdoc/markup/to_label.rb +5 -5
- data/lib/rdoc/markup/to_markdown.rb +12 -12
- data/lib/rdoc/markup/to_rdoc.rb +29 -28
- data/lib/rdoc/markup/to_table_of_contents.rb +3 -3
- data/lib/rdoc/markup/to_test.rb +1 -1
- data/lib/rdoc/markup/to_tt_only.rb +8 -8
- data/lib/rdoc/markup/verbatim.rb +3 -3
- data/lib/rdoc/markup.rb +3 -3
- data/lib/rdoc/options.rb +31 -12
- data/lib/rdoc/parser/c.rb +16 -16
- data/lib/rdoc/parser/changelog.rb +9 -9
- data/lib/rdoc/parser/prism_ruby.rb +1 -1
- data/lib/rdoc/parser/ruby.rb +43 -43
- data/lib/rdoc/parser/simple.rb +2 -2
- data/lib/rdoc/parser.rb +8 -8
- data/lib/rdoc/rd/inline.rb +4 -4
- data/lib/rdoc/rd.rb +1 -1
- data/lib/rdoc/rdoc.rb +8 -8
- data/lib/rdoc/ri/driver.rb +49 -49
- data/lib/rdoc/ri/paths.rb +2 -2
- data/lib/rdoc/ri/task.rb +1 -1
- data/lib/rdoc/rubygems_hook.rb +14 -11
- data/lib/rdoc/servlet.rb +15 -15
- data/lib/rdoc/stats/normal.rb +1 -1
- data/lib/rdoc/stats/quiet.rb +1 -1
- data/lib/rdoc/stats/verbose.rb +3 -3
- data/lib/rdoc/stats.rb +12 -12
- data/lib/rdoc/store.rb +30 -30
- data/lib/rdoc/task.rb +2 -2
- data/lib/rdoc/text.rb +11 -11
- data/lib/rdoc/token_stream.rb +1 -1
- data/lib/rdoc/tom_doc.rb +7 -7
- data/lib/rdoc/version.rb +1 -1
- data/man/ri.1 +2 -0
- metadata +17 -3
data/lib/rdoc/code_object.rb
CHANGED
@@ -236,7 +236,7 @@ class RDoc::CodeObject
|
|
236
236
|
#
|
237
237
|
# Set to +nil+ to clear RDoc's cached value
|
238
238
|
|
239
|
-
def full_name=
|
239
|
+
def full_name=(full_name)
|
240
240
|
@full_name = full_name
|
241
241
|
end
|
242
242
|
|
@@ -316,7 +316,7 @@ class RDoc::CodeObject
|
|
316
316
|
##
|
317
317
|
# Records the RDoc::TopLevel (file) where this code object was defined
|
318
318
|
|
319
|
-
def record_location
|
319
|
+
def record_location(top_level)
|
320
320
|
@ignored = false
|
321
321
|
@suppressed = false
|
322
322
|
@file = top_level
|
@@ -358,7 +358,7 @@ class RDoc::CodeObject
|
|
358
358
|
##
|
359
359
|
# Sets the +store+ that contains this CodeObject
|
360
360
|
|
361
|
-
def store=
|
361
|
+
def store=(store)
|
362
362
|
@store = store
|
363
363
|
|
364
364
|
return unless @track_visibility
|
data/lib/rdoc/comment.rb
CHANGED
@@ -53,7 +53,7 @@ class RDoc::Comment
|
|
53
53
|
# Creates a new comment with +text+ that is found in the RDoc::TopLevel
|
54
54
|
# +location+.
|
55
55
|
|
56
|
-
def initialize
|
56
|
+
def initialize(text = nil, location = nil, language = nil)
|
57
57
|
@location = location
|
58
58
|
@text = text.nil? ? nil : text.dup
|
59
59
|
@language = language
|
@@ -67,11 +67,11 @@ class RDoc::Comment
|
|
67
67
|
#--
|
68
68
|
# TODO deep copy @document
|
69
69
|
|
70
|
-
def initialize_copy
|
70
|
+
def initialize_copy(copy) # :nodoc:
|
71
71
|
@text = copy.text.dup
|
72
72
|
end
|
73
73
|
|
74
|
-
def ==
|
74
|
+
def ==(other) # :nodoc:
|
75
75
|
self.class === other and
|
76
76
|
other.text == @text and other.location == @location
|
77
77
|
end
|
@@ -129,7 +129,7 @@ class RDoc::Comment
|
|
129
129
|
##
|
130
130
|
# HACK dubious
|
131
131
|
|
132
|
-
def encode!
|
132
|
+
def encode!(encoding)
|
133
133
|
@text = String.new @text, encoding: encoding
|
134
134
|
self
|
135
135
|
end
|
@@ -137,7 +137,7 @@ class RDoc::Comment
|
|
137
137
|
##
|
138
138
|
# Sets the format of this comment and resets any parsed document
|
139
139
|
|
140
|
-
def format=
|
140
|
+
def format=(format)
|
141
141
|
@format = format
|
142
142
|
@document = nil
|
143
143
|
end
|
@@ -208,7 +208,7 @@ class RDoc::Comment
|
|
208
208
|
#
|
209
209
|
# An error is raised if the comment contains a document but no text.
|
210
210
|
|
211
|
-
def text=
|
211
|
+
def text=(text)
|
212
212
|
raise RDoc::Error, 'replacing document-only comment is not allowed' if
|
213
213
|
@text.nil? and @document
|
214
214
|
|
data/lib/rdoc/cross_reference.rb
CHANGED
@@ -124,7 +124,7 @@ class RDoc::CrossReference
|
|
124
124
|
# Allows cross-references to be created based on the given +context+
|
125
125
|
# (RDoc::Context).
|
126
126
|
|
127
|
-
def initialize
|
127
|
+
def initialize(context)
|
128
128
|
@context = context
|
129
129
|
@store = context.store
|
130
130
|
|
@@ -134,7 +134,7 @@ class RDoc::CrossReference
|
|
134
134
|
##
|
135
135
|
# Returns a method reference to +name+.
|
136
136
|
|
137
|
-
def resolve_method
|
137
|
+
def resolve_method(name)
|
138
138
|
ref = nil
|
139
139
|
|
140
140
|
if /#{CLASS_REGEXP_STR}([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then
|
@@ -187,7 +187,7 @@ class RDoc::CrossReference
|
|
187
187
|
# returned. If +name+ is escaped +name+ is returned. If +name+ is not
|
188
188
|
# found +text+ is returned.
|
189
189
|
|
190
|
-
def resolve
|
190
|
+
def resolve(name, text)
|
191
191
|
return @seen[name] if @seen.include? name
|
192
192
|
|
193
193
|
ref = case name
|
data/lib/rdoc/encoding.rb
CHANGED
@@ -29,7 +29,7 @@ module RDoc::Encoding
|
|
29
29
|
# If +force_transcode+ is true the document will be transcoded and any
|
30
30
|
# unknown character in the target encoding will be replaced with '?'
|
31
31
|
|
32
|
-
def self.read_file
|
32
|
+
def self.read_file(filename, encoding, force_transcode = false)
|
33
33
|
content = File.open filename, "rb" do |f| f.read end
|
34
34
|
content.gsub!("\r\n", "\n") if RUBY_PLATFORM =~ /mswin|mingw/
|
35
35
|
|
@@ -89,7 +89,7 @@ module RDoc::Encoding
|
|
89
89
|
##
|
90
90
|
# Detects the encoding of +string+ based on the magic comment
|
91
91
|
|
92
|
-
def self.detect_encoding
|
92
|
+
def self.detect_encoding(string)
|
93
93
|
result = HEADER_REGEXP.match string
|
94
94
|
name = result && result[:name]
|
95
95
|
|
@@ -99,7 +99,7 @@ module RDoc::Encoding
|
|
99
99
|
##
|
100
100
|
# Removes magic comments and shebang
|
101
101
|
|
102
|
-
def self.remove_magic_comment
|
102
|
+
def self.remove_magic_comment(string)
|
103
103
|
string.sub HEADER_REGEXP do |s|
|
104
104
|
s.gsub(/[^\n]/, '')
|
105
105
|
end
|
@@ -109,7 +109,7 @@ module RDoc::Encoding
|
|
109
109
|
# Changes encoding based on +encoding+ without converting and returns new
|
110
110
|
# string
|
111
111
|
|
112
|
-
def self.change_encoding
|
112
|
+
def self.change_encoding(text, encoding)
|
113
113
|
if text.kind_of? RDoc::Comment
|
114
114
|
text.encode! encoding
|
115
115
|
else
|
data/lib/rdoc/erb_partial.rb
CHANGED
@@ -9,7 +9,7 @@ class RDoc::ERBPartial < ERB
|
|
9
9
|
# Overrides +compiler+ startup to set the +eoutvar+ to an empty string only
|
10
10
|
# if it isn't already set.
|
11
11
|
|
12
|
-
def set_eoutvar
|
12
|
+
def set_eoutvar(compiler, eoutvar = '_erbout')
|
13
13
|
super
|
14
14
|
|
15
15
|
compiler.pre_cmd = ["#{eoutvar} ||= +''"]
|
data/lib/rdoc/erbio.rb
CHANGED
@@ -20,14 +20,14 @@ class RDoc::ERBIO < ERB
|
|
20
20
|
##
|
21
21
|
# Defaults +eoutvar+ to 'io', otherwise is identical to ERB's initialize
|
22
22
|
|
23
|
-
def initialize
|
23
|
+
def initialize(str, trim_mode: nil, eoutvar: 'io')
|
24
24
|
super(str, trim_mode: trim_mode, eoutvar: eoutvar)
|
25
25
|
end
|
26
26
|
|
27
27
|
##
|
28
28
|
# Instructs +compiler+ how to write to +io_variable+
|
29
29
|
|
30
|
-
def set_eoutvar
|
30
|
+
def set_eoutvar(compiler, io_variable)
|
31
31
|
compiler.put_cmd = "#{io_variable}.write"
|
32
32
|
compiler.insert_cmd = "#{io_variable}.write"
|
33
33
|
compiler.pre_cmd = []
|
@@ -150,7 +150,7 @@ class RDoc::Generator::Darkfish
|
|
150
150
|
##
|
151
151
|
# Initialize a few instance variables before we start
|
152
152
|
|
153
|
-
def initialize
|
153
|
+
def initialize(store, options)
|
154
154
|
@store = store
|
155
155
|
@options = options
|
156
156
|
|
@@ -269,7 +269,7 @@ class RDoc::Generator::Darkfish
|
|
269
269
|
# Return a list of the documented modules sorted by salience first, then
|
270
270
|
# by name.
|
271
271
|
|
272
|
-
def get_sorted_module_list
|
272
|
+
def get_sorted_module_list(classes)
|
273
273
|
classes.select do |klass|
|
274
274
|
klass.display?
|
275
275
|
end.sort
|
@@ -313,7 +313,7 @@ class RDoc::Generator::Darkfish
|
|
313
313
|
##
|
314
314
|
# Generates a class file for +klass+
|
315
315
|
|
316
|
-
def generate_class
|
316
|
+
def generate_class(klass, template_file = nil)
|
317
317
|
current = klass
|
318
318
|
|
319
319
|
template_file ||= @template_dir + 'class.rhtml'
|
@@ -435,7 +435,7 @@ class RDoc::Generator::Darkfish
|
|
435
435
|
##
|
436
436
|
# Generate a page file for +file+
|
437
437
|
|
438
|
-
def generate_page
|
438
|
+
def generate_page(file)
|
439
439
|
template_file = @template_dir + 'page.rhtml'
|
440
440
|
|
441
441
|
out_file = @outputdir + file.path
|
@@ -462,7 +462,7 @@ class RDoc::Generator::Darkfish
|
|
462
462
|
##
|
463
463
|
# Generates the 404 page for the RDoc servlet
|
464
464
|
|
465
|
-
def generate_servlet_not_found
|
465
|
+
def generate_servlet_not_found(message)
|
466
466
|
template_file = @template_dir + 'servlet_not_found.rhtml'
|
467
467
|
return unless template_file.exist?
|
468
468
|
|
@@ -493,7 +493,7 @@ class RDoc::Generator::Darkfish
|
|
493
493
|
##
|
494
494
|
# Generates the servlet root page for the RDoc servlet
|
495
495
|
|
496
|
-
def generate_servlet_root
|
496
|
+
def generate_servlet_root(installed)
|
497
497
|
template_file = @template_dir + 'servlet_root.rhtml'
|
498
498
|
return unless template_file.exist?
|
499
499
|
|
@@ -547,7 +547,7 @@ class RDoc::Generator::Darkfish
|
|
547
547
|
raise error
|
548
548
|
end
|
549
549
|
|
550
|
-
def install_rdoc_static_file
|
550
|
+
def install_rdoc_static_file(source, destination, options) # :nodoc:
|
551
551
|
return unless source.exist?
|
552
552
|
|
553
553
|
begin
|
@@ -586,7 +586,7 @@ class RDoc::Generator::Darkfish
|
|
586
586
|
# For backwards compatibility, if +body_file+ contains "<html" the body is
|
587
587
|
# used directly.
|
588
588
|
|
589
|
-
def assemble_template
|
589
|
+
def assemble_template(body_file)
|
590
590
|
body = body_file.read
|
591
591
|
return body if body =~ /<html/
|
592
592
|
|
@@ -595,7 +595,7 @@ class RDoc::Generator::Darkfish
|
|
595
595
|
<<-TEMPLATE
|
596
596
|
<!DOCTYPE html>
|
597
597
|
|
598
|
-
<html>
|
598
|
+
<html lang="#{@options.locale&.name || 'en'}">
|
599
599
|
<head>
|
600
600
|
#{head_file.read}
|
601
601
|
|
@@ -607,7 +607,7 @@ class RDoc::Generator::Darkfish
|
|
607
607
|
# Renders the ERb contained in +file_name+ relative to the template
|
608
608
|
# directory and returns the result based on the current context.
|
609
609
|
|
610
|
-
def render
|
610
|
+
def render(file_name)
|
611
611
|
template_file = @template_dir + file_name
|
612
612
|
|
613
613
|
template = template_for template_file, false, RDoc::ERBPartial
|
@@ -625,7 +625,7 @@ class RDoc::Generator::Darkfish
|
|
625
625
|
#
|
626
626
|
# An io will be yielded which must be captured by binding in the caller.
|
627
627
|
|
628
|
-
def render_template
|
628
|
+
def render_template(template_file, out_file = nil) # :yield: io
|
629
629
|
io_output = out_file && !@dry_run && @file_output
|
630
630
|
erb_klass = io_output ? RDoc::ERBIO : ERB
|
631
631
|
|
@@ -659,7 +659,7 @@ class RDoc::Generator::Darkfish
|
|
659
659
|
# Creates the result for +template+ with +context+. If an error is raised a
|
660
660
|
# Pathname +template_file+ will indicate the file where the error occurred.
|
661
661
|
|
662
|
-
def template_result
|
662
|
+
def template_result(template, context, template_file)
|
663
663
|
template.filename = template_file.to_s
|
664
664
|
template.result context
|
665
665
|
rescue NoMethodError => e
|
@@ -672,7 +672,7 @@ class RDoc::Generator::Darkfish
|
|
672
672
|
##
|
673
673
|
# Retrieves a cache template for +file+, if present, or fills the cache.
|
674
674
|
|
675
|
-
def template_for
|
675
|
+
def template_for(file, page = true, klass = ERB)
|
676
676
|
template = @template_cache[file]
|
677
677
|
|
678
678
|
return template if template
|
@@ -793,7 +793,7 @@ class RDoc::Generator::Darkfish
|
|
793
793
|
|
794
794
|
private
|
795
795
|
|
796
|
-
def nesting_namespaces_to_class_modules
|
796
|
+
def nesting_namespaces_to_class_modules(klass)
|
797
797
|
tree = {}
|
798
798
|
|
799
799
|
klass.nesting_namespaces.zip(klass.fully_qualified_nesting_namespaces) do |ns, fqns|
|
@@ -803,7 +803,7 @@ class RDoc::Generator::Darkfish
|
|
803
803
|
tree
|
804
804
|
end
|
805
805
|
|
806
|
-
def generate_nesting_namespaces_breadcrumb
|
806
|
+
def generate_nesting_namespaces_breadcrumb(klass, rel_prefix)
|
807
807
|
nesting_namespaces_to_class_modules(klass).map do |namespace, class_module|
|
808
808
|
path = class_module ? (rel_prefix + class_module.path).to_s : ""
|
809
809
|
{ name: namespace, path: path, self: klass.full_name == class_module&.full_name }
|
@@ -89,7 +89,7 @@ class RDoc::Generator::JsonIndex
|
|
89
89
|
# Creates a new generator.
|
90
90
|
# +options+ are the same options passed to the parent generator.
|
91
91
|
|
92
|
-
def initialize
|
92
|
+
def initialize(parent_generator, options)
|
93
93
|
@parent_generator = parent_generator
|
94
94
|
@store = parent_generator.store
|
95
95
|
@options = options
|
@@ -263,7 +263,7 @@ class RDoc::Generator::JsonIndex
|
|
263
263
|
end
|
264
264
|
end
|
265
265
|
|
266
|
-
def reset
|
266
|
+
def reset(files, classes) # :nodoc:
|
267
267
|
@files = files
|
268
268
|
@classes = classes
|
269
269
|
|
@@ -277,7 +277,7 @@ class RDoc::Generator::JsonIndex
|
|
277
277
|
##
|
278
278
|
# Removes whitespace and downcases +string+
|
279
279
|
|
280
|
-
def search_string
|
280
|
+
def search_string(string)
|
281
281
|
string.downcase.gsub(/\s/, '')
|
282
282
|
end
|
283
283
|
|
@@ -55,6 +55,18 @@ module RDoc::Generator::Markup
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
##
|
59
|
+
# The preferred URL for this object.
|
60
|
+
|
61
|
+
def canonical_url
|
62
|
+
options = @store.options
|
63
|
+
if path
|
64
|
+
File.join(options.canonical_root, path.to_s)
|
65
|
+
else
|
66
|
+
options.canonical_root
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
58
70
|
end
|
59
71
|
|
60
72
|
class RDoc::CodeObject
|
@@ -7,7 +7,7 @@ class RDoc::Generator::POT::MessageExtractor
|
|
7
7
|
##
|
8
8
|
# Creates a message extractor for +store+.
|
9
9
|
|
10
|
-
def initialize
|
10
|
+
def initialize(store)
|
11
11
|
@store = store
|
12
12
|
@po = RDoc::Generator::POT::PO.new
|
13
13
|
end
|
@@ -25,7 +25,7 @@ class RDoc::Generator::POT::MessageExtractor
|
|
25
25
|
|
26
26
|
private
|
27
27
|
|
28
|
-
def extract_from_klass
|
28
|
+
def extract_from_klass(klass)
|
29
29
|
extract_text(klass.comment_location, klass.full_name)
|
30
30
|
|
31
31
|
klass.each_section do |section, constants, attributes|
|
@@ -48,7 +48,7 @@ class RDoc::Generator::POT::MessageExtractor
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
def extract_text
|
51
|
+
def extract_text(text, comment, location = nil)
|
52
52
|
return if text.nil?
|
53
53
|
|
54
54
|
options = {
|
@@ -61,7 +61,7 @@ class RDoc::Generator::POT::MessageExtractor
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
def entry
|
64
|
+
def entry(msgid, options)
|
65
65
|
RDoc::Generator::POT::POEntry.new(msgid, options)
|
66
66
|
end
|
67
67
|
|
@@ -26,7 +26,7 @@ class RDoc::Generator::POT::POEntry
|
|
26
26
|
# Creates a PO entry for +msgid+. Other values can be specified by
|
27
27
|
# +options+.
|
28
28
|
|
29
|
-
def initialize
|
29
|
+
def initialize(msgid, options = {})
|
30
30
|
@msgid = msgid
|
31
31
|
@msgstr = options[:msgstr] || ""
|
32
32
|
@translator_comment = options[:translator_comment]
|
@@ -53,7 +53,7 @@ msgstr #{format_message(@msgstr)}
|
|
53
53
|
##
|
54
54
|
# Merges the PO entry with +other_entry+.
|
55
55
|
|
56
|
-
def merge
|
56
|
+
def merge(other_entry)
|
57
57
|
options = {
|
58
58
|
:extracted_comment => merge_string(@extracted_comment,
|
59
59
|
other_entry.extracted_comment),
|
@@ -69,7 +69,7 @@ msgstr #{format_message(@msgstr)}
|
|
69
69
|
|
70
70
|
private
|
71
71
|
|
72
|
-
def format_comment
|
72
|
+
def format_comment(mark, comment)
|
73
73
|
return '' unless comment
|
74
74
|
return '' if comment.empty?
|
75
75
|
|
@@ -106,7 +106,7 @@ msgstr #{format_message(@msgstr)}
|
|
106
106
|
"\#, #{formatted_flags}\n"
|
107
107
|
end
|
108
108
|
|
109
|
-
def format_message
|
109
|
+
def format_message(message)
|
110
110
|
return "\"#{escape(message)}\"" unless message.include?("\n")
|
111
111
|
|
112
112
|
formatted_message = '""'
|
@@ -117,7 +117,7 @@ msgstr #{format_message(@msgstr)}
|
|
117
117
|
formatted_message
|
118
118
|
end
|
119
119
|
|
120
|
-
def escape
|
120
|
+
def escape(string)
|
121
121
|
string.gsub(/["\\\t\n]/) do |special_character|
|
122
122
|
case special_character
|
123
123
|
when "\t"
|
@@ -130,11 +130,11 @@ msgstr #{format_message(@msgstr)}
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
133
|
-
def merge_string
|
133
|
+
def merge_string(string1, string2)
|
134
134
|
[string1, string2].compact.join("\n")
|
135
135
|
end
|
136
136
|
|
137
|
-
def merge_array
|
137
|
+
def merge_array(array1, array2)
|
138
138
|
(array1 + array2).uniq
|
139
139
|
end
|
140
140
|
|
data/lib/rdoc/generator/pot.rb
CHANGED
data/lib/rdoc/generator/ri.rb
CHANGED
@@ -25,6 +25,11 @@
|
|
25
25
|
<%- end -%>
|
26
26
|
<%- end -%>
|
27
27
|
|
28
|
+
<%- if canonical_url = @options.canonical_root -%>
|
29
|
+
<% canonical_url = current.canonical_url if defined?(current) %>
|
30
|
+
<link rel="canonical" href="<%= canonical_url %>">
|
31
|
+
<%- end -%>
|
32
|
+
|
28
33
|
<script type="text/javascript">
|
29
34
|
var rdoc_rel_prefix = "<%= h asset_rel_prefix %>/";
|
30
35
|
var index_rel_prefix = "<%= h rel_prefix %>/";
|
@@ -107,7 +107,7 @@ class RDoc::Markup::AttributeManager
|
|
107
107
|
##
|
108
108
|
# Changes the current attribute from +current+ to +new+
|
109
109
|
|
110
|
-
def change_attribute
|
110
|
+
def change_attribute(current, new)
|
111
111
|
diff = current ^ new
|
112
112
|
attribute(new & diff, current & diff)
|
113
113
|
end
|
@@ -116,7 +116,7 @@ class RDoc::Markup::AttributeManager
|
|
116
116
|
# Used by the tests to change attributes by name from +current_set+ to
|
117
117
|
# +new_set+
|
118
118
|
|
119
|
-
def changed_attribute_by_name
|
119
|
+
def changed_attribute_by_name(current_set, new_set)
|
120
120
|
current = new = 0
|
121
121
|
current_set.each do |name|
|
122
122
|
current |= @attributes.bitmap_for(name)
|
@@ -220,7 +220,7 @@ class RDoc::Markup::AttributeManager
|
|
220
220
|
##
|
221
221
|
# Converts regexp handling sequences to RDoc attributes
|
222
222
|
|
223
|
-
def convert_regexp_handlings
|
223
|
+
def convert_regexp_handlings(str, attrs, exclusive = false)
|
224
224
|
@regexp_handlings.each do |regexp, attribute|
|
225
225
|
next unless exclusive == exclusive?(attribute)
|
226
226
|
str.scan(regexp) do
|
@@ -295,7 +295,7 @@ class RDoc::Markup::AttributeManager
|
|
295
295
|
#
|
296
296
|
# @am.add_regexp_handling(/((https?:)\S+\w)/, :HYPERLINK)
|
297
297
|
|
298
|
-
def add_regexp_handling
|
298
|
+
def add_regexp_handling(pattern, name, exclusive = false)
|
299
299
|
bitmap = @attributes.bitmap_for(name)
|
300
300
|
@regexp_handlings << [pattern, bitmap]
|
301
301
|
@exclusive_bitmap |= bitmap if exclusive
|
@@ -304,7 +304,7 @@ class RDoc::Markup::AttributeManager
|
|
304
304
|
##
|
305
305
|
# Processes +str+ converting attributes, HTML and regexp handlings
|
306
306
|
|
307
|
-
def flow
|
307
|
+
def flow(str)
|
308
308
|
@str = str.dup
|
309
309
|
|
310
310
|
mask_protected_sequences
|
@@ -26,7 +26,7 @@ class RDoc::Markup::Attributes
|
|
26
26
|
##
|
27
27
|
# Returns a unique bit for +name+
|
28
28
|
|
29
|
-
def bitmap_for
|
29
|
+
def bitmap_for(name)
|
30
30
|
bitmap = @name_to_bitmap.assoc name
|
31
31
|
|
32
32
|
unless bitmap then
|
@@ -43,7 +43,7 @@ class RDoc::Markup::Attributes
|
|
43
43
|
##
|
44
44
|
# Returns a string representation of +bitmap+
|
45
45
|
|
46
|
-
def as_string
|
46
|
+
def as_string(bitmap)
|
47
47
|
return 'none' if bitmap.zero?
|
48
48
|
res = []
|
49
49
|
|
@@ -57,7 +57,7 @@ class RDoc::Markup::Attributes
|
|
57
57
|
##
|
58
58
|
# yields each attribute name in +bitmap+
|
59
59
|
|
60
|
-
def each_name_of
|
60
|
+
def each_name_of(bitmap)
|
61
61
|
return enum_for __method__, bitmap unless block_given?
|
62
62
|
|
63
63
|
@name_to_bitmap.each do |name, bit|
|
@@ -16,11 +16,11 @@ class RDoc::Markup::BlankLine
|
|
16
16
|
##
|
17
17
|
# Calls #accept_blank_line on +visitor+
|
18
18
|
|
19
|
-
def accept
|
19
|
+
def accept(visitor)
|
20
20
|
visitor.accept_blank_line self
|
21
21
|
end
|
22
22
|
|
23
|
-
def pretty_print
|
23
|
+
def pretty_print(q) # :nodoc:
|
24
24
|
q.text 'blankline'
|
25
25
|
end
|
26
26
|
|
data/lib/rdoc/markup/document.rb
CHANGED
@@ -37,7 +37,7 @@ class RDoc::Markup::Document
|
|
37
37
|
##
|
38
38
|
# Appends +part+ to the document
|
39
39
|
|
40
|
-
def <<
|
40
|
+
def <<(part)
|
41
41
|
case part
|
42
42
|
when RDoc::Markup::Document then
|
43
43
|
unless part.empty? then
|
@@ -53,7 +53,7 @@ class RDoc::Markup::Document
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
def ==
|
56
|
+
def ==(other) # :nodoc:
|
57
57
|
self.class == other.class and
|
58
58
|
@file == other.file and
|
59
59
|
@parts == other.parts
|
@@ -62,7 +62,7 @@ class RDoc::Markup::Document
|
|
62
62
|
##
|
63
63
|
# Runs this document and all its #items through +visitor+
|
64
64
|
|
65
|
-
def accept
|
65
|
+
def accept(visitor)
|
66
66
|
visitor.start_accepting
|
67
67
|
|
68
68
|
visitor.accept_document self
|
@@ -73,14 +73,14 @@ class RDoc::Markup::Document
|
|
73
73
|
##
|
74
74
|
# Concatenates the given +parts+ onto the document
|
75
75
|
|
76
|
-
def concat
|
76
|
+
def concat(parts)
|
77
77
|
self.parts.concat parts
|
78
78
|
end
|
79
79
|
|
80
80
|
##
|
81
81
|
# Enumerator for the parts of this document
|
82
82
|
|
83
|
-
def each
|
83
|
+
def each(&block)
|
84
84
|
@parts.each(&block)
|
85
85
|
end
|
86
86
|
|
@@ -94,7 +94,7 @@ class RDoc::Markup::Document
|
|
94
94
|
##
|
95
95
|
# The file this Document was created from.
|
96
96
|
|
97
|
-
def file=
|
97
|
+
def file=(location)
|
98
98
|
@file = case location
|
99
99
|
when RDoc::TopLevel then
|
100
100
|
location.relative_name
|
@@ -111,7 +111,7 @@ class RDoc::Markup::Document
|
|
111
111
|
#
|
112
112
|
# The information in +other+ is preferred over the receiver
|
113
113
|
|
114
|
-
def merge
|
114
|
+
def merge(other)
|
115
115
|
if empty? then
|
116
116
|
@parts = other.parts
|
117
117
|
return self
|
@@ -135,7 +135,7 @@ class RDoc::Markup::Document
|
|
135
135
|
RDoc::Markup::Document === @parts.first
|
136
136
|
end
|
137
137
|
|
138
|
-
def pretty_print
|
138
|
+
def pretty_print(q) # :nodoc:
|
139
139
|
start = @file ? "[doc (#{@file}): " : '[doc: '
|
140
140
|
|
141
141
|
q.group 2, start, ']' do
|