1
0
Fork 0
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:
aycabta 2020-08-04 15:46:39 +09:00
parent 3b159374a2
commit b5db9b8a31
3 changed files with 10 additions and 2 deletions

View file

@ -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

View file

@ -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

View file

@ -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