Skip to content

Commit

Permalink
Support full filename to make a link for a text file
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta committed Aug 4, 2020
1 parent a4b0dd6 commit 41db49c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
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

0 comments on commit 41db49c

Please sign in to comment.