[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.

ce77f51f63
This commit is contained in:
Stan Lo 2024-12-31 20:17:04 +08:00 committed by git
parent 63b141ef21
commit c0e2623966
4 changed files with 38 additions and 2 deletions

View file

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