Skip to content

Allow rdoc-ref to link to non-text files #1376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions lib/rdoc/code_object/top_level.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,6 @@ def base_name

alias name base_name

##
# Only a TopLevel that contains text file) will be displayed. See also
# RDoc::CodeObject#display?

def display?
text? and super
end

##
# See RDoc::TopLevel::find_class_or_module
#--
Expand Down
2 changes: 1 addition & 1 deletion lib/rdoc/cross_reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def resolve(name, text)
ref = resolve_method name unless ref

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

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

Expand Down
2 changes: 1 addition & 1 deletion lib/rdoc/generator/darkfish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def generate_file_files
@files.each do |file|
current = file

if file.text? and page_file.exist? then
if page_file.exist? then
generate_page file
next
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rdoc/store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ def modules_hash
# Returns the RDoc::TopLevel that is a text file and has the given +name+

def page(name)
@text_files_hash.each_value.find do |file|
@files_hash.each_value.find do |file|
file.page_name == name or file.base_name == name
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/rdoc/rdoc_cross_reference_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_resolve_class
end

def test_resolve_file
refute_ref 'xref_data.rb'
assert_ref @top_level, 'xref_data.rb'
end

def test_resolve_method
Expand Down
1 change: 1 addition & 0 deletions test/rdoc/rdoc_generator_darkfish_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def test_generate
assert_file 'Klass/Inner.html'
assert_file 'table_of_contents.html'
assert_file 'js/search_index.js'
assert_file 'file_rb.html'

assert_hard_link 'css/rdoc.css'
assert_hard_link 'css/fonts.css'
Expand Down
7 changes: 1 addition & 6 deletions test/rdoc/rdoc_top_level_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,7 @@ def test_base_name
end

def test_display_eh
refute @top_level.display?

page = @store.add_file 'README.txt'
page.parser = RDoc::Parser::Simple

assert page.display?
assert @top_level.display?
end

def test_eql_eh
Expand Down