diff --git a/lib/rdoc/cross_reference.rb b/lib/rdoc/cross_reference.rb
index 3f5f33ba42..7b137483d5 100644
--- a/lib/rdoc/cross_reference.rb
+++ b/lib/rdoc/cross_reference.rb
@@ -23,8 +23,8 @@ class RDoc::CrossReference
##
# Regular expressions matching text that should potentially have
- # cross-reference links generated are passed to add_special. Note that
- # these expressions are meant to pick up text for which cross-references
+ # cross-reference links generated are passed to add_regexp_handling. Note
+ # that these expressions are meant to pick up text for which cross-references
# have been suppressed, since the suppression characters are removed by the
# code that is triggered.
diff --git a/lib/rdoc/markup.rb b/lib/rdoc/markup.rb
index 08ecc6f7df..f20ee1169e 100644
--- a/lib/rdoc/markup.rb
+++ b/lib/rdoc/markup.rb
@@ -65,17 +65,16 @@
# puts h.convert(input_string)
#
# You can extend the RDoc::Markup parser to recognize new markup
-# sequences, and to add special processing for text that matches a
-# regular expression. Here we make WikiWords significant to the parser,
-# and also make the sequences {word} and \text... signify
+# sequences, and to add regexp handling. Here we make WikiWords significant to
+# the parser, and also make the sequences {word} and \text... signify
# strike-through text. We then subclass the HTML output class to deal
# with these:
#
# require 'rdoc'
#
# class WikiHtml < RDoc::Markup::ToHtml
-# def handle_special_WIKIWORD(special)
-# "" + special.text + ""
+# def handle_regexp_WIKIWORD(target)
+# "" + target.text + ""
# end
# end
#
@@ -83,7 +82,7 @@
# markup.add_word_pair("{", "}", :STRIKE)
# markup.add_html("no", :STRIKE)
#
-# markup.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
+# markup.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
#
# wh = WikiHtml.new RDoc::Options.new, markup
# wh.add_tag(:STRIKE, "", "")
@@ -800,13 +799,12 @@ def add_html(tag, name)
# Add to other inline sequences. For example, we could add WikiWords using
# something like:
#
- # parser.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
+ # parser.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
#
- # Each wiki word will be presented to the output formatter via the
- # accept_special method.
+ # Each wiki word will be presented to the output formatter.
- def add_special(pattern, name)
- @attribute_manager.add_special(pattern, name)
+ def add_regexp_handling(pattern, name)
+ @attribute_manager.add_regexp_handling(pattern, name)
end
##
@@ -832,7 +830,7 @@ def convert input, formatter
autoload :AttrSpan, 'rdoc/markup/attr_span'
autoload :Attributes, 'rdoc/markup/attributes'
autoload :AttributeManager, 'rdoc/markup/attribute_manager'
- autoload :Special, 'rdoc/markup/special'
+ autoload :RegexpHandling, 'rdoc/markup/regexp_handling'
# RDoc::Markup AST
autoload :BlankLine, 'rdoc/markup/blank_line'
diff --git a/lib/rdoc/markup/attribute_manager.rb b/lib/rdoc/markup/attribute_manager.rb
index a10f731615..f052bc8b01 100644
--- a/lib/rdoc/markup/attribute_manager.rb
+++ b/lib/rdoc/markup/attribute_manager.rb
@@ -53,10 +53,10 @@ class RDoc::Markup::AttributeManager
attr_reader :protectable
##
- # And this maps _special_ sequences to a name. A special sequence is
- # something like a WikiWord
+ # And this maps _regexp handling_ sequences to a name. A regexp handling
+ # sequence is something like a WikiWord
- attr_reader :special
+ attr_reader :regexp_handlings
##
# Creates a new attribute manager that understands bold, emphasized and
@@ -66,7 +66,7 @@ def initialize
@html_tags = {}
@matching_word_pairs = {}
@protectable = %w[<]
- @special = []
+ @regexp_handlings = []
@word_pair_map = {}
@attributes = RDoc::Markup::Attributes.new
@@ -166,22 +166,22 @@ def convert_html(str, attrs)
end
##
- # Converts special sequences to RDoc attributes
+ # Converts regexp handling sequences to RDoc attributes
- def convert_specials str, attrs
- @special.each do |regexp, attribute|
+ def convert_regexp_handlings str, attrs
+ @regexp_handlings.each do |regexp, attribute|
str.scan(regexp) do
capture = $~.size == 1 ? 0 : 1
s, e = $~.offset capture
- attrs.set_attrs s, e - s, attribute | @attributes.special
+ attrs.set_attrs s, e - s, attribute | @attributes.regexp_handling
end
end
end
##
- # Escapes special sequences of text to prevent conversion to RDoc
+ # Escapes regexp handling sequences of text to prevent conversion to RDoc
def mask_protected_sequences
# protect __send__, __FILE__, etc.
@@ -193,7 +193,7 @@ def mask_protected_sequences
end
##
- # Unescapes special sequences of text
+ # Unescapes regexp handling sequences of text
def unmask_protected_sequences
@str.gsub!(/(.)#{PROTECT_ATTR}/, "\\1\000")
@@ -233,17 +233,17 @@ def add_html(tag, name)
end
##
- # Adds a special handler for +pattern+ with +name+. A simple URL handler
+ # Adds a regexp handling for +pattern+ with +name+. A simple URL handler
# would be:
#
- # @am.add_special(/((https?:)\S+\w)/, :HYPERLINK)
+ # @am.add_regexp_handling(/((https?:)\S+\w)/, :HYPERLINK)
- def add_special pattern, name
- @special << [pattern, @attributes.bitmap_for(name)]
+ def add_regexp_handling pattern, name
+ @regexp_handlings << [pattern, @attributes.bitmap_for(name)]
end
##
- # Processes +str+ converting attributes, HTML and specials
+ # Processes +str+ converting attributes, HTML and regexp handlings
def flow str
@str = str.dup
@@ -252,9 +252,9 @@ def flow str
@attrs = RDoc::Markup::AttrSpan.new @str.length
- convert_attrs @str, @attrs
- convert_html @str, @attrs
- convert_specials @str, @attrs
+ convert_attrs @str, @attrs
+ convert_html @str, @attrs
+ convert_regexp_handlings @str, @attrs
unmask_protected_sequences
@@ -312,12 +312,12 @@ def split_into_flow
res << change_attribute(current_attr, new_attr)
current_attr = new_attr
- if (current_attr & @attributes.special) != 0 then
+ if (current_attr & @attributes.regexp_handling) != 0 then
i += 1 while
- i < str_len and (@attrs[i] & @attributes.special) != 0
+ i < str_len and (@attrs[i] & @attributes.regexp_handling) != 0
- res << RDoc::Markup::Special.new(current_attr,
- copy_string(start_pos, i))
+ res << RDoc::Markup::RegexpHandling.new(current_attr,
+ copy_string(start_pos, i))
start_pos = i
next
end
diff --git a/lib/rdoc/markup/attributes.rb b/lib/rdoc/markup/attributes.rb
index ec30160d3d..ce014ce928 100644
--- a/lib/rdoc/markup/attributes.rb
+++ b/lib/rdoc/markup/attributes.rb
@@ -6,21 +6,21 @@
class RDoc::Markup::Attributes
##
- # The special attribute type. See RDoc::Markup#add_special
+ # The regexp handling attribute type. See RDoc::Markup#add_regexp_handling
- attr_reader :special
+ attr_reader :regexp_handling
##
# Creates a new attributes set.
def initialize
- @special = 1
+ @regexp_handling = 1
@name_to_bitmap = [
- [:_SPECIAL_, @special],
+ [:_REGEXP_HANDLING_, @regexp_handling],
]
- @next_bitmap = @special << 1
+ @next_bitmap = @regexp_handling << 1
end
##
@@ -61,7 +61,7 @@ def each_name_of bitmap
return enum_for __method__, bitmap unless block_given?
@name_to_bitmap.each do |name, bit|
- next if bit == @special
+ next if bit == @regexp_handling
yield name.to_s if (bitmap & bit) != 0
end
diff --git a/lib/rdoc/markup/formatter.rb b/lib/rdoc/markup/formatter.rb
index 5dc71d2242..6dff96c7d0 100644
--- a/lib/rdoc/markup/formatter.rb
+++ b/lib/rdoc/markup/formatter.rb
@@ -50,7 +50,7 @@ def initialize options, markup = nil
@markup = markup || RDoc::Markup.new
@am = @markup.attribute_manager
- @am.add_special(/
/, :HARD_BREAK)
+ @am.add_regexp_handling(/
/, :HARD_BREAK)
@attributes = @am.attributes
@@ -78,23 +78,24 @@ def accept_document document
end
##
- # Adds a special for links of the form rdoc-...:
+ # Adds a regexp handling for links of the form rdoc-...:
- def add_special_RDOCLINK
- @markup.add_special(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK)
+ def add_regexp_handling_RDOCLINK
+ @markup.add_regexp_handling(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK)
end
##
- # Adds a special for links of the form {}[] and []
+ # Adds a regexp handling for links of the form {}[] and
+ # []
- def add_special_TIDYLINK
- @markup.add_special(/(?:
- \{.*?\} | # multi-word label
- \b[^\s{}]+? # single-word label
- )
+ def add_regexp_handling_TIDYLINK
+ @markup.add_regexp_handling(/(?:
+ \{.*?\} | # multi-word label
+ \b[^\s{}]+? # single-word label
+ )
- \[\S+?\] # link target
- /x, :TIDYLINK)
+ \[\S+?\] # link target
+ /x, :TIDYLINK)
end
##
@@ -133,8 +134,8 @@ def convert_flow(flow)
when RDoc::Markup::AttrChanger then
off_tags res, item
on_tags res, item
- when RDoc::Markup::Special then
- res << convert_special(item)
+ when RDoc::Markup::RegexpHandling then
+ res << convert_regexp_handling(item)
else
raise "Unknown flow element: #{item.inspect}"
end
@@ -144,29 +145,29 @@ def convert_flow(flow)
end
##
- # Converts added specials. See RDoc::Markup#add_special
+ # Converts added regexp handlings. See RDoc::Markup#add_regexp_handling
- def convert_special special
- return special.text if in_tt?
+ def convert_regexp_handling target
+ return target.text if in_tt?
handled = false
- @attributes.each_name_of special.type do |name|
- method_name = "handle_special_#{name}"
+ @attributes.each_name_of target.type do |name|
+ method_name = "handle_regexp_#{name}"
if respond_to? method_name then
- special.text = send method_name, special
+ target.text = send method_name, target
handled = true
end
end
unless handled then
- special_name = @attributes.as_string special.type
+ target_name = @attributes.as_string target.type
- raise RDoc::Error, "Unhandled special #{special_name}: #{special}"
+ raise RDoc::Error, "Unhandled regexp handling #{target_name}: #{target}"
end
- special.text
+ target.text
end
##
diff --git a/lib/rdoc/markup/heading.rb b/lib/rdoc/markup/heading.rb
index 233774c5c4..93a3a52000 100644
--- a/lib/rdoc/markup/heading.rb
+++ b/lib/rdoc/markup/heading.rb
@@ -23,12 +23,12 @@ def self.to_html
return @to_html if @to_html
markup = RDoc::Markup.new
- markup.add_special RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
+ markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
@to_html = RDoc::Markup::ToHtml.new nil
- def @to_html.handle_special_CROSSREF special
- special.text.sub(/^\\/, '')
+ def @to_html.handle_regexp_CROSSREF target
+ target.text.sub(/^\\/, '')
end
@to_html
diff --git a/lib/rdoc/markup/regexp_handling.rb b/lib/rdoc/markup/regexp_handling.rb
new file mode 100644
index 0000000000..6ed868c2c1
--- /dev/null
+++ b/lib/rdoc/markup/regexp_handling.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+##
+# Hold details of a regexp handling sequence
+
+class RDoc::Markup::RegexpHandling
+
+ ##
+ # Regexp handling type
+
+ attr_reader :type
+
+ ##
+ # Regexp handling text
+
+ attr_accessor :text
+
+ ##
+ # Creates a new regexp handling sequence of +type+ with +text+
+
+ def initialize(type, text)
+ @type, @text = type, text
+ end
+
+ ##
+ # Regexp handlings are equal when the have the same text and type
+
+ def ==(o)
+ self.text == o.text && self.type == o.type
+ end
+
+ def inspect # :nodoc:
+ "#" % [
+ object_id, @type, text.dump]
+ end
+
+ def to_s # :nodoc:
+ "RegexpHandling: type=#{type} text=#{text.dump}"
+ end
+
+end
+
diff --git a/lib/rdoc/markup/special.rb b/lib/rdoc/markup/special.rb
deleted file mode 100644
index 57261b44a7..0000000000
--- a/lib/rdoc/markup/special.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-# frozen_string_literal: true
-##
-# Hold details of a special sequence
-
-class RDoc::Markup::Special
-
- ##
- # Special type
-
- attr_reader :type
-
- ##
- # Special text
-
- attr_accessor :text
-
- ##
- # Creates a new special sequence of +type+ with +text+
-
- def initialize(type, text)
- @type, @text = type, text
- end
-
- ##
- # Specials are equal when the have the same text and type
-
- def ==(o)
- self.text == o.text && self.type == o.type
- end
-
- def inspect # :nodoc:
- "#" % [
- object_id, @type, text.dump]
- end
-
- def to_s # :nodoc:
- "Special: type=#{type} text=#{text.dump}"
- end
-
-end
-
diff --git a/lib/rdoc/markup/to_bs.rb b/lib/rdoc/markup/to_bs.rb
index fea017e89d..f9b86487db 100644
--- a/lib/rdoc/markup/to_bs.rb
+++ b/lib/rdoc/markup/to_bs.rb
@@ -41,7 +41,7 @@ def accept_heading heading
end
##
- # Turns on or off special handling for +convert_string+
+ # Turns on or off regexp handling for +convert_string+
def annotate tag
case tag
@@ -54,9 +54,9 @@ def annotate tag
end
##
- # Calls convert_string on the result of convert_special
+ # Calls convert_string on the result of convert_regexp_handling
- def convert_special special
+ def convert_regexp_handling target
convert_string super
end
diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb
index 63cca98de7..9ae0fff8a7 100644
--- a/lib/rdoc/markup/to_html.rb
+++ b/lib/rdoc/markup/to_html.rb
@@ -53,18 +53,18 @@ def initialize options, markup = nil
@hard_break = "
\n"
# external links
- @markup.add_special(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/,
- :HYPERLINK)
+ @markup.add_regexp_handling(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/,
+ :HYPERLINK)
- add_special_RDOCLINK
- add_special_TIDYLINK
+ add_regexp_handling_RDOCLINK
+ add_regexp_handling_TIDYLINK
init_tags
end
- # :section: Special Handling
+ # :section: Regexp Handling
#
- # These methods handle special markup added by RDoc::Markup#add_special.
+ # These methods are used by regexp handling markup added by RDoc::Markup#add_regexp_handling.
def handle_RDOCLINK url # :nodoc:
case url
@@ -91,14 +91,14 @@ def handle_RDOCLINK url # :nodoc:
end
##
- # +special+ is a
+ # +target+ is a
- def handle_special_HARD_BREAK special
+ def handle_regexp_HARD_BREAK target
'
'
end
##
- # +special+ is a potential link. The following schemes are handled:
+ # +target+ is a potential link. The following schemes are handled:
#
# mailto:::
# Inserted as-is.
@@ -109,14 +109,14 @@ def handle_special_HARD_BREAK special
# link:::
# Reference to a local file relative to the output directory.
- def handle_special_HYPERLINK(special)
- url = special.text
+ def handle_regexp_HYPERLINK(target)
+ url = target.text
gen_url url, url
end
##
- # +special+ is an rdoc-schemed link that will be converted into a hyperlink.
+ # +target+ is an rdoc-schemed link that will be converted into a hyperlink.
#
# For the +rdoc-ref+ scheme the named reference will be returned without
# creating a link.
@@ -124,16 +124,16 @@ def handle_special_HYPERLINK(special)
# For the +rdoc-label+ scheme the footnote and label prefixes are stripped
# when creating a link. All other contents will be linked verbatim.
- def handle_special_RDOCLINK special
- handle_RDOCLINK special.text
+ def handle_regexp_RDOCLINK target
+ handle_RDOCLINK target.text
end
##
- # This +special+ is a link where the label is different from the URL
+ # This +target+ is a link where the label is different from the URL
# label[url] or {long label}[url]
- def handle_special_TIDYLINK(special)
- text = special.text
+ def handle_regexp_TIDYLINK(target)
+ text = target.text
return text unless
text =~ /^\{(.*)\}\[(.*?)\]$/ or text =~ /^(\S+)\[(.*?)\]$/
@@ -312,7 +312,7 @@ def convert_string(text)
##
# Generate a link to +url+ with content +text+. Handles the special cases
- # for img: and link: described under handle_special_HYPERLINK
+ # for img: and link: described under handle_regexp_HYPERLINK
def gen_url url, text
scheme, url, id = parse_url url
diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb
index cc93021540..404e2ccfd5 100644
--- a/lib/rdoc/markup/to_html_crossref.rb
+++ b/lib/rdoc/markup/to_html_crossref.rb
@@ -40,7 +40,7 @@ def initialize(options, from_path, context, markup = nil)
@show_hash = @options.show_hash
crossref_re = @hyperlink_all ? ALL_CROSSREF_REGEXP : CROSSREF_REGEXP
- @markup.add_special crossref_re, :CROSSREF
+ @markup.add_regexp_handling crossref_re, :CROSSREF
@cross_reference = RDoc::CrossReference.new @context
end
@@ -68,8 +68,8 @@ def cross_reference name, text = nil
# example, ToHtml is found, even without the RDoc::Markup:: prefix,
# because we look for it in module Markup first.
- def handle_special_CROSSREF(special)
- name = special.text
+ def handle_regexp_CROSSREF(target)
+ name = target.text
return name if name =~ /@[\w-]+\.[\w-]/ # labels that look like emails
@@ -87,22 +87,22 @@ def handle_special_CROSSREF(special)
# Handles rdoc-ref: scheme links and allows RDoc::Markup::ToHtml to
# handle other schemes.
- def handle_special_HYPERLINK special
- return cross_reference $' if special.text =~ /\Ardoc-ref:/
+ def handle_regexp_HYPERLINK target
+ return cross_reference $' if target.text =~ /\Ardoc-ref:/
super
end
##
- # +special+ is an rdoc-schemed link that will be converted into a hyperlink.
+ # +target+ is an rdoc-schemed link that will be converted into a hyperlink.
# For the rdoc-ref scheme the cross-reference will be looked up and the
# given name will be used.
#
# All other contents are handled by
- # {the superclass}[rdoc-ref:RDoc::Markup::ToHtml#handle_special_RDOCLINK]
+ # {the superclass}[rdoc-ref:RDoc::Markup::ToHtml#handle_regexp_RDOCLINK]
- def handle_special_RDOCLINK special
- url = special.text
+ def handle_regexp_RDOCLINK target
+ url = target.text
case url
when /\Ardoc-ref:/ then
diff --git a/lib/rdoc/markup/to_html_snippet.rb b/lib/rdoc/markup/to_html_snippet.rb
index 0cb4ffe4a4..4eb36592b7 100644
--- a/lib/rdoc/markup/to_html_snippet.rb
+++ b/lib/rdoc/markup/to_html_snippet.rb
@@ -44,7 +44,7 @@ def initialize options, characters = 100, paragraphs = 3, markup = nil
@mask = 0
@paragraphs = 0
- @markup.add_special RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
+ @markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
end
##
@@ -123,16 +123,16 @@ def start_accepting
end
##
- # Removes escaping from the cross-references in +special+
+ # Removes escaping from the cross-references in +target+
- def handle_special_CROSSREF special
- special.text.sub(/\A\\/, '')
+ def handle_regexp_CROSSREF target
+ target.text.sub(/\A\\/, '')
end
##
- # +special+ is a
+ # +target+ is a
- def handle_special_HARD_BREAK special
+ def handle_regexp_HARD_BREAK target
@characters -= 4
'
'
end
@@ -226,8 +226,8 @@ def convert_flow flow
when String then
text = convert_string item
res << truncate(text)
- when RDoc::Markup::Special then
- text = convert_special item
+ when RDoc::Markup::RegexpHandling then
+ text = convert_regexp_handling item
res << truncate(text)
else
raise "Unknown flow element: #{item.inspect}"
diff --git a/lib/rdoc/markup/to_label.rb b/lib/rdoc/markup/to_label.rb
index 9f179013f2..3d95ccc2e2 100644
--- a/lib/rdoc/markup/to_label.rb
+++ b/lib/rdoc/markup/to_label.rb
@@ -16,8 +16,8 @@ class RDoc::Markup::ToLabel < RDoc::Markup::Formatter
def initialize markup = nil
super nil, markup
- @markup.add_special RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
- @markup.add_special(/(((\{.*?\})|\b\S+?)\[\S+?\])/, :TIDYLINK)
+ @markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
+ @markup.add_regexp_handling(/(((\{.*?\})|\b\S+?)\[\S+?\])/, :TIDYLINK)
add_tag :BOLD, '', ''
add_tag :TT, '', ''
@@ -36,20 +36,20 @@ def convert text
end
##
- # Converts the CROSSREF +special+ to plain text, removing the suppression
+ # Converts the CROSSREF +target+ to plain text, removing the suppression
# marker, if any
- def handle_special_CROSSREF special
- text = special.text
+ def handle_regexp_CROSSREF target
+ text = target.text
text.sub(/^\\/, '')
end
##
- # Converts the TIDYLINK +special+ to just the text part
+ # Converts the TIDYLINK +target+ to just the text part
- def handle_special_TIDYLINK special
- text = special.text
+ def handle_regexp_TIDYLINK target
+ text = target.text
return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
@@ -68,7 +68,7 @@ def handle_special_TIDYLINK special
alias accept_rule ignore
alias accept_verbatim ignore
alias end_accepting ignore
- alias handle_special_HARD_BREAK ignore
+ alias handle_regexp_HARD_BREAK ignore
alias start_accepting ignore
end
diff --git a/lib/rdoc/markup/to_markdown.rb b/lib/rdoc/markup/to_markdown.rb
index d471032f9f..7932815405 100644
--- a/lib/rdoc/markup/to_markdown.rb
+++ b/lib/rdoc/markup/to_markdown.rb
@@ -19,8 +19,8 @@ def initialize markup = nil
@headings[5] = ['##### ', '']
@headings[6] = ['###### ', '']
- add_special_RDOCLINK
- add_special_TIDYLINK
+ add_regexp_handling_RDOCLINK
+ add_regexp_handling_TIDYLINK
@hard_break = " \n"
end
@@ -37,7 +37,7 @@ def init_tags
##
# Adds a newline to the output
- def handle_special_HARD_BREAK special
+ def handle_regexp_HARD_BREAK target
" \n"
end
@@ -166,8 +166,8 @@ def handle_rdoc_link url
##
# Converts the RDoc markup tidylink into a Markdown.style link.
- def handle_special_TIDYLINK special
- text = special.text
+ def handle_regexp_TIDYLINK target
+ text = target.text
return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
@@ -184,8 +184,8 @@ def handle_special_TIDYLINK special
##
# Converts the rdoc-...: links into a Markdown.style links.
- def handle_special_RDOCLINK special
- handle_rdoc_link special.text
+ def handle_regexp_RDOCLINK target
+ handle_rdoc_link target.text
end
end
diff --git a/lib/rdoc/markup/to_rdoc.rb b/lib/rdoc/markup/to_rdoc.rb
index 1cb4d6bab2..3aee85afbe 100644
--- a/lib/rdoc/markup/to_rdoc.rb
+++ b/lib/rdoc/markup/to_rdoc.rb
@@ -45,7 +45,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
def initialize markup = nil
super nil, markup
- @markup.add_special(/\\\S/, :SUPPRESSED_CROSSREF)
+ @markup.add_regexp_handling(/\\\S/, :SUPPRESSED_CROSSREF)
@width = 78
init_tags
@@ -253,10 +253,10 @@ def end_accepting
end
##
- # Removes preceding \\ from the suppressed crossref +special+
+ # Removes preceding \\ from the suppressed crossref +target+
- def handle_special_SUPPRESSED_CROSSREF special
- text = special.text
+ def handle_regexp_SUPPRESSED_CROSSREF target
+ text = target.text
text = text.sub('\\', '') unless in_tt?
text
end
@@ -264,7 +264,7 @@ def handle_special_SUPPRESSED_CROSSREF special
##
# Adds a newline to the output
- def handle_special_HARD_BREAK special
+ def handle_regexp_HARD_BREAK target
"\n"
end
diff --git a/lib/rdoc/markup/to_tt_only.rb b/lib/rdoc/markup/to_tt_only.rb
index 4f43546e3d..9235d33f04 100644
--- a/lib/rdoc/markup/to_tt_only.rb
+++ b/lib/rdoc/markup/to_tt_only.rb
@@ -91,8 +91,8 @@ def tt_sections text
when RDoc::Markup::AttrChanger then
off_tags res, item
on_tags res, item
- when RDoc::Markup::Special then
- @res << convert_special(item) if in_tt? # TODO can this happen?
+ when RDoc::Markup::RegexpHandling then
+ @res << convert_regexp_handling(item) if in_tt? # TODO can this happen?
else
raise "Unknown flow element: #{item.inspect}"
end
diff --git a/test/test_rdoc_markup_attribute_manager.rb b/test/test_rdoc_markup_attribute_manager.rb
index 93338ecb50..d6eccdf76f 100644
--- a/test/test_rdoc_markup_attribute_manager.rb
+++ b/test/test_rdoc_markup_attribute_manager.rb
@@ -36,12 +36,12 @@ def setup
end
def crossref(text)
- crossref_bitmap = @am.attributes.bitmap_for(:_SPECIAL_) |
+ crossref_bitmap = @am.attributes.bitmap_for(:_REGEXP_HANDLING_) |
@am.attributes.bitmap_for(:CROSSREF)
- [ @am.changed_attribute_by_name([], [:CROSSREF, :_SPECIAL_]),
- RDoc::Markup::Special.new(crossref_bitmap, text),
- @am.changed_attribute_by_name([:CROSSREF, :_SPECIAL_], [])
+ [ @am.changed_attribute_by_name([], [:CROSSREF, :_REGEXP_HANDLING_]),
+ RDoc::Markup::RegexpHandling.new(crossref_bitmap, text),
+ @am.changed_attribute_by_name([:CROSSREF, :_REGEXP_HANDLING_], [])
]
end
@@ -58,12 +58,12 @@ def test_add_html_tag
assert(tags.has_key?("test"))
end
- def test_add_special
- @am.add_special "WikiWord", :WIKIWORD
- specials = @am.special
+ def test_add_regexp_handling
+ @am.add_regexp_handling "WikiWord", :WIKIWORD
+ regexp_handlings = @am.regexp_handlings
- assert_equal 1, specials.size
- assert specials.assoc "WikiWord"
+ assert_equal 1, regexp_handlings.size
+ assert regexp_handlings.assoc "WikiWord"
end
def test_add_word_pair
@@ -340,8 +340,8 @@ def test_lost_tag_for_the_second_time
@am.flow(str))
end
- def test_special
- @am.add_special(RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF)
+ def test_regexp_handling
+ @am.add_regexp_handling(RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF)
#
# The apostrophes in "cats'" and "dogs'" suppress the flagging of these
diff --git a/test/test_rdoc_markup_attributes.rb b/test/test_rdoc_markup_attributes.rb
index 91c253a6b0..e592fa7145 100644
--- a/test/test_rdoc_markup_attributes.rb
+++ b/test/test_rdoc_markup_attributes.rb
@@ -19,10 +19,10 @@ def test_as_string
@as.bitmap_for 'two'
@as.bitmap_for 'three'
- assert_equal 'none', @as.as_string(0)
- assert_equal '_SPECIAL_', @as.as_string(1)
- assert_equal 'two', @as.as_string(2)
- assert_equal '_SPECIAL_,two', @as.as_string(3)
+ assert_equal 'none', @as.as_string(0)
+ assert_equal '_REGEXP_HANDLING_', @as.as_string(1)
+ assert_equal 'two', @as.as_string(2)
+ assert_equal '_REGEXP_HANDLING_,two', @as.as_string(3)
end
def test_each_name_of
diff --git a/test/test_rdoc_markup_formatter.rb b/test/test_rdoc_markup_formatter.rb
index b1f0855de3..cdc5944cdf 100644
--- a/test/test_rdoc_markup_formatter.rb
+++ b/test/test_rdoc_markup_formatter.rb
@@ -19,8 +19,8 @@ def attributes text
convert_flow @am.flow text.dup
end
- def handle_special_CAPS special
- "handled #{special.text}"
+ def handle_regexp_CAPS target
+ "handled #{target.text}"
end
def start_accepting
@@ -37,16 +37,16 @@ def setup
super
@markup = @RM.new
- @markup.add_special(/[A-Z]+/, :CAPS)
+ @markup.add_regexp_handling(/[A-Z]+/, :CAPS)
@attribute_manager = @markup.attribute_manager
@attributes = @attribute_manager.attributes
@to = ToTest.new @markup
- @caps = @attributes.bitmap_for :CAPS
- @special = @attributes.bitmap_for :_SPECIAL_
- @tt = @attributes.bitmap_for :TT
+ @caps = @attributes.bitmap_for :CAPS
+ @regexp_handling = @attributes.bitmap_for :_REGEXP_HANDLING_
+ @tt = @attributes.bitmap_for :TT
end
def test_class_gen_relative_url
@@ -62,19 +62,19 @@ def gen(from, to)
assert_equal 'a/c.html', gen('a.html', 'a/c.html')
end
- def special_names
- @attribute_manager.special.map do |_, mask|
+ def regexp_handling_names
+ @attribute_manager.regexp_handlings.map do |_, mask|
@attributes.as_string mask
end
end
- def test_add_special_RDOCLINK
- @to.add_special_RDOCLINK
+ def test_add_regexp_handling_RDOCLINK
+ @to.add_regexp_handling_RDOCLINK
- assert_includes special_names, 'RDOCLINK'
+ assert_includes regexp_handling_names, 'RDOCLINK'
- def @to.handle_special_RDOCLINK special
- "<#{special.text}>"
+ def @to.handle_regexp_RDOCLINK target
+ "<#{target.text}>"
end
document = doc(para('{foo}[rdoc-label:bar].'))
@@ -84,13 +84,13 @@ def @to.handle_special_RDOCLINK special
assert_equal '{foo}[].', formatted
end
- def test_add_special_TIDYLINK
- @to.add_special_TIDYLINK
+ def test_add_regexp_handling_TIDYLINK
+ @to.add_regexp_handling_TIDYLINK
- assert_includes special_names, 'TIDYLINK'
+ assert_includes regexp_handling_names, 'TIDYLINK'
- def @to.handle_special_TIDYLINK special
- "<#{special.text}>"
+ def @to.handle_regexp_TIDYLINK target
+ "<#{target.text}>"
end
document = doc(para('foo[rdoc-label:bar].'))
@@ -166,7 +166,7 @@ def test_parse_url_scheme
assert_nil id
end
- def test_convert_tt_special
+ def test_convert_tt_regexp_handling
converted = @to.convert 'AAA
'
assert_equal 'AAA
', converted
diff --git a/test/test_rdoc_markup_to_html.rb b/test/test_rdoc_markup_to_html.rb
index 421c5edbc3..c30c89a7e3 100644
--- a/test/test_rdoc_markup_to_html.rb
+++ b/test/test_rdoc_markup_to_html.rb
@@ -727,18 +727,18 @@ def test_gen_url_ssl_image_url
assert_equal '', @to.gen_url('https://example.com/image.png', 'ignored')
end
- def test_handle_special_HYPERLINK_link
- special = RDoc::Markup::Special.new 0, 'link:README.txt'
+ def test_handle_regexp_HYPERLINK_link
+ target = RDoc::Markup::RegexpHandling.new 0, 'link:README.txt'
- link = @to.handle_special_HYPERLINK special
+ link = @to.handle_regexp_HYPERLINK target
assert_equal 'README.txt', link
end
- def test_handle_special_HYPERLINK_irc
- special = RDoc::Markup::Special.new 0, 'irc://irc.freenode.net/#ruby-lang'
+ def test_handle_regexp_HYPERLINK_irc
+ target = RDoc::Markup::RegexpHandling.new 0, 'irc://irc.freenode.net/#ruby-lang'
- link = @to.handle_special_HYPERLINK special
+ link = @to.handle_regexp_HYPERLINK target
assert_equal 'irc.freenode.net/#ruby-lang', link
end
diff --git a/test/test_rdoc_markup_to_html_crossref.rb b/test/test_rdoc_markup_to_html_crossref.rb
index 63fc95ff51..19cc6a8ec1 100644
--- a/test/test_rdoc_markup_to_html_crossref.rb
+++ b/test/test_rdoc_markup_to_html_crossref.rb
@@ -116,66 +116,66 @@ def test_gen_url
@to.gen_url('http://example', 'HTTP example')
end
- def test_handle_special_CROSSREF
- assert_equal "C2::C3", SPECIAL('C2::C3')
+ def test_handle_regexp_CROSSREF
+ assert_equal "C2::C3", REGEXP_HANDLING('C2::C3')
end
- def test_handle_special_CROSSREF_label
+ def test_handle_regexp_CROSSREF_label
assert_equal "foo at C1#m",
- SPECIAL('C1#m@foo')
+ REGEXP_HANDLING('C1#m@foo')
end
- def test_handle_special_CROSSREF_show_hash_false
+ def test_handle_regexp_CROSSREF_show_hash_false
@to.show_hash = false
assert_equal "m",
- SPECIAL('#m')
+ REGEXP_HANDLING('#m')
end
- def test_handle_special_HYPERLINK_rdoc
+ def test_handle_regexp_HYPERLINK_rdoc
readme = @store.add_file 'README.txt'
readme.parser = RDoc::Parser::Simple
@to = RDoc::Markup::ToHtmlCrossref.new @options, 'C2.html', @c2
- link = @to.handle_special_HYPERLINK hyper 'C2::C3'
+ link = @to.handle_regexp_HYPERLINK hyper 'C2::C3'
assert_equal 'C2::C3', link
- link = @to.handle_special_HYPERLINK hyper 'C4'
+ link = @to.handle_regexp_HYPERLINK hyper 'C4'
assert_equal 'C4', link
- link = @to.handle_special_HYPERLINK hyper 'README.txt'
+ link = @to.handle_regexp_HYPERLINK hyper 'README.txt'
assert_equal 'README.txt', link
end
- def test_handle_special_TIDYLINK_rdoc
+ def test_handle_regexp_TIDYLINK_rdoc
readme = @store.add_file 'README.txt'
readme.parser = RDoc::Parser::Simple
@to = RDoc::Markup::ToHtmlCrossref.new @options, 'C2.html', @c2
- link = @to.handle_special_TIDYLINK tidy 'C2::C3'
+ link = @to.handle_regexp_TIDYLINK tidy 'C2::C3'
assert_equal 'tidy', link
- link = @to.handle_special_TIDYLINK tidy 'C4'
+ link = @to.handle_regexp_TIDYLINK tidy 'C4'
assert_equal 'tidy', link
- link = @to.handle_special_TIDYLINK tidy 'C1#m'
+ link = @to.handle_regexp_TIDYLINK tidy 'C1#m'
assert_equal 'tidy', link
- link = @to.handle_special_TIDYLINK tidy 'README.txt'
+ link = @to.handle_regexp_TIDYLINK tidy 'README.txt'
assert_equal 'tidy', link
end
- def test_handle_special_TIDYLINK_label
- link = @to.handle_special_TIDYLINK tidy 'C1#m@foo'
+ def test_handle_regexp_TIDYLINK_label
+ link = @to.handle_regexp_TIDYLINK tidy 'C1#m@foo'
assert_equal "tidy",
link, 'C1#m@foo'
@@ -217,20 +217,20 @@ def para text
"\n#{text}
\n"
end
- def SPECIAL text
- @to.handle_special_CROSSREF special text
+ def REGEXP_HANDLING text
+ @to.handle_regexp_CROSSREF regexp_handling text
end
def hyper reference
- RDoc::Markup::Special.new 0, "rdoc-ref:#{reference}"
+ RDoc::Markup::RegexpHandling.new 0, "rdoc-ref:#{reference}"
end
- def special text
- RDoc::Markup::Special.new 0, text
+ def regexp_handling text
+ RDoc::Markup::RegexpHandling.new 0, text
end
def tidy reference
- RDoc::Markup::Special.new 0, "{tidy}[rdoc-ref:#{reference}]"
+ RDoc::Markup::RegexpHandling.new 0, "{tidy}[rdoc-ref:#{reference}]"
end
end
diff --git a/test/test_rdoc_markup_to_html_snippet.rb b/test/test_rdoc_markup_to_html_snippet.rb
index ad03747c89..7e01413dda 100644
--- a/test/test_rdoc_markup_to_html_snippet.rb
+++ b/test/test_rdoc_markup_to_html_snippet.rb
@@ -650,10 +650,10 @@ def test_convert_TIDYLINK_rdoc_label
assert_equal 3, @to.characters
end
- def test_handle_special_HYPERLINK_link
- special = RDoc::Markup::Special.new 0, 'link:README.txt'
+ def test_handle_regexp_HYPERLINK_link
+ target = RDoc::Markup::RegexpHandling.new 0, 'link:README.txt'
- link = @to.handle_special_HYPERLINK special
+ link = @to.handle_regexp_HYPERLINK target
assert_equal 'README.txt', link
end