Skip to content
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

Support full filename to make a link for a text file #780

Merged
Merged
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
2 changes: 1 addition & 1 deletion lib/rdoc/cross_reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def resolve name, text
end 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/store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ def modules_hash

def page name
@text_files_hash.each_value.find do |file|
file.page_name == name
file.page_name == name or file.base_name == name
end
end

Expand Down
8 changes: 8 additions & 0 deletions test/rdoc/test_rdoc_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,14 @@ def test_page
assert_equal page, @store.page('PAGE')
end

def test_page_with_extension
page = @store.add_file 'PAGE.txt', parser: RDoc::Parser::Simple

assert_nil @store.page 'no such page'

assert_equal page, @store.page('PAGE.txt')
end

def test_save
FileUtils.mkdir_p @tmpdir

Expand Down