diff options
| author | Stan Lo <stan001212@gmail.com> | 2024-12-31 20:17:04 +0800 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-12-31 12:17:07 +0000 |
| commit | c0e2623966ea72b2b7781a13dab47ad50c362c98 (patch) | |
| tree | b2f750c824352be431f40b687f3e511d76f308e3 /test | |
| parent | 63b141ef21497b8694e9401c934fc41c3823e3ad (diff) | |
[ruby/rdoc] Add autolink_excluded_words option to ignore
cross-references
(https://github.com/ruby/rdoc/pull/1259)
This config will be handy when the project name is the same as a class or
module name, which is often the case for most of the projects.
https://github.com/ruby/rdoc/commit/ce77f51f63
Diffstat (limited to 'test')
| -rw-r--r-- | test/rdoc/test_rdoc_markup_to_html_crossref.rb | 17 | ||||
| -rw-r--r-- | test/rdoc/test_rdoc_options.rb | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_markup_to_html_crossref.rb b/test/rdoc/test_rdoc_markup_to_html_crossref.rb index fb0aca2909..5826f3d095 100644 --- a/test/rdoc/test_rdoc_markup_to_html_crossref.rb +++ b/test/rdoc/test_rdoc_markup_to_html_crossref.rb @@ -20,6 +20,9 @@ class RDocMarkupToHtmlCrossrefTest < XrefTestCase result = @to.convert '+C1+' assert_equal para("<a href=\"C1.html\"><code>C1</code></a>"), result + result = @to.convert 'Constant[rdoc-ref:C1]' + assert_equal para("<a href=\"C1.html\">Constant</a>"), result + result = @to.convert 'FOO' assert_equal para("FOO"), result @@ -30,6 +33,20 @@ class RDocMarkupToHtmlCrossrefTest < XrefTestCase assert_equal para("<code># :stopdoc:</code>:"), result end + def test_convert_CROSSREF_ignored_excluded_words + @options.autolink_excluded_words = ['C1'] + + result = @to.convert 'C1' + assert_equal para("C1"), result + + result = @to.convert '+C1+' + assert_equal para("<a href=\"C1.html\"><code>C1</code></a>"), result + + # Explicit linking with rdoc-ref is not ignored + result = @to.convert 'Constant[rdoc-ref:C1]' + assert_equal para("<a href=\"C1.html\">Constant</a>"), result + end + def test_convert_CROSSREF_method result = @to.convert 'C1#m(foo, bar, baz)' diff --git a/test/rdoc/test_rdoc_options.rb b/test/rdoc/test_rdoc_options.rb index e658d4b314..9fc6830239 100644 --- a/test/rdoc/test_rdoc_options.rb +++ b/test/rdoc/test_rdoc_options.rb @@ -86,6 +86,7 @@ class TestRDocOptions < RDoc::TestCase 'webcvs' => nil, 'skip_tests' => true, 'apply_default_exclude' => true, + 'autolink_excluded_words' => [], } assert_equal expected, coder |
