summaryrefslogtreecommitdiff
path: root/lib/rdoc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc')
-rw-r--r--lib/rdoc/markup/to_html_crossref.rb2
-rw-r--r--lib/rdoc/options.rb20
2 files changed, 20 insertions, 2 deletions
diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb
index e6661b621e..06fee91a11 100644
--- a/lib/rdoc/markup/to_html_crossref.rb
+++ b/lib/rdoc/markup/to_html_crossref.rb
@@ -83,6 +83,8 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
def handle_regexp_CROSSREF(target)
name = target.text
+ return name if @options.autolink_excluded_words&.include?(name)
+
return name if name =~ /@[\w-]+\.[\w-]/ # labels that look like emails
unless @hyperlink_all then
diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb
index 5e2d320c73..d6c8db2c28 100644
--- a/lib/rdoc/options.rb
+++ b/lib/rdoc/options.rb
@@ -359,6 +359,10 @@ class RDoc::Options
# Exclude the default patterns as well if true.
attr_reader :apply_default_exclude
+ ##
+ # Words to be ignored in autolink cross-references
+ attr_accessor :autolink_excluded_words
+
def initialize loaded_options = nil # :nodoc:
init_ivars
override loaded_options if loaded_options
@@ -370,6 +374,7 @@ class RDoc::Options
]
def init_ivars # :nodoc:
+ @autolink_excluded_words = []
@dry_run = false
@embed_mixins = false
@exclude = []
@@ -437,7 +442,9 @@ class RDoc::Options
@title = map['title']
@visibility = map['visibility']
@webcvs = map['webcvs']
- @apply_default_exclude = map['apply_default_exclude']
+
+ @apply_default_exclude = map['apply_default_exclude']
+ @autolink_excluded_words = map['autolink_excluded_words']
@rdoc_include = sanitize_path map['rdoc_include']
@static_path = sanitize_path map['static_path']
@@ -471,6 +478,7 @@ class RDoc::Options
@title = map['title'] if map.has_key?('title')
@visibility = map['visibility'] if map.has_key?('visibility')
@webcvs = map['webcvs'] if map.has_key?('webcvs')
+ @autolink_excluded_words = map['autolink_excluded_words'] if map.has_key?('autolink_excluded_words')
@apply_default_exclude = map['apply_default_exclude'] if map.has_key?('apply_default_exclude')
@warn_missing_rdoc_ref = map['warn_missing_rdoc_ref'] if map.has_key?('warn_missing_rdoc_ref')
@@ -503,7 +511,8 @@ class RDoc::Options
@title == other.title and
@visibility == other.visibility and
@webcvs == other.webcvs and
- @apply_default_exclude == other.apply_default_exclude
+ @apply_default_exclude == other.apply_default_exclude and
+ @autolink_excluded_words == other.autolink_excluded_words
end
##
@@ -989,6 +998,13 @@ Usage: #{opt.program_name} [options] [names...]
opt.separator nil
+ opt.on("--autolink-excluded-words=WORDS", Array,
+ "Words to be ignored in autolink cross-references") do |value|
+ @autolink_excluded_words.concat value
+ end
+
+ opt.separator nil
+
opt.on("--hyperlink-all", "-A",
"Generate hyperlinks for all words that",
"correspond to known methods, even if they",