[前][次][番号順一覧][スレッド一覧]

ruby-changes:63005

From: aycabta <ko1@a...>
Date: Fri, 18 Sep 2020 15:03:11 +0900 (JST)
Subject: [ruby-changes:63005] b5db9b8a31 (master): [ruby/rdoc] Support full filename to make a link for a text file

https://git.ruby-lang.org/ruby.git/commit/?id=b5db9b8a31

From b5db9b8a314249adee021ba6a426c6a2ebbc6804 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Tue, 4 Aug 2020 15:46:39 +0900
Subject: [ruby/rdoc] Support full filename to make a link for a text file

https://github.com/ruby/rdoc/commit/41db49c485

diff --git a/lib/rdoc/cross_reference.rb b/lib/rdoc/cross_reference.rb
index 2785852..99a64cd 100644
--- a/lib/rdoc/cross_reference.rb
+++ b/lib/rdoc/cross_reference.rb
@@ -173,7 +173,7 @@ class RDoc::CrossReference https://github.com/ruby/ruby/blob/trunk/lib/rdoc/cross_reference.rb#L173
           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
 
diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb
index 05d8383..5ba671c 100644
--- a/lib/rdoc/store.rb
+++ b/lib/rdoc/store.rb
@@ -723,7 +723,7 @@ class RDoc::Store https://github.com/ruby/ruby/blob/trunk/lib/rdoc/store.rb#L723
 
   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
 
diff --git a/test/rdoc/test_rdoc_store.rb b/test/rdoc/test_rdoc_store.rb
index 076b8e7..82340e6 100644
--- a/test/rdoc/test_rdoc_store.rb
+++ b/test/rdoc/test_rdoc_store.rb
@@ -611,6 +611,14 @@ class TestRDocStore < XrefTestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_store.rb#L611
     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
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]