Skip to content

Commit dbcfd02

Browse files
committed
Allow rdoc-ref to link to non-text files
It appears the current behavior of disallowing links to non-text files is deliberate, as it was explicitly added in 3628e19. While the commit message explains the change, it doesn't provide a justification for excluding non-text TopLevels. The issue mentioned in the commit message is also unrelated to the change. It's just as useful to link to a non-text file as it is to link to a text file, so I think it should be allowed.
1 parent 9684f85 commit dbcfd02

File tree

5 files changed

+4
-17
lines changed

5 files changed

+4
-17
lines changed

lib/rdoc/code_object/top_level.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,6 @@ def base_name
114114

115115
alias name base_name
116116

117-
##
118-
# Only a TopLevel that contains text file) will be displayed. See also
119-
# RDoc::CodeObject#display?
120-
121-
def display?
122-
text? and super
123-
end
124-
125117
##
126118
# See RDoc::TopLevel::find_class_or_module
127119
#--

lib/rdoc/cross_reference.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def resolve(name, text)
200200
ref = resolve_method name unless ref
201201

202202
# Try a page name
203-
ref = @store.page name if not ref and name =~ /^[\w.]+$/
203+
ref = @store.page name if not ref and name =~ /^[\w.\/]+$/
204204

205205
ref = nil if RDoc::Alias === ref # external alias, can't link to it
206206

lib/rdoc/store.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ def modules_hash
723723
# Returns the RDoc::TopLevel that is a text file and has the given +name+
724724

725725
def page(name)
726-
@text_files_hash.each_value.find do |file|
726+
@files_hash.each_value.find do |file|
727727
file.page_name == name or file.base_name == name
728728
end
729729
end

test/rdoc/rdoc_cross_reference_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def test_resolve_class
115115
end
116116

117117
def test_resolve_file
118-
refute_ref 'xref_data.rb'
118+
assert_ref @top_level, 'xref_data.rb'
119119
end
120120

121121
def test_resolve_method

test/rdoc/rdoc_top_level_test.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,7 @@ def test_base_name
110110
end
111111

112112
def test_display_eh
113-
refute @top_level.display?
114-
115-
page = @store.add_file 'README.txt'
116-
page.parser = RDoc::Parser::Simple
117-
118-
assert page.display?
113+
assert @top_level.display?
119114
end
120115

121116
def test_eql_eh

0 commit comments

Comments
 (0)