mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/rdoc] Support full filename to make a link for a text file
https://github.com/ruby/rdoc/commit/41db49c485
This commit is contained in:
parent
3b159374a2
commit
b5db9b8a31
3 changed files with 10 additions and 2 deletions
|
@ -173,7 +173,7 @@ class RDoc::CrossReference
|
|||
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
|
||||
|
||||
|
|
|
@ -723,7 +723,7 @@ class RDoc::Store
|
|||
|
||||
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
|
||||
|
||||
|
|
|
@ -611,6 +611,14 @@ class TestRDocStore < XrefTestCase
|
|||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue